Autocoder

Probability for Data Science Interview Questions and Answers

Last updated 2026-11-19

Probability questions appear in data science, quant-adjacent and analytics interviews because they test clear thinking under uncertainty. The problems are short, and the answer is a single number, so interviewers watch how you set up the sample space, condition correctly and sanity-check the result.

Every solution below shows the setup and the arithmetic. For inference from data, such as confidence intervals and tests, use statistics for data science interview questions; for how these ideas drive experiments, see A/B testing interview questions.

Typical roundsProbability puzzles, conditional probability, expectation, simulation
Core skillsBayes rule, distributions, counting, expectation
Questions here15 worked questions

Habits that avoid mistakes

Distributions to have ready

Binomial for a count of successes in n independent trials, geometric for the number of trials until the first success, Poisson for events in a fixed interval at a constant rate, and the normal for sums and averages. Know the mean and variance of each, and know that for Poisson both equal lambda.

Probability for Data Science Interview Questions and Answers: questions with worked answers

  1. 1

    A disease affects 1 percent of people. A test is positive for 95 percent of sick people and for 5 percent of healthy people. If you test positive, what is the probability you are sick?

    medium

    By Bayes rule: P(sick | +) = P(+ | sick) P(sick) / P(+). The numerator is 0.95 x 0.01 = 0.0095. P(+) = 0.0095 + 0.05 x 0.99 = 0.0095 + 0.0495 = 0.059. So the probability is 0.0095 / 0.059 = 0.161. A positive result from a 95 percent accurate test still leaves only about a 16 percent chance of disease because the condition is rare: most positives are false alarms from the large healthy group. This is the base-rate fallacy.

  2. 2

    Two fair dice are rolled. What is the probability the sum is 7, and the probability that at least one die shows a six?

    easy

    There are 36 equally likely outcomes. Sum 7 can occur as (1,6), (2,5), (3,4), (4,3), (5,2) and (6,1), so the probability is 6/36 = 1/6. For at least one six use the complement: no six has 5 x 5 = 25 outcomes, so the answer is 1 - 25/36 = 11/36, about 0.306.

  3. 3

    What is the probability that at least two people in a group of 23 share a birthday?

    medium

    Use the complement and assume 365 equally likely days. P(all different) = (365/365)(364/365)...(343/365) = 0.4927, so P(shared) = 1 - 0.4927 = 0.507. The result surprises people because the number of pairs is 23 x 22 / 2 = 253, and each pair has a 1/365 chance of matching, so matches are common. With 50 people the probability is about 0.97.

    python
    p_diff = 1.0
    for i in range(23):
        p_diff *= (365 - i) / 365
    print(round(1 - p_diff, 4))   # 0.5073
  4. 4

    Explain the Monty Hall problem and prove that switching is better.

    medium

    You choose one of three doors; the host, who knows where the car is, opens a different door showing a goat and offers a switch. Your first pick is right with probability 1/3, and that probability does not change when the host reveals a goat, because he always can. So the other closed door holds the car with probability 2/3. Switching wins whenever your first pick was wrong, which is 2 out of 3 times. The result depends on the host knowing and always revealing a goat.

    python
    import random
    def play(switch, n=100_000):
        wins = 0
        for _ in range(n):
            car, pick = random.randrange(3), random.randrange(3)
            opened = next(d for d in range(3) if d != pick and d != car)
            if switch:
                pick = next(d for d in range(3) if d != pick and d != opened)
            wins += pick == car
        return wins / n
    print(play(True), play(False))   # about 0.667 and 0.333
  5. 5

    Find the expectation and variance of a fair six-sided die.

    easy

    E[X] = (1 + 2 + 3 + 4 + 5 + 6) / 6 = 3.5. E[X^2] = (1 + 4 + 9 + 16 + 25 + 36) / 6 = 91/6 = 15.167. Var = E[X^2] - E[X]^2 = 15.167 - 12.25 = 2.917, which equals 35/12. The standard deviation is 1.708. For the sum of two independent dice the expectation is 7 and the variance is 2 x 2.917 = 5.833, since variances of independent variables add.

  6. 6

    A coin is tossed until the first head. What is the expected number of tosses?

    easy

    The count is geometric with success probability p = 0.5, and its expectation is 1/p = 2. A derivation: let E be the expectation; with probability 1/2 you finish in one toss, otherwise you have used one toss and start over, so E = 1 + (1/2) E, which gives E = 2. For a fair die, the expected number of rolls until the first six is 6. The variance of a geometric variable is (1 - p) / p^2, which is 2 here.

  7. 7

    You flip a fair coin 10 times. What is the probability of exactly 3 heads, and of at least one head?

    easy

    Exactly 3 heads is binomial: C(10, 3) / 2^10 = 120 / 1024 = 0.117. At least one head is the complement of all tails: 1 - 1/1024 = 0.999. The binomial has mean np = 5 and variance np(1 - p) = 2.5. When n is large and p is small the binomial is well approximated by a Poisson with lambda = np.

  8. 8

    Calls arrive at 3 per hour on average. What is the probability of no calls in an hour, and of exactly 2?

    medium

    Model it as Poisson with lambda = 3: P(k) = e^-lambda lambda^k / k!. P(0) = e^-3 = 0.0498. P(2) = e^-3 x 9 / 2 = 0.224. For a half-hour interval lambda becomes 1.5, since the rate scales with time. Poisson assumes events are independent and the rate is constant; if calls arrive in bursts, the variance exceeds the mean and a negative binomial fits better.

  9. 9

    A family has two children and at least one is a boy. What is the probability both are boys?

    medium

    List the equally likely outcomes: BB, BG, GB, GG. Conditioning on at least one boy removes GG, leaving three outcomes, one of which is BB, so the answer is 1/3. If instead you are told that the elder child is a boy, the outcomes are BB and BG, and the answer is 1/2. The two phrasings give different answers because they carry different information; spelling out the sample space avoids the confusion.

  10. 10

    You have two coins, one fair and one with two heads. You pick one at random and flip heads. What is the probability it is the fair coin?

    medium

    P(fair | H) = P(H | fair) P(fair) / P(H). The numerator is 0.5 x 0.5 = 0.25. P(H) = 0.25 + 1 x 0.5 = 0.75. So the answer is 0.25 / 0.75 = 1/3. After a second head the odds update further: the fair coin is 0.125 / (0.125 + 0.5) = 0.2. Each head is evidence for the two-headed coin.

  11. 11

    Draw two cards without replacement from a deck. What is the probability both are aces?

    easy

    The first card is an ace with probability 4/52. Given that, the second is an ace with probability 3/51. The probability of both is (4/52)(3/51) = 12/2652 = 1/221, about 0.0045. With replacement the draws would be independent and the answer would be (4/52)^2 = 0.0059. Equivalently, count combinations: C(4, 2) / C(52, 2) = 6 / 1326 = 1/221.

  12. 12

    How many rolls of a fair die are needed on average to see all six faces?

    hard

    This is the coupon collector problem. After you hold k distinct faces, the chance that the next roll is new is (6 - k) / 6, so the expected wait for the next new face is 6 / (6 - k). Add over k = 0 to 5: 6 x (1/6 + 1/5 + 1/4 + 1/3 + 1/2 + 1) = 6 x 2.45 = 14.7 rolls. In general it is about n ln n plus 0.577 n for n faces, so a 100-item collection takes roughly 518 draws.

  13. 13

    What is the expected maximum of two fair dice?

    medium

    P(max = k) = (2k - 1) / 36, because the pairs with maximum at most k number k^2 and k^2 - (k - 1)^2 = 2k - 1. So E = (1 x 1 + 2 x 3 + 3 x 5 + 4 x 7 + 5 x 9 + 6 x 11) / 36 = (1 + 6 + 15 + 28 + 45 + 66) / 36 = 161 / 36 = 4.47. The expected minimum is 7 - 4.47 = 2.53, by symmetry, which also agrees with E[max] + E[min] = E[X1] + E[X2] = 7.

  14. 14

    Use linearity of expectation: what is the expected number of fixed points in a random permutation of n items?

    hard

    Let I_i be 1 if item i lands in its own position. P(I_i = 1) = 1/n, so E[I_i] = 1/n. The number of fixed points is the sum of the I_i, so its expectation is n x (1/n) = 1, whatever n is. The indicators are not independent, but linearity of expectation does not need independence. The same trick answers questions such as the expected number of matches when n people pick hats at random.

  15. 15

    Distinguish independent events from mutually exclusive events.

    easy

    Independent events satisfy P(A and B) = P(A) P(B), so knowing one tells you nothing about the other. Mutually exclusive events cannot both happen, so P(A and B) = 0. If both have positive probability, mutually exclusive events are dependent, because knowing that A occurred tells you B did not. Example with one die roll: "even" and "at most 3" give P(both) = 1/6 but P(even) x P(at most 3) = 1/4, so they are dependent, while "even" and "greater than 4" give 1/6 = (1/2)(1/3) and are independent.

Frequently asked questions

How do I check my probability answer quickly?

Simulate it with a few lines of Python using random or numpy, and compare to the analytic answer. A mismatch usually means a mistaken assumption about replacement or independence.

Which distributions are most common in interviews?

Binomial, geometric, Poisson, uniform and normal. Know their expectation and variance and when each applies.

Is Bayes rule really asked often?

Yes. Disease-test and spam-filter style questions are classic because they test conditional reasoning and base rates.

How should I show my work?

Define the events, state the formula, plug in numbers and sanity-check against a bound or a simulation. Interviewers value the structure as much as the final figure.

Related guides

More in Role-wise Interview Questions by Job and Tech Stack

See all in this section