To find area under a curve, integrate it.
If you integrate cos x with respect to x, you get sin(x)
If you directly apply the limits from 0 to 2pi, you will get 0.
To find the area, you need to apply limits from 0 to π/2, π/2 to π, 3π/2 and 3π/2 to 2π. Take modulus of each limit and add.
You will get the answer as 4. (value of each limit 1)