When direct current passed through a spring then it:-
when a current will pass through the spring the magnetic filed will produce since the current pass in same direction in all coil of spring , the magnetic field wil have same direction all coils this causes the spring to reduce its length ,
when an A.C. is passed through a metallic spring it starts oscillating whereas when D.C. is passed it contracts. The reason is simple. When DC is passed through the spring all turns become magnet with faces having N, S, N, S polarities and therefore each turn attracts each other and the spring Contracts .In case of an AC , now it is not difficult to understand the the polarities will go on changing say from N to S and S to N alternatively because of the alternating current. This makes the staring to contract and expand alternatively too.