Answer
(a) $v = 3.87~m/s$
(b) The block's closest distance to the wall is 0.10 meters.
Work Step by Step
(a) $K+U = F~d$
$K = F~d-U$
$\frac{1}{2}mv^2 = F~x-\frac{1}{2}kx^2$
$v^2 = \frac{2F~x-kx^2}{m}$
$v = \sqrt{\frac{2F~x-kx^2}{m}}$
$v = \sqrt{\frac{(2)(20.0~N)(0.25~m)-(40.0~N/m)(0.25~m)^2}{0.500~kg}}$
$v = 3.87~m/s$
(b) The block will come closest to the wall when all the energy in the system is stored as potential energy in the spring, which is when the spring is compressed its maximum distance.
$\frac{1}{2}kx^2 = F~d$
$x^2 = \frac{2F~d}{k}$
$x = \sqrt{\frac{2F~d}{k}}$
$x = \sqrt{\frac{(2)(20.0~N)(0.25~m)}{40.0~N/m}}$
$x = 0.50~m$
When the spring is compressed a distance of 0.50 meters, the block is a distance of 0.10 meters from the wall.