Answer: 0.19 m
SOLUTION:
We can use the formula of potential energy stored in the spring, i.e

where,
- (PE) represents potential energy.
- (k) represents spring constant
- (x) represents displacement or compression of the spring.
Also given that the spring constant (k) is 270 N/m, potential energy (PE) is 5 J.
To find (x), substitute the given values in the above formula,

Hence, the spring is compressed 0.19 m approximately.