In 3rd year or in 4th year..
To write the gate exam, your elligibility starts form the final year. So you can start studying from 3rd year and appear for the exam during your final year.