I've also been on the receiving side of delightful trivia questions like "What are all the ways the character '*' is used in Python?" and puzzle questions that test "creativity"/"ingenuity", whose value are totally alien to me. (I've also done online quizzes/tests, including personality ones(!))
I would like to think there's a broad middle ground in between, but that there isn't a single process that is going to be effective for all companies or for all candidates.
In the past, I've used "homework" as a final step in a hiring process, which worked for some (it certainly washed out a few candidates who got passed less strenuous interviewers), but which others weren't interested in doing - including two that we hired anyway and who ended up being great coworkers.
I imagine I would feel a bit put out if a startup wanted me to spend 2-4 hours on something before they allowed me the opportunity to get to understand the position and the company (especially since I would hope the startup would look at my open source contributions in lieu of the homework). New grads might have a bunch of opportunities, and they might decide on skipping something with that sort of requirement.