Consider a surface diffeomorphic to a cylinder (the boundary is 2 curves diffeomorphic to circles). Suppose the boundary curves are geodesic, can the surface have non-vanishing gaussian curvature (i.e. $K \neq 0$ everywhere)?
I tried to use the Gauss-Bonnet theorem, but I'm not sure how.
Look at the statement of Gauss-Bonnet: $$ \int_M K dA + \int_{\partial M} k_g dl = 2\pi \chi(M).$$ Here, $K$ is the Gaussian curvature, $k_g$ is the geodesic curvature of the boundary components, and $\chi(M)$ is the Euler characteristic.
The geodesic curvature $k_g$ measures how far a curve is from being geodesic. Since the boundary circles are geodesic, $k_g = 0$ on the boundary circles!
You also need to know that $\chi(M) = 0$. (Perhaps you could find a triangulation of the cylinder to prove this.)
Assume $K \neq 0$ everywhere on $M$. Since $M$ is connected, $K$ obeys the intermediate value theorem. So either $K > 0$ everywhere, or $K < 0$ everywhere.
Putting these three facts together, you should be able to derive a contradiction!