[Solution by Dr. Abubacker] $\cos x\ge\sin x$ on $\left[-\frac{3\pi}4,\frac\pi4\right]$, and $\sin x\ge\cos x$ elsewhere in $[-\pi,\pi]$. So $f=\sin x$ on $\left[-\pi,-\frac{3\pi}4\right]$ and $\left[\frac\pi4,\pi\right]$, and $f=\cos x$ on $\left[-\frac{3\pi}4,\frac\pi4\right]$. Area $=\int|f|dx$: $\int_{-\pi}^{-3\pi/4}|\sin x|dx=1-\frac{\sqrt2}2$; $\int_{-3\pi/4}^{-\pi/2}|\cos x|dx=1-\frac{\sqrt2}2$; $\int_{-\pi/2}^{\pi/4}\cos x\,dx=1+\frac{\sqrt2}2$; $\int_{\pi/4}^\pi\sin x\,dx=1+\frac{\sqrt2}2$. Sum $=4$. Answer (2).