Maths for ML interview question · Probability: Bayes' theorem · mid level
A disease affects 1% of people. A test catches 90% of sick people (sensitivity) and wrongly flags 9% of healthy people (false positive rate). You test positive. What is the chance you are sick?
Free to read in full. This is 1 of the 120 questions in the Maths for ML and Deep Learning interview pack, with 147 diagrams. Get the pack, ₹999 · $20
Why it is asked
It is the most asked Bayes question. The interviewer checks whether you anchor on the 90% or work through the 1% prior.

The answer
About 9.2%, not 90%. Most positives come from the huge healthy group, so a positive result is still more likely a false alarm than a real case.
Terms: sensitivity = P(test positive | sick). False positive rate = P(test positive | healthy). Specificity = P(test negative | healthy) = 1 - false positive rate = 0.91. Prevalence = P(sick) before any test, which is the prior.
The clearest way is natural frequencies. Imagine 10,000 people:
- Sick: 1% of 10,000 = 100 people. The test catches 90% of them: 90 true positives (10 are missed).
- Healthy: 9,900 people. 9% of them test positive anyway: 891 false positives.
- Total positives: 90 + 891 = 981.
- P(sick | positive) = 90 / 981 ≈ 0.0917, about 9.2%.
The same with Bayes' theorem: P(sick | +) = P(+ | sick) × P(sick) / P(+) = (0.90 × 0.01) / (0.90 × 0.01 + 0.09 × 0.99) = 0.009 / 0.0981 ≈ 0.0917.
The test still did its job. Belief rose from 1% to 9.2%, about 9 times higher. It is a screening result that calls for a better second test, not a diagnosis.
A negative result is very reassuring: P(sick | negative) = 10 / (10 + 9,009) = 10 / 9,019 ≈ 0.0011, about 0.11%.
The same pattern appears in fraud models, content moderation and any alert on a rare event: when the condition is rare, even a good test produces mostly false alarms.
What the interviewer listens for
- Use the prior: 1% prevalence.
- 10,000 people: 90 true positives vs 891 false positives.
- P(sick | +) = 90 / 981 ≈ 0.0917.
- A negative is very reassuring: ≈ 0.0011.
Follow-ups the interviewer may ask
- What if prevalence were 10%? Hint: 0.09 / (0.09 + 0.081) ≈ 0.5263.
- Which number should improve to raise the posterior most? Hint: the false positive rate, because the healthy group is 99 times larger.
- What is the specificity here? Hint: 1 - 0.09 = 0.91.
Common mistakes
- Answering 90% (confusing P(+ | sick) with P(sick | +)).
- Answering 91% from the specificity.
Written by Roni Das, who builds distributed systems and AI systems for a living.
One question is not enough for the interview.
This is 1 of the 120 questions in the Maths for ML and Deep Learning pack
Each question has why it is asked, a full answer, what the interviewer listens for, the follow-ups, the common mistakes and a diagram (147 diagrams in all). A PDF you keep, junior to staff level.
India: UPI, cards or netbanking through Razorpay. Elsewhere: PayPal. Download at once from My packs.
More free questions from this pack
- Compute the cosine similarity of a = (3, 4) and b = (4, 3) by hand. What does the result mean? (junior)
- A batch of 32 MNIST images goes into a dense layer with 128 units. What are the shapes, and what is the rule for when two matrices can be multiplied? (mid)
- Why do we not use mean squared error for classification with a sigmoid output? Compare the gradients numerically. (staff)
- Compute scaled dot-product attention by hand for two tokens with d_k = 2. (senior)
Free questions from the other packs
- What do temperature and top-p control, and what values would you use for data extraction versus brainstorming? (AI Engineering)
- What is hybrid search, and how do you merge keyword and vector results with Reciprocal Rank Fusion? (AI Engineering)
- Users ask "list all X" questions and RAG returns only five items. Why, and what do you do? (AI Engineering)
- How do you check that an LLM judge agrees with human reviewers? (AI Engineering)
- Cut the cost of an LLM feature serving 10 million requests a day by 60% without hurting quality. Walk through your plan. (AI Engineering)
- Why are LLMs bad at counting letters or reversing a word? (GenAI and LLM)
- Write out scaled dot-product attention with the shape of every tensor. (GenAI and LLM)
- How does speculative sampling keep exactly the target model's distribution? (GenAI and LLM)
- What is GRPO, and how do verifiable rewards train reasoning models? (GenAI and LLM)
- Design a system that answers questions from 300-page contracts accurately. (GenAI and LLM)
- What happens, step by step, when an LLM server handles one request? (Inference Engineering)
- Derive the KV cache size formula and work it out for Llama 3 70B. (Inference Engineering)
- What is PagedAttention? (Inference Engineering)
- When does speculative decoding stop helping or make things worse? (Inference Engineering)
- Design a service to serve Llama 3 70B at 10 QPS with latency targets. (Inference Engineering)
- A customer says: "We want AI for our support team." What do you do in the first meeting? (Forward Deployed Engineer)
- The customer's admin offers you a global admin account "to save time". What do you ask for instead, and why? (Forward Deployed Engineer)
- Your connector writes tickets into the customer's system. A request timed out, the connector retried, and now there are duplicate tickets. How do you make the writes safe to retry? (Forward Deployed Engineer)
- The customer wants RAG over 10 million documents, all behind their firewall. Size it for me on the whiteboard. (Forward Deployed Engineer)
- One deployment of your AI platform must serve 50 business units of the same enterprise. How do you design multi-tenancy? (Forward Deployed Engineer)
