The correct options are
A There will be no compression or elongation in the spring, if all the surfaces are smooth.
D There will be elongation in the spring, if A is smooth and B is rough.
When all surfaces are smooth,
acceleration of both blocks is gsinθ. So, no elongation or compression of spring takes place.
When A is rough, B is smooth,
Acceleration of A < Acceleration of B
Hence, A moves less distance compared to B, and spring will compress.
When B is rough, A is smooth,
Acceleration of B < Acceleration of A
Hence, B moves less distance compared to A, and spring will elongate.
a,d are correct.