ML Interview Q Series: Calculating Multiple-Choice Success Using the Law of Total Probability
Browse all the Probability Interview Questions here.
Question
An examination consists of multiple-choice questions, each having five possible answers. Suppose you are a student taking the exam, and you estimate that you have probability 0.75 of knowing the answer to any question that may be asked. If you do not know the answer, you intend to guess, and each guess has probability 1/5 of being correct. What is the probability that you will give the correct answer to a question?
Short Compact solution
Let A be the event of giving the correct answer, and B be the event that you know the answer. We want P(A).
We compute P(A) as:
P(A ∩ B) = P(A|B)P(B) = 1 * 0.75 = 0.75
P(A ∩ B^c) = P(A|B^c)P(B^c) = (1/5) * 0.25 = 0.05
Hence,
P(A) = 0.75 + 0.05 = 0.80
Comprehensive Explanation
Defining the Events
We define two events:
A: "The student gives the correct answer to a question."
B: "The student knows the correct answer (as opposed to guessing)."
Given:
Probability that the student knows the answer to a question = 0.75. Therefore, P(B) = 0.75.
Probability that the student does not know the answer = 1 - 0.75 = 0.25. So P(B^c) = 0.25.
If the student knows the answer, they answer correctly with probability 1, so P(A|B) = 1.
If the student does not know the answer, they guess among 5 options. The chance of being correct with a random guess is 1/5 = 0.2, so P(A|B^c) = 0.2.
The Law of Total Probability
When a question is posed, the probability of getting it correct is the sum of two disjoint scenarios:
The student knows the answer and therefore is correct.
The student does not know the answer and guesses it correctly.
Mathematically, we use the law of total probability:
We expand each term:
and
Substitute the known values:
P(A|B) = 1
P(B) = 0.75
P(A|B^c) = 0.2
P(B^c) = 0.25
Hence:
P(A ∩ B) = 1 * 0.75 = 0.75 P(A ∩ B^c) = 0.2 * 0.25 = 0.05
Therefore:
P(A) = 0.75 + 0.05 = 0.80
This tells us that the probability of being correct on any single question is 0.80.
Possible Follow-up Question 1
How would the probability P(A) change if the number of options per question was different (for example, 4 options or 10 options)?
Answer:
When the student does not know the answer (event B^c), the chance of guessing correctly depends on the number of choices. If there are n choices in total, then P(A|B^c) = 1/n. The other components remain the same: P(A|B) = 1, and P(B) is still the probability of knowing the answer. Let p be the probability of knowing the answer, so p = 0.75 in our main scenario. Then:
P(A ∩ B) = 1 * p = p.
P(A ∩ B^c) = (1/n) * (1 - p).
Hence, the overall probability of answering correctly:
P(A) = p + (1 - p)*(1/n).
For example:
If n = 4 (four-option multiple-choice), then P(A|B^c) = 1/4 = 0.25, which would increase the contribution from guessing.
If n = 10, then P(A|B^c) = 0.1, which would lower the contribution from guessing relative to n = 5.
Possible Follow-up Question 2
What if the student's probability of knowing the answer, P(B), varies by question or is not always 0.75?
Answer:
If the probability of knowing the answer differs from question to question, you could denote it p_i for question i. In that case, the overall probability of being correct on the i-th question would be:
p_i + (1 - p_i)*(1/5)
assuming there are still 5 options for each question and the guess probability remains 1/5. To find the average probability of answering correctly across multiple questions, you would take the expectation over all p_i values. For example, if p_i is drawn from some distribution, you would compute:
Expected P(A) = E[p_i + (1 - p_i)*(1/5)] = E[p_i] + (1/5)*E[1 - p_i] = E[p_i] + (1/5)(1 - E[p_i])
= (4/5) E[p_i] + 1/5.
Hence, if the probability of knowing the answer changes from question to question, you plug that question-specific probability into the same formula. On average, the result depends on the mean of p_i.
Possible Follow-up Question 3
What if partial knowledge influences the probability of guessing for the unknown portion (e.g., eliminating some options and guessing among fewer)?
Answer:
In more realistic scenarios, a student who only partially knows the material might eliminate one or more answer choices, increasing the effective probability of a correct guess. Suppose the student can eliminate k options out of the 5, leaving (5 - k) plausible choices. If the student is in the "does not fully know" state, but can still eliminate k wrong options, then:
Probability of guessing correctly becomes 1/(5 - k).
Let’s denote:
q = Probability the student can reduce the choices from 5 to (5 - k) in the "not fully known" situation,
p = Probability of fully knowing the answer (which remains P(B)),
1 - p - q = Probability of being unable to eliminate any options and thus guessing among all 5.
Then, the calculation becomes more complicated but conceptually follows the same pattern, by taking the weighted sum of each scenario (fully knowing the answer, partially eliminating, or blind guessing).
Possible Follow-up Question 4
Could this approach be extended to test-taking strategies, such as skipping questions or marking them for review?
Answer:
Yes, the same basic probabilistic framework can be extended. For instance, if there is a penalty for wrong answers, a student might choose to skip questions they don't know. You would then introduce additional events:
S: "Student chooses to skip."
G: "Student chooses to guess."
You would assign probabilities to each decision and the associated payoffs or penalties. The final probability of a correct answer can still be computed through the law of total probability, but it would also involve the expected cost or expected benefit analysis of guessing vs. skipping.
Possible Follow-up Question 5
How can we simulate this in Python for multiple questions to empirically verify the probability?
Answer:
We can write a simple simulation that iterates over many synthetic questions, where each question has probability p of being known. When known, the answer is always correct. When not known, we guess among 5 choices with probability 1/5 of being correct. Counting the fraction of correct answers in a large simulation should approximate 0.80. Here is a sample Python snippet:
import random
def simulate(num_questions=10_000_000, p_know=0.75, choices=5):
correct_count = 0
for _ in range(num_questions):
# Check if student knows the answer
if random.random() < p_know:
# If known, always correct
correct_count += 1
else:
# Guess
guess_correct = (random.randint(1, choices) == 1) # 1/choices chance
if guess_correct:
correct_count += 1
return correct_count / num_questions
estimated_probability = simulate()
print("Estimated Probability of Correct Answer:", estimated_probability)
Running this code (with enough large iterations) should yield a value close to 0.80 if p_know=0.75 and choices=5.
This simulation approach is helpful to confirm analytical results and also to handle more complicated scenarios where partial knowledge or other factors come into play.