What is the total distance covered by simple harmonic oscillator in a time equal to its period the amplitude of oscillation is A?

The Indian Air Force (IAF) is soon be going to release the official notification for the IAF STAR 01/2023 in the first week of November 2022.  The selection of the candidates depend on three stages which are Online Written Test, Physical Fitness Test, and Medical Examination. The exam is scheduled in mid week of January 2023. The candidates who qualified for all the stages and selected for the Air Force Group X posts will receive a salary range between Rs. 21,700 to Rs. 57,500. With 12th Pass & Diploma as the basic educational qualification, this is one of the most sought jobs. Candidates can check the Airforce Group X eligibility here.

I'll assume that you're talking about the simple case of the one-dimensional simple harmonic oscillator: $x(t) = A\cos(\omega t + \phi)$. For simplicity we'll assume $\phi = 0$**. Let $T$ be the period of oscillation. From Calculus we know that $ds^2 = dx^2 + dy^2 = dx^2 \implies ds = |dx|$ so

$$S = \int_T ds = \int_T |dx|\,.$$

We also know that $dx/dt = -A\omega\sin(\omega t)$ so

\begin{align*} \int_T|dx| = \int_{0}^{2\pi/\omega}A\omega|\sin(\omega t)|dt &= A\omega\left[\int_0^{\pi/\omega}\sin(\omega t)dt +\int_{\pi/\omega}^{2\pi/\omega}-\sin(\omega t)dt\right]\\ &= A\omega\left[\frac{1}{\omega}(-(-1)-(-1)) + \frac{1}{\omega}(1-(-1))\right] \\ &= 4A\,. \end{align*}

**This integral is different (not so sure any more, see other answer) if you don't assume $\phi = 0$. In order to get the same results, you would have to change the limits of integration. If you don't change the limits, you get a different answer depending on the phase shift (which is an interesting property of SHOs!). Hint: if you keep the limits the same, you should get an answer of the form $$ S = A[2\cos\phi - 2\cos(\pi + \phi)]\,.$$