probability of occurrence

This question was asked in the adobe interview:
void foo1()
{
  if(A < B)
    Then { }
  else
   if(C < D)
     then foo2()

}
How many time foo2 () would get called given
A < B 25% of the times and C < D 75% of the times and foo1 () is called
5000 times 

Comments

  1. X=event when only A<B is true and C<D is false ...so no call to foo2
    Y=event when only C<D is true and A<B is false so foo2 would be called
    Z=both are true...in this foo2 would not be called

    so chances that foo2 would not be called is greater than equal to 25% .

    bas iske aage nahi aata... horrbly weak at maths..

    Plz tell the ans nw....

    ReplyDelete

Post a Comment

Popular posts from this blog