How would you do this question?
The volume of the cylinder is

where r is the radius of the cylinder and h is its height.
The relationship between the height and radius of the cylinder can be found by starting at the centre of the cylinder/circle, drawing a right-angled triangle with sidelengths

(from the centre out horizontally), height

(from the edge of the cylinder up to the top), and hypotenuse 8 cm (from the centre radially out towards the edge of the sphere).
Then we have that

, or

. Now substitute into the volume function to get
 = \pi\left(64 - \frac{h^2}{4} \right) h = 64h \pi - \frac{\pi h^3}{4}.)
Now that we have a function in one variable we can differentiate to find its maximum:
 &= 64\pi - \frac{3\pi h^2}{4})
. Setting this equal to zero we have
\left(h + \frac{16}{\sqrt 3}\right) &= 0\\ h = \frac{16\sqrt 3}{3}<br />\end{alignedat})
(note h > 0).
Finally,the volume is
^3}{4\times 27} \\ &= \frac{\pi\sqrt 3(3\times 64 \times 16 - 16^3/4)}{9} \\ &= \frac{2048 \pi \sqrt 3}{9}\;\mathrm{cm}^{3} \\ &\approx 1238.22\; \mathrm{cm}^{3}<br />\end{alignedat})