The first step of problem solving is to understand what the problem is asking, that is where I am stuck.
One of the legs of a right triangle has length 4 cm. Express the length of the altitude perpendicular to the hypotenuse as a function of the length of the hypotenuse.

This is the picture I first came up with, since a is perpendicular to h. But the answer is $4\sqrt{h^2-16}/h$.
This means they do not really want $a$, as that would seem to be half $h$.
I need a fourth opinion here, I have asked others and no luck here.
Note that $b=\sqrt{h^2-16}$. Also, by similar triangles (or using the sine of the angle at the bottom left corner), $$\frac{a}{4}=\frac{\sqrt{h^2-16}}{h}.$$
Remark: The reason you say that $a$ is half of $h$ is that your picture has $b$ almost the same length as the bottom side, so the whole picture looks like a square. But it need not be. The side $b$ could be a lot bigger or smaller than $4$.