How do textbook authors and professors cook up homework/assignment questions? I was looking around on the internet and I found some notes with homework appended to them (for those interested, it is math). What struck me is that these questions are not only lengthy, notationally challenging, but also appears to be quite complicated. For a biology course no less. 

Can any authors or professors illuminate as to how (i.e. the process) these assignment questions are developed? I thought about this and found several scenarios which are quite interesting to think about, but at the same time, ridiculous to me. 

For professors/authors:

scenario a: the professor/author goes home and quietly sits in front of a fireplace and starts brain storming weird scenarios and writes down these random thoughts

scenario b: the professor/author demands his graduate students to pump out 10 questions on a weekly basis, the rest is history

scenario c: the professor/author picks up another book and make adjustments to questions that looks interesting and then puts into his own book. But then this sort of becomes a chicken-egg problem. What about a completely new field that no one has touched before?

scenario d: there exist a large central depository of problems that professors submit to it, and draws question from it, a massive database out of reach of any students. This is some fringe conspiracy theory. 

scenario e: The Hamilton approach. Ideas just flies out at random say when you are taking a shower, or buying some groceries and then you jog them down very quickly and then send it to a depository. Kind of like scenario a but much more random. 

What about people who are cross discipline and working on their own field? Are there dedicated personnel who is neither an author, nor a professor, but just works on developing these assignments all day? This question just opens up a can of worms. 

Please feed my curiosity, I would love to know how they are developed because maybe I will also develop my own someday. I know there exist some distinction between authors and professors (although the two coincides on a great degree), let me know if things done differently between different professions.
You missed scenario f, which I suspect is the most common:  The professor has been teaching this class and refining the textbook/notes for years, and developed homework questions out of problems that have come up over the course of that extended period of time of engaging with this material.