## xyz Interview Question for Data Scientists

Country: United States
Interview Type: Phone Interview

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

This question is so poorly written and thus misleading. The most important information is hidden behind the ambiguous wording of the question.

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

68% is correct but the solution is not.
The correct solution is:
A - first chip is good;
B - second chip is good.
What we have to find is a conditional probability p(B/A) which is
p(B/A)= p(AB) / p(A).
Let's designate:
p1 - is probability to get a good chip from the first vendor.
p2 - is probability to get a good chip from the second vendor.
p(AB) = 0.5*p1*p1 + 0.5*p2*p2
p(A) = 0.5*p1 + 0.5*p2
So
p(B/A) = (p1*p1 + p2*p2)/(p1 + p2).

Example: p1 = 0.8; p2 = 0.2
p(B/A)=0.68

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

I didn't answer this one correctly, but the interviewer helped me. So, if we know that probability to get good chip from good company is 0.8 and from bad company is 0.2, and first chip in the pack is good, it translates to the probability of the second chip to be good 0.8*0.8=0.64 (if pack came from the good company), and 0.2*0.2=0.04 (if pack came from the bad company). And total probability that the second chip in the pack is good is a sum of both probabilities: 0.8*0.8 + 0.2*0.2 = 0.64+0.04 = 0.68 , or 68%.

Comment hidden because of low score. Click to expand.
0

According to probability tree the branch is as below

That means 1/2 * p(Good chip) * p(Good chip)

Now as the company is a bad company p(Good chip) can never be 1. Otherwise it would never be a bad company. That means the probability is less than 1/2 i.e. less than 50%

Comment hidden because of low score. Click to expand.
0

Sorry I was wrong

It should be

According to probability tree the branch is as below
Bad_company-->Good chip-->Good chip + Good_company-->Good chip-->Good chip

That means probability is
1/2 * pBad(Good chip) * pBad(Good chip) + 1/2 * pGood(Good chip)*pGood(Good chip)

Now as the company is a bad company pBad(Good chip) can never be 1. Otherwise it would never be a bad company.
Again pGood(Good chip) is always more than pBad(Good chip).

Now the answer will come accordingly.

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

I post my solution made with tree diagram

--->(branch 1) Good Company, 0.5 ---> (subbranch 1) Good Chips, 0.8
---> (subbranch 2) Bad Chips, 0.2

----> (branch 2) Bad Company, 0.5 ---> (subbranch 1) Good Chips, 0.2
---> (subbranch 2) Bad Chips, 0.8

After we discovered that we got first chips that is good, we can make another probability tree for the aposterior event. However, now probability that we choose a Good company is higher, given the fact that the first chips is good. What is the P(Good Company|Good Chips)?

P(Good Company|Good Chips) = P(Good Company and Good Chips)/P(Good Chips) = (we read values from the upper tree) = 0.8*0.5/(0.8*0.5+0.5*0.2) = 0.8

Given the fact that the first chips is good, now we have 0.8 chance that we chose a good company. So we have another aposterior tree:

--->(branch 1) Good Company, 0.8---> (subbranch 1) Good Chips, 0.8
---> (subbranch 2) Bad Chips, 0.2

----> (branch 2) Bad Company, 0.2 ---> (subbranch 1) Good Chips, 0.2
---> (subbranch 2) Bad Chips, 0.8

We finaly compute from the tree P(Good Chips) = P(Good Chips and Good Company) + P(Good Chips and Bad Company) = 0.8*0.8 + 0.2*0.2 = 0.64

Comment hidden because of low score. Click to expand.
0

I am sorry for posting my solution tree times, the system seemed to be blocked ://. Now it's impossible to erase it as I posted it as a guest firstly. BTW, instead of 0.64 it should be 0.68, miscalculation.

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

I post my solution made with tree diagram

--->(branch 1) Good Company, 0.5 ---> (subbranch 1) Good Chips, 0.8
---> (subbranch 2) Bad Chips, 0.2

----> (branch 2) Bad Company, 0.5 ---> (subbranch 1) Good Chips, 0.2
---> (subbranch 2) Bad Chips, 0.8

After we discovered that we got first chips that is good, we can make another probability tree for the aposterior event. However, now probability that we choose a Good company is higher, given the fact that the first chips is good. What is the P(Good Company|Good Chips)?

P(Good Company|Good Chips) = P(Good Company and Good Chips)/P(Good Chips) = (we read values from the upper tree) = 0.8*0.5/(0.8*0.5+0.5*0.2) = 0.8

Given the fact that the first chips is good, now we have 0.8 chance that we chose a good company. So we have another aposterior tree:

--->(branch 1) Good Company, 0.8---> (subbranch 1) Good Chips, 0.8
---> (subbranch 2) Bad Chips, 0.2

----> (branch 2) Bad Company, 0.2 ---> (subbranch 1) Good Chips, 0.2
---> (subbranch 2) Bad Chips, 0.8

We finaly compute from the tree P(Good Chips) = P(Good Chips and Good Company) + P(Good Chips and Bad Company) = 0.8*0.8 + 0.2*0.2 = 0.64

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

I post my solution made with tree diagrams

--->(branch 1) Good Company, 0.5 ---> (subbranch 1) Good Chips, 0.8
---> (subbranch 2) Bad Chips, 0.2

----> (branch 2) Bad Company, 0.5 ---> (subbranch 1) Good Chips, 0.2
---> (subbranch 2) Bad Chips, 0.8

After we discovered that we got chips that is good, we can make another probability tree for the aposterior event. However, for the new tree, probability that we choose a Good company is higher, given the fact that the first chips is good. What is the P(Good Company|Good Chips)?

P(Good Company|Good Chips) = P(Good Company and Good Chips)/P(Good Chips) = (we read values from the upper tree) = 0.8*0.5/(0.8*0.5+0.5*0.2) = 0.8

Given the fact that the first chips is good, now we have 0.8 chance that we chose a good company. So we have another aposterior tree:

--->(branch 1) Good Company, 0.8---> (subbranch 1) Good Chips, 0.8
---> (subbranch 2) Bad Chips, 0.2

----> (branch 2) Bad Company, 0.2 ---> (subbranch 1) Good Chips, 0.2
---> (subbranch 2) Bad Chips, 0.8

We finally compute from the tree P(Good Chips) = P(Good Chips and Good Company) + P(Good Chips and Bad Company) = 0.8*0.8 + 0.2*0.2 = 0.68

Comment hidden because of low score. Click to expand.
-1
of 3 vote

Both chips are coming from the same either good or bad company. Doesn't it mean if first chip is good then second ship is also good since its from same company?
Thus probability should be 100%

Comment hidden because of low score. Click to expand.
0

No the question is poorly worded. The "good" company does not make 100% "good" chips and the "bad" company does not make 100% failing chips. A good company has a chance of making bad chips. By saying the "first chip in the pack is good", he does not mean from the "good" company but he mean good as in it is not a failing chip.

Comment hidden because of low score. Click to expand.
0

Honestly my heard started hearting after reading the previuos comment

Comment hidden because of low score. Click to expand.
-1
of 1 vote

Both chips are coming from the same, either good or bad company. Doesn't it mean if first chip is good then second chip should also be good, since both are coming from same company?
Thus probability should be 100%

Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0

What !??
0.2 * 2 = 0.4
0.2 * 0.2 = 0.04

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.

### 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.