Let the radius and height of the cylinder are r and h, respectively
In $\Delta\, AOM$,
$r^{2}+\left(\frac{h^{2}}{4}\right)=a^{2} $
$\therefore h^{2}=4\left(a^{2}-r^{2}\right)$
Now, $V=\pi r^{2} h=\pi\left(a^{2} h-\frac{1}{4} h^{3}\right)$
For max or min,
$\frac{d V}{d h} =\pi \left(a^{2}-\frac{3}{4} h^{2}\right)=0$
$\Rightarrow h =\left(\frac{2}{\sqrt{3}}\right) a$
Now, $ \frac{d^{2} V}{d h^{2}}=-\frac{6 h}{4}<\, 0$
So, $V$ is maximum at $h=\frac{2 a}{\sqrt{3}}$