LET'S TALK TECHNICAL

This blog is intended to help people prepare for the job interviews and improve their analytical skills. We have posted difficult datastructures and algorithm questions and puzzles. Interview experiences section is for the people to post their interview experiences.Views expressed here are of their personal and the blog author doesn't take any responsibility for the same.

-

Followers

Jobs

Thursday, November 22, 2007

Ratio of boys and girls.

In a country in which people only want boys, every family continues to have children until they have a boy. if they have a girl, they have another child. if they have a boy, they stop. what is the proportion of boys to girls in the country?

Solution:

It doesn't matter how many kids a family has. The odds of having a boy or girl are always the same. So number of boys and girls in the village is same.

Ratio of boys and girls.

In a country in which people only want boys, every family continues to have children until they have a boy. if they have a girl, they have another child. if they have a boy, they stop. what is the proportion of boys to girls in the country?

Solution:

50:50.

probability of a boy/girl is always 2 irrespective of the number of conditions.

for the above problem we can prove it with simple probability theory.

Lets assume P(b) be the probability of having a boy. P(g) be the probability of having a girl.

Total expectation of a boy is equal to (probability of having a boy at first instance + probability of having a girl then a boy + probability of having 2 girls followd by a boy + etc... )
E(b) = 1/2 + 1/2*1/2 + 1/2*1/2*1/2 + ......
it comes down to 1 ( infinite series sum = a/1-r = 1/2/1-1/2 = 1).

E(g) = 0 + 1/2 + 1/4 + 1/8....
it comes down to 1.

It means there are equal number of girls and boys in the village.

Number coding

Assume 9 is twice 5; how will you write 6 times 5 in the same system of notation

Solution:

9 is twice 5. So 5 is 4.5.
6 times 5 should be 6*4.5 = 27

Distance between trains

One train runs from A to B at 105 miles per hour; the other runs from B to A at 85 miles per hour. How far apart were the two trains 30 minutes prior to their crossing?


Solution:

Two trains are 95 miles apart 1/2 Hr before they crossed each other

Relative Speed of the trains = 85+105 = 190MPH

One hour before they crossed, they would have been 190 miles apart.

Distance between the trains 1/2 hr before they crossed would be 190/2 = 95miles

Probability of observing a car

If the probability of observing a car in 30 minutes on a highway is 0.95, what is the probability of observing a car in 10 minutes (assuming constant default probability)?


probability of not observing a car in 30 mins = probabality of not observing a car in first 10 mins * not obs in next 10 mins * not obs in last 10 mins

lets assume observing a car in 10 mins = p

probability of not observing the car in 10 mins = 1-p

probability of not observing the car in 30 mins = (1-p)^3

so (1-p)^3 = 0.05

1-p = (0.05)^1/3.
p = 1- (0.05)^1/3.
p = 1- 0.37
p = 0.63.



Popular Posts