Microsoft Interview Question






Comment hidden because of low score. Click to expand.
2
of 2 vote

Expected value of boys in one family=1
Expected value of girls in one family=1*.5*.5+2*.5*.5*.5+3*.5*.5*.5*.5+...
which is a AGP,
on solving this you will get E(girls in one family)=1
Ratio of boys to girls in village=expected value of boys divided by expected value of girls=1/1=1

- wolverine August 28, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Just consider what the possible cases are and what are the associated probabilities. Let B denote boy and G girl:

B - 0 girl, 1 boy and stop, with prob 0.5, total 1 kid
GB - 1 girl, 1 boy and stop, with prob 0.5^2, total 2 kids
GGB - 2 girl, 1 boy and stop, with prob 0.5^3, totals 3 kids

You get the idea for the remaining infinite cases. So what is the expected number of kids? It is just 0.5(1) + 0.5^2(2) + ... This is not exactly a geometric series, but rather the sum of infinitely many of them:

1/2 + 1/4 + 1/8 + 1/16 + ... = 1
      1/4 + 1/8 + 1/16 + ... = 1/2
            1/8 + 1/16 + ... = 1/4
                  1/16 + ... = 1/8
                         ...

After summing each of them, you are left with a geometric series on the right, which sums to 2. So there are an average of 2 kids per household. But one boy is always present, so we expect one girl. So same proportion.

- Bullocks January 01, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

thanks dude....found the perfect explanation and the math that went with it !! :) thanks again :)

- well wisher November 29, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

this is very interesting : mathoverflow.net/questions/17960/google-question-in-a-country-in-which-people-only-want-boys

- Psycho September 04, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

ans is 1 as far as i know i am looking for explanation

- cunomad August 24, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The average number of children in a family is 2 (1/2^1+2/2^2+3/2^3...)

Since there is exactly one boy in a family then the ratio is 1.

- espresso August 24, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

please will you explain clarly

- sanju October 11, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

out of x couple in the village, x/2 would have boy and x/2 would have girl. Therefore the x/2 would got for another child and there would be x/4 boy and x/4 girl. The process goes on. Mathematically you can write as:
no of boys: x/2 + x/2^2 + x/2^3.....
no of girls: x/2 + x/2^2 + x/2^3....
So the ration will always be one

- neo August 24, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

cunomand stop using job seekers to solve your homework problems!

- Anonymous September 20, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

To be fair, I saw this particular problem on a list of interview questions.

- Bullocks January 01, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

boys : girls = ceil(n/2) : floor(n/2)

- Most_Intelligent_In_The_World February 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

consider a fair toss.
If head stop, if tail go on tossing till u get a head.
P(H) = 1/2 + P(T)P(H) + P(T)P(T)P(H)
P(T) = P(T)P(H) + P(T)P(T)P(H)

ratio works out to be 2:!

- Amit Priyadarshi July 24, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@Amit Priyadarshi nice

- Anonymous July 11, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Only probability is considered but number of boys or girls is missed.
For girls (tails)
1/4 * 1 + 1/8 * 2 + 1/16 * 3...

- Anonymous November 07, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

geometric distribution, p = 1/2. Expectation = 1/p = 2.

- kitten August 23, 2009 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More