We use a quenching scheme to study the dynamics of a one-dimensional anisotropic XY spin-1/2 chain in the presence of a transverse field which alternates between the values h+δ and h-δ from site to site. In this quenching scheme, the parameter denoting the anisotropy of interaction (γ) is linearly quenched from -∞ to +∞ as γ=t/τ, keeping the total strength of interaction J fixed. The system traverses through a gapless phase when γ is quenched along the critical surface h2 = δ2 + J2 in the parameter space spanned by h, δ, and γ. By mapping to an equivalent two-level Landau-Zener problem, we show that the defect density in the final state scales as 1/ τ1/3, a behavior that has not been observed in previous studies of quenching through a gapless phase. We also generalize the model incorporating additional alternations in the anisotropy or in the strength of the interaction and derive an identical result under a similar quenching. Based on the above results, we propose a general scaling of the defect density with the quenching rate τ for quenching along a gapless critical line. © 2008 The American Physical Society.