Interview Question

Data Scientist - Analytics Interview

-

Meta

There are two mobile restroom stalls at a construction site where I work. There are also three situations that have an equal chance of occurrence: a. none of them is occupied b. only one of them is occupied c. both are occupied 1. If I were to pick one at random, what is the probability that it is occupied? 2. If it turns out that that first one I go to is occupied and I decide to try the other one, what is the probability that the second one is also occupied?

AnswerAdd Tags

Interview Answers

13 Answers

29

the answer to the first question is - 1/3 + 1/3*1/2 = 1/2 the answer to the second question require the formula of conditional probability. Let's say: P(A) - probability that second stall is occupied P(B) - probability that the first stall is occupied P(A\B) = P(AandB) / P(B) P(B) = 1/2 (first question) P(AandB) = 1/3 P(A\B) = (1/3) / (1/2) = 2/3

Anonymous on

17

Above answer is wrong, the answer to the first and second question are both 1/2.

Anonymous on

2

there are 2 doors (A and B) and related 4 options with given probabilities option 1: A is full ; B is full ; prob 1/3 option 2: A is full; B is empty; prob "m" option 3: A is empty; B is full; prob "n" option 4: A is empty, B is empty, prob 1/3 we know m +n = 1/3 First question I have p1 probability to chose A and 1-p1 probability to chose B * I chose A and A is full: prob = 1/3+m * I chose B and B is full: prob = 1/3+n -> all together p1 *(1/3+m) + (1-p1)(1/3+n) -> assuming p1 =1/2 (probability of choosing door A and B equal) this gives 1/2 by using m+n = 1/3 Second question I chose door A first; prob of it being full is (1/3+a); given it is full we have 2 options "1" and "2". * Given A full being B is full (1/3)(1/3+a) * Given B full being A is full (1/3)(1/3+b) = (1/3)(1/3+(1/3-a)) then the total prob will be p1 * (1/3)(1/3+a) + (1-p1)(1/3)(1/3+(1/3-a)) if p1 =1/2 doors are not different in prob to be full if a=b = 1/6 choosing doors by the person is equally probable then this equation give 2/3 say door a is closer to the concert hall and b never gets full if A is empty and you always test B first; than p1 = 0; a = 1/3; b = 0 than If you find B full don't test A because the equation gives 1

Anonymous on

1

The given equally likely conditions , i.e: a. none of them is occupied b. only one of them is occupied c. both are occupied Tells us the probability of any stall being occupied is 0.5. Hence, shouldn't the solution be Sol_1 = 1/2 and Sol_2= 1/2 *1/2 =1/4 ??

Anonymous on

1

" "the answer to the first question is - 1/3 + 1/3*1/2 = 1/2" Can you please explain how you derive this? " There are also three situations that have an equal chance of occurrence - meaning each have probability 1/3 to occur. 1/3 - the probability that I chose the option where they are both occupied. 1/3 * 1/2 - the probability that if one occupied and the other isn't , I chose the one that is occupied.

Anonymous on

1

Situation 1: They're both occupied (P = 1/3) A B 1 1 ====================================================== Situation 2: Only one is occupied (P = 1/3) A B 1 0 OR A B 0 1 ====================================================== Situation 3: None of them is occupied A B 0 0

Anonymous on

1

This is not clear at all. Can you please explain how do you derive this mathematically?

the answer to the first question is - 1/3 + 1/3*1/2 = 1/2 on

0

"the answer to the first question is - 1/3 + 1/3*1/2 = 1/2" Can you please explain how you derive this?

Anonymous on

0

a-> m b ->n update notation Second question I chose door A first; prob of it being full is (1/3+m); given it is full we have 2 options "1" and "2". * Given A full being B is full (1/3)/(1/3+m) * Given B full being A is full (1/3)/(1/3+n) = (1/3)/(1/3+(1/3-m)) then the total prob will be p1 * (1/3)/(1/3+m) + (1-p1)(1/3)/(1/3+(1/3-m)) if p1 =1/2 doors are not different in prob to be full if m=n = 1/6 choosing doors by the person is equally probable then this equation give 2/3 say door a is closer to the concert hall and b never gets full if A is empty and you always test B first; than p1 = 0; m = 1/3; n = 0 than If you find B full don't test A because the equation gives 1

Anonymous on

0

A ocupied & B empty, A & B ocupied, A & B empty, A empty & B ocupied. 25% chance for each scenario, so the probability for A or B to be ocupied is 50%.

Anonymous on

0

I think a more rigorous approach to problem #1 would be: P(choosing restroom A) * P(restroom A being occupied) + P(choosing restroom B) * P(restroom B being occupied)

Anonymous on

0

Situation 1: They're both occupied (P = 1/3) A B 1 1 ====================================================== Situation 2: Only one is occupied (P = 1/3) A B 1 0 OR A B 0 1 ====================================================== Situation 3: None of them is occupied (P = 1/3) A B 0 0

Anonymous on

0

Probability of selecting a restroom out of two restrooms is 0.5. Then probability of being occupied the selected restroom is 0.5. So, the total probability is 0.5 X 0.5 = 0.25

Bari on

Add Answers or Comments

To comment on this, Sign In or Sign Up.