If the spring is compressed ,what change is expected in the potential energy of the spring?
When a spring is compressed a work is done on it. Thus the work done on it is stored as the potential energy of the spring in its compressed state.
Mathematically, PE of a string is given by
PE = ½ kx2 where k = spring constant, x = distance by which the string is compressed.