Geoff Canyon has a post about Google's tricky interview questions. Microsoft is also known for asking these kind of questions during interviews, and you can run into them anywhere in the technical world. Also known as Fermi problems or back-of-the-envelope calculations, I ran into these a lot during college because physicists love these things. The idea is to increase your willingness to come up with creative solutions, and get over the panic induced by asking a question that has no easy answer. These are in fact a very sneaky kind of IQ test.
I thought it would be fun and instructive [for me] to simulate my way to this answer rather than do it analytically. This problem can be solved analytically, but not all problems can, so sometimes it is good to know how to do this.
I actually set the probability of a boy being born to 0.514, since 106 boys are born for every 100 girls or so. The mean of the data turned out to be 0.504 with a standard deviation of 0.011, which is close enough.