What is the correct answer? 
I got 4 as the answer. I want to know whether i am correct or not.If I please explain.
 A: You've probably been fooled by the idea that the integral represents the area between the $x$-axis and the curve, but this is correct only when the curve is in the half plane $y>0$. It is true that
$$
\int_{0}^{\pi}\sin x\,dx=\Bigl[-\cos x\Bigr]_{0}^{\pi}=
-\cos\pi+\cos0=2
$$
but you need to remember that areas below the $x$-axis count as negative; indeed
$$
\int_{-\pi}^{\pi}\sin x\,dx=\Bigl[-\cos x\Bigr]_{-\pi}^{\pi}=
-\cos\pi+\cos(-\pi)=0.
$$
So you can't double the area, but rather note that the two chunks have opposite areas, which cancel out.
Of course, noticing that $\sin(-x)=-\sin x$ would have spared you from the computation. If $f$ is defined and continuous (one can relax this condition to being integrable) on an interval $[-a,a]$ and $f(-x)=-f(x)$, you can observe that
\begin{align}
\int_{-a}^a f(x)\,dx
&=
\int_{-a}^0 f(x)\,dx+
\int_{0}^a f(x)\,dx\\
&=
\int_{a}^0 -f(-t)\,dt+
\int_{0}^a f(x)\,dx &&\text{(with $x=-t$ in the first integral)}\\
&=
\int_{a}^0 f(t)\,dt+
\int_{0}^a f(x)\,dx &&\text{(using $f(-t)=-f(t)$ in the first integral)}\\[8px]
&=0
\end{align}
