One end of a light spring of spring constant k is fixed to a wall and the other end is tied to a block placed or a smooth horizontal surface. In a displacement, the work done by the spring is the possible cases are

Work done is +ve on when the force applied, and displacement are in the same direction. But here in case of options C and D the spring does not exert a force that is in the direction of displacement but in the opposite, so the work done will be negative. In case of option A and D the work done will be positive.

1