yahoo interview questions
Posted by Atul Bhatia on July 4, 2008
YAHOO PLACEMENT PAPER
1. In a village in each family they give birth to children till they
get a boy. IF girl child they try again. What is the ratio of boys to
girls.
2. 2n+1 numbers in a list except for 1 num all had duplicates, how to
find duplicate in O(n)
3. In 1000 wine bottles stack 10 are poisoned given 10 rats what is
the minimum number of tries to find the poisoned one. Rat dies once it
licks the poisoned wine.
4. Write 1,3,6,4 using +,-,*,/ to get 24 (no repeat of numbers)
5. Which is the DS used in dictionary mode in mobile (t9)
6. Which is DS used for chess program…to predict move each and every time..
7. There are $1070 dollars how to split them into bags such that asked
for any denomination from $1 to $1070 , u must b able to give without
opening bag…
As soon as we get the answers to most of above questions we will be posting more stuff that can be really handy for placements including company patterns, questions both related programming and aptitude and other important stuff…
So let’s discuss this questions first to open ourself to new wisdoms regarding placements
ljain said
ans 4. 1:1
ans 6,7 what is DS
enlightenminds said
@Ljain I m giving solutions to all the question
enlightenminds said
1 :ans C is thef,D is true!
this is the key from this e had stolen ruby)
marks 3
2 :ans 6;
marks 4
3 :ans loss,60paise
marks 3
4 :ans 6.3 minutes
marks 4
5 :foot ball match………
marks 8
6 :ans 71842
5 marks
7 :ans 4,8
marks 3
8 :ans
A French Italian
B English French
C German Italian
D German Italian
marks 7
9
D did nt stolen from B
one more condition is there
marks 7
10 :ans is Aand B’s hair is white
marks 5
ram said
Q1: Ans 1Expln: Let’s say there are n couples.Assuming probability of having a boy or a girl is equal,The number of girls will be,Ng = n(1/2 + 1/2 + 1/2 …….)The number of boys will be,Nb = n(1/2 + 1/2 + 1/2 …….)Hence Ng/Nb = 1Alternate Expln:-Since probability of having boy or girl is equal, out of n couples, half of them will have their first child as a girl child and the other half would have their first child as a boy child. This is of course, assuming that the chances of having a boy child / girl child is mutually exlusive, exhaustive and equal. So, after the first birth, the ratio of boys to girls is 1.Now, those couples that already had a boy child stop, while those couples that had a girl child continue. As discussed above, there are n/2 couples who had a girl child and hence they continue. Out of these n/2, again, half the couples (i.e. n/4) might have another girl child and the other half (i.e. n/4) might have a boy child. Again, the ratio of boys to girls will be 1.By principle of mathematical induction (or let’s say commonsense
) we can see that the ratio remains at 1 at all times!
Question 2:
XOR all the 2n+1 numbers.. the result is the one unique number.. Its order is O(n)..
Question 4. 6/(1-(3/4))
Q5
t9 makes use of trie structure i suppose.
ram said
Question 7.
Make 11 bags. First bag contains 2^0 coins.
second bag contains 2^1 coins.
third bag contains 2^2 coins.
.
.
.
11th bag contains 2^10 coins..
rana said
@ram
your solution
2^0+2^1+…+2^10 is not 1070 which is required cond for the problem..
enlightenminds said
Well thanx Ram
Yr solutions are good
I just found above question somewhere but could not get solutions
I think 2nd answer is superb
I will keep on posting some new stuff
Let’s discuss it here
Dinesh Sriram said
i think the ds used for chess program is Depth First Search(DFS)
vish said
11th bag will contain 47$.
Ajoy Bhatia said
For Question 1: Ratio of boys to girls in village – I know that the answer that Ram gave is the expected answer; but I find this question itself to be incorrect. It requires making the assumption that the probability of giving birth to a boy or a girl is equal. The moment you make this assumption, you have fixed the ratio to be 1:1. If you do not make this assumption, then you really cannot say anything about the ratio. The 1st children of all 100 couples (say), there might be 20 girls & 80 boys. Then the 20 couples go for a second child and could have all 20 boys. That gives us 100 boys and 20 girls. If you assume at the outset that the probability of having a boy or a girl is equal, then there is nothing more to say. Also, EVEN IF probability of having a boy or a girl is equal, it does NOT mean that always half the couples will have boys and the other half will have girls. That is like saying that since the probability of heads or tails when a coin is tossed, is the same; it means that if you toss a coin N times, there will ALWAYS be N/2 heads and N/2 tails. Anyone with a little knowledge of probability and statistics could tell you that that is not the way probability works. I challenge anyone to prove that this question and the expected answer of 1:1 is valid.