Solution 5.7b
From Mechanics
Resolving vertically upwards,
\displaystyle T\cos {{30}^{\circ }}+S-mg=0
where \displaystyle S is the spring force which we assume is upwards.
This gives
\displaystyle S=mg-\ T\cos {{30}^{\circ }}=40\times 9\textrm{.}8-90\times 0\textrm{.}866=314\ \text{N}
As \displaystyle S is positive this means the spring is pushing upwards on the mass and thus the spring is in compression. (If \displaystyle S had been negative the spring would have been pulling downwards on the mass and thus would be in tension).