The area of the rectangle is l*w where l = 20cosx and w is 10sinx where x is the angle from the middle of the semicircle diameter to a corner of the rectangle residing on the curvy part of the semicircle. Thus you need to find the maximum the function 200sinxcosx. Calculus tells us this occurs when 2*(cosx)^2 - 1 =0 -> cosx = sqrt(1/2) ->pi/4 Plug that in as your angle and you will get the largest area rectangle.
The second problem can be done somewhat similarly. Here it is easier to consider area as a function of width instead of angle. Note that proportionality dictates that h = 12*(5-w) so area = 12w(5-w)