I think one of most challenging parts of teaching a course is setting up exams.
There are a lot of constraints:
You want to cover, as reasonably as possible, all the material.
You want to target somewhere around the median of the class; not too hard, not too easy.
You don't want there to be any severe typos or other problems with problem; you can't have a problem without a solution or is otherwise confusing.
There are a limited number of good problems readily available; making up new problems is challenging. (Again, you don't want errors...)
You have to make it all do-able in 90 minutes.
And so on....
I look forward to reaching a point where I don't think it's worth giving exams to students. (I don't in my grad classes.) For my undergrad class, I still think it's necessary.