The spring constant provides the force required to change the length of a spring by an infinitesimal length if it has already been compressed by a length x. The force F = kx.
Given the force required as F = kx, we can find the work to be done to change the length of the spring from an initial length x1 to x2 as Int [F*dx], x= x1 to x=x2
W = Int [k*x dx], x = x1 to x=x2
=> kx^2/2, x = x1 to x=x2
Here the spring constant is given as 16N/m.
The work to be done is therefore 16*x^2/2, x = 0 to x = 5 cm
=> 16*(.05^2 – 0^2)/2
=> 0.02 J
The required work to be done is 0.02 J