Answer
(a) compressed $0.15m$
(b) stretched $0.063m$
Work Step by Step
(a) We know that
$x=\frac{-\rho_{block}Vg}{K}$
We plug in the known values to obtain:
$x=\frac{-(710)(0.012)(9.81)}{540}$
$x=-0.15m$
Thus, the spring is compressed by $0.15m.$
(b) We know that
$x=\frac{(\rho_w-\rho_{block})Vg}{K}$
We plug in the known values to obtain:
$x=\frac{(1000-710)(0.012)(9.81)}{540}$
$x=0.063m$
Thus, the spring is stretched by $0.063m$