How do you determine the boundary curve for Stokes' Theorem In simple examples, such as with a paraboloid, determining the boundary curve is simple enough. However, when I am faced with more complex examples, I seem to get lost and do not know the proper way to proceed. For example, consider the following problem:
Let $M=M_1\cup M_2$ be a surface such that 
$$\begin{align}&M_1:x^2+y^2=4; 0\leq z\leq 1\\&M_2:x^2+y^2+(z-1)^2=4;z\geq1\end{align}$$
Given the vector field $\mathbf{F}=(zx+z^2y+5y)\mathbf{\widehat{i}}+(z^3yx+2x)\mathbf{\widehat{j}}+(z^4x^2)\mathbf{\widehat{k}}$, compute
$$\iint_M (\nabla\  \times\ \mathbf{F})\ \cdot\ d\mathbf{S}$$
For this problem, I think it would be too difficult to calculate directly and if we use Stokes' theorem, I don't know what the boundary would be. Any help would be appreciated.
Thank you
 A: Visualzing $M$ and $\partial M$
For how to visualize this without resorting to a computer, observe the following:


*

*$M_1$ is a cylinder of radius $2$ about the $z$-axis. $\partial M_1$ is a pair of circles in the  $z=0$ and $z=1$ planes. 

*$M_2$ is part of a sphere with radius $2$ centered at $(0,0,1)$. The domain restriction of $z\geq 1$ shows this to be the "upper hemisphere." $\partial M_2$ is a circle of radius $2$ in the $z=1$ plane. 

*$\partial M_2$ is precisely the portion of $\partial M_1$ in the $z=1$ plane. As such, $\partial M$ is a circle of radius $2$ centered about the origin on the $z=0$ plane (i.e., the $xy$-plane). 


For reference, here's what a graph of your surface $M$ looks like, with $M_1$ in orange, $M_2$ in blue, and $\partial M$ in red:

Assuming that $M$ is oriented with outward pointing normal vectors, the induced boundary orientation is counter-clockwise (as viewed from the $+z$-direction). As such, we can parametrize $\partial M$ by $$\gamma: [0, 2\pi] \to \mathbb{R}^3, ~\gamma(t) = (2 \cos t, 2 \sin t, 0).$$
Using Stokes' Theorem
Now that we have parametrized $\partial M$ with the correct orientation, we can reduce the flux integral to a vector line integral:
\begin{align*}
&\iint_M (\nabla \times \vec{F}) \cdot \mathrm{d} \vec{S}\\
 &= \oint_{\partial M} (zx + z^2 y +5y) \mathrm{d}x + (z^3yx + 2x) \mathrm{d}y + (z^4 x^2) \mathrm{d}z \\
 &= \int_0^{2\pi} \left\langle 0 + 0 + 5 *2 \sin t, 0 + 2*2 \cos t, 0 \right\rangle \cdot \left\langle -2 \sin t, 2 \cos t, 0 \right\rangle \mathrm{d} t \\
 &= \int_0^{2 \pi} -20 \sin^2 t +8 \cos^2 t ~\mathrm{d}t \\
 &= \int_0^{2\pi} -28 \sin^2 t + 8 (\sin^2 t + \cos^2 t) ~\mathrm{d}t \\
 &= -28 \pi + 16 \pi \\
 &= -12 \pi
\end{align*}
