Answer
a) ${\bf 1.25}\;\rm MJ $
b) ${\bf 4\times 10^4}\;\rm turn $
Work Step by Step
$$\color{blue}{\bf [a]}$$
We know that the magnetic energy density is given by
$$u_B=\dfrac{B^2}{2\mu_0}\tag 1$$
where the energy stored is then given by
$$U=u_BV_{\rm solenoid}$$
where $V$ is the volume of the solenoid and is given by $V=\pi r^2l$
$$U=\pi r^2lu_B $$
Plug from (1),
$$U= \dfrac{\pi r^2 lB^2}{2\mu_0}$$
Plug the known;
$$U= \dfrac{\pi (0.20)^2 (1)(5)^2}{2(4\pi\times 10^{-7})}$$
$$U= \color{red}{\bf 1.25}\;\rm MJ $$
$$\color{blue}{\bf [b]}$$
We know that the magnetic field strength at the center of a solenoid is given by
$$B=\dfrac{\mu_0 NI}{l}$$
Solving for $N$;
$$N=\dfrac{lB}{\mu_0 I}$$
Plug the known;
$$N=\dfrac{(1)(5)}{(4\pi\times 10^{-7})(100)}$$
$$N=\color{red}{\bf 4\times 10^4}\;\rm turn $$