Data Scientist Interview Questions with Strong Answers
28 Data Scientist interview questions on experiments, probability, metrics, SQL, Python, machine learning and stakeholders, with strong answers and follow-ups.
Updated
Data Scientist interview questions fall into six groups: past projects and behaviour, statistics and experiment design, metric and product cases, SQL and Python analysis, machine learning and modelling, and stakeholder communication. Interviewers care less about recited formulas than about whether you spot a broken test, choose a metric that cannot be gamed, and explain uncertainty to someone who has to make a call.
Our Data Scientist interview guide explains the loop and has seven starter questions; these 28 go further, with new scenarios, worked numbers, code and the likely follow-up.
How question types map to the data scientist interview loop#
A typical product analytics loop opens with a technical screen on SQL, product sense and often a probability or statistics question, then moves to final rounds that often cover analytical execution (hypotheses, metrics, quantitative reasoning), analytical reasoning (product sense and experiment design), technical skills (SQL) and behaviour. Companies name and order the rounds differently, so ask your recruiter for the exact format. Below, questions 1 to 5 suit the screen and behavioural rounds; 6 to 13 the experimentation round and the technical screen's probability question; 14 to 17 the metrics case; 18 to 21 the coding round, which is data manipulation rather than algorithms; 22 to 25 the modelling questions modelling-heavy teams add; and 26 to 28 the stakeholder round.
Behavioural data scientist interview questions#
1. Walk me through an analysis that changed a decision#
Why it's asked: it opens most screens and shows whether your work reaches decisions or ends in a slide. Strong answer: one project, told as question, data, method, number, decision. "Support tickets per order rose 12% after a checkout redesign. I split tickets by reason code, found two-thirds of the rise was failed address validation on one app version, and the team rolled back that validator within a week." Weak answer: a tour of tools with no decision at the end. Follow-up: "What would have happened if you had not done it?"
2. Tell me about a metric you reported with the wrong denominator#
Why it's asked: denominator errors are the commonest way a correct-looking number misleads. Strong answer: "I reported checkout conversion as orders over sessions. A release split long sessions in two, so sessions rose 9% and conversion appeared to fall 8% with orders unchanged. I re-based it on orders per active user, sent a correction to the same channel that day, and added a check that flags any denominator moving more than 5% week on week." Weak answer: a disguised strength ("I was too thorough"). Follow-up: "Did anyone act on the wrong number first?"
3. Describe a time you told a product manager their feature did not work#
Why it's asked: the role is paid to deliver unwelcome results honestly. Strong answer: gives the interval, separates "no effect" from "not enough evidence", and offers a next step. "The 95% interval on orders per user was -1.2% to +0.9%, so we can rule out a lift above 1%, the bar you set to justify the maintenance cost. I'd remove it and test the cheaper tooltip version." Weak answer: "I showed them the data and they agreed." Follow-up: "What if they had launched anyway?"
4. How do you decide which requests to say no to?#
Why it's asked: embedded data scientists receive more asks than they can serve. Strong answer: "I ask what decision the number feeds and by when. A pricing change worth about $2m a year gets a proper test. 'How many users clicked X' gets a self-serve dashboard link. Last quarter I declined a weekly bespoke deck for a sales lead and built a Looker view with the same four numbers, which saved me half a day a week." Weak answer: "I try to help everyone." Follow-up: "How did you tell the people you turned down?"
5. Tell me about a project where the data you needed did not exist#
Why it's asked: much product analysis starts with missing logging. Strong answer: names the proxy used meanwhile (support tickets mentioning the feature), the event spec written (name, user ID, timestamp, properties, when it fires), and how new events were validated against a known total, such as orders in the finance ledger. Weak answer: "We waited for engineering." Follow-up: "How did you check each event fired once per action, not twice?"
A/B testing and statistics interview questions#
6. Design an A/B test for a new checkout button#
Why it's asked: this is the core of the experimentation round. Strong answer: states the hypothesis, the unit of randomisation (user, not session, so a person sees one version), the primary metric (orders per exposed user), guardrails (refund rate, page load time, support contacts), the minimum detectable effect, the sample size and a run length in whole weeks. Weak answer: "Split traffic 50/50 and see which converts better." Follow-up: "Why per exposed user rather than per visitor?" (Users who never reach checkout add noise but cannot respond.)
7. Our conversion rate is 10%. How many users detect a 5% relative lift?#
Why it's asked: interviewers want to see you size a test on a whiteboard. Strong answer: uses the rule of thumb of about 16 times the variance over the squared difference, per arm, for 80% power at a two-sided 5% level. The absolute difference is 0.005 and the variance 0.1 × 0.9 = 0.09, so n ≈ 16 × 0.09 / 0.000025 = 57,600 per arm, then converts that into days from daily eligible traffic. Weak answer: a number with no method. Follow-up: "Traffic only supports 20,000 per arm in a month. What now?" (Accept a larger detectable effect: it scales with 1/√n, so at 20,000 per arm it is about 5% × √(57,600/20,000) ≈ 8.5% relative. Or use CUPED, a higher-traffic upstream metric such as checkout starts, or a one-sided test if only a lift would change the decision.)
8. The test hit p = 0.03 on day four. Can we stop?#
Why it's asked: peeking is the most common real-world mistake. Strong answer: stopping at the first significant reading inflates the false-positive rate well above 5%, and early effects are often novelty. If early stopping matters, agree a sequential design before launch: O'Brien-Fleming boundaries with a Lan-DeMets alpha-spending function, or an always-valid mSPRT of the kind Optimizely's Stats Engine uses. The cost is a somewhat larger maximum sample size. Weak answer: "We must never look at the data." Follow-up: "Why do O'Brien-Fleming boundaries make early stopping hard?" (They spend almost no alpha at early looks, so only very large effects stop a test early.)
9. Sample ratio mismatch appears only on iOS. How do you find the cause?#
Why it's asked: sample ratio checks signal real experience, and the diagnosis matters more than the test. Strong answer: confirms it with a chi-squared goodness-of-fit test per platform (Microsoft's Experimentation Platform team flags a mismatch at p below 0.0005), then follows the user path. If treatment adds a redirect, iOS users who drop during it never log exposure, so treatment silently loses its least-engaged users. Check where exposure is logged relative to the redirect, compare app versions within iOS, and check whether bot filtering or a consent prompt behaves differently there. Weak answer: "Drop iOS and analyse Android." Follow-up: "Can you reweight the groups and use the result?" (No: the missing users are not random, so reweighting cannot fix what you cannot see.)
10. What is CUPED and when would you use it?#
Why it's asked: variance reduction separates practitioners from textbook learners. Strong answer: CUPED, from Deng, Xu, Kohavi and Walker's 2013 WSDM paper, adjusts each user's outcome by their pre-period value of the same metric, removing variance unrelated to treatment. The paper reports roughly halving variance on Bing metrics, equivalent to half the users or half the duration. It helps most for metrics with strong week-to-week correlation, such as spend, and little for new users with no history. Weak answer: a name with no mechanism. Follow-up: "Why must the covariate be measured before the test?" (A covariate the treatment can move would absorb part of the effect.)
11. Design a switchback test for courier dispatch in a delivery marketplace#
Why it's asked: a user-level test is biased when treated orders take couriers from control orders, so interviewers want the alternative in detail. Strong answer: randomise zone-by-time-slot units, say one city zone in 30 or 60 minute windows, so every order in a slot shares a policy. Make the window longer than the carry-over (a courier assigned in one slot is still delivering in the next), drop the first minutes of each slot as a burn-in, analyse at unit level with errors clustered by zone, and balance slots across hours and weekdays. Weak answer: "Use a bigger user-level sample." Follow-up: "What does a switchback cost?" (Fewer independent units, wider intervals, and carry-over bias if windows are too short.)
12. You tested 20 metrics and two are significant. What do you report?#
Why it's asked: multiple comparisons trip up many readouts. Strong answer: at a 5% level you expect about one false positive in 20 metrics by chance. Decisions rest on the pre-registered primary metric; secondary metrics get a false discovery rate correction, or a stricter per-metric threshold of 0.05/20 = 0.0025 if any false positive is costly. Weak answer: reporting the two winners as findings. Follow-up: "And if the primary metric was flat?"
13. A fraud rule flags 90% of fraudsters and 5% of other users. Fraud is 1%. What share of flags are fraud?#
Why it's asked: a Bayes question appears in many technical screens, and most people guess 90%. Strong answer: P(fraud | flag) = 0.9 × 0.01 / (0.9 × 0.01 + 0.05 × 0.99) = 0.009 / 0.0585 ≈ 15%. The base rate dominates: per 10,000 users, 90 fraudsters are caught against 495 flagged legitimate users. Weak answer: "90%." Follow-up: "How would you raise precision?" (A second, independent check on flagged users only, or a stricter threshold that trades some recall.)
Product sense and metric case interview questions#
14. Weekly active users fell 8% last week. How do you investigate?#
Why it's asked: metric diagnosis is the most common case prompt. Strong answer: first rules out data issues (a logging change, a pipeline delay, a definition change), then asks whether the drop is sudden or gradual, then segments by platform, app version, country, new versus returning and acquisition channel. Weak answer: leaping to "the new release broke something". Follow-up: "It's all on Android 14. What next?"
15. How would you measure the success of a free-delivery subscription?#
Why it's asked: people who subscribe already spend more, so naive comparisons mislead. Strong answer: defines the goal as incremental profit rather than member spend, names the selection bias, and proposes a randomised offer, a staggered rollout with difference-in-differences, or matched pre-period comparisons. Guardrails include delivery cost per order and margin on small baskets. Weak answer: "Compare members' spend with non-members'." Follow-up: "Leadership will not withhold the offer from anyone. What now?"
16. Estimate orders a food-delivery app in one city handles on a Friday night#
Why it's asked: sizing questions test structured estimation and a sanity check. Strong answer: a city of 1 million adults, 15% order delivery at least monthly, averaging 2.5 orders a month, gives about 375,000 orders a month or roughly 87,000 a week (375,000 / 4.3). If Friday 5pm to 11pm takes about 18% of a week's orders, that is 87,000 × 0.18 ≈ 16,000 orders. Cross-check against courier supply: 16,000 orders over 6 hours at 2 orders per courier-hour needs about 1,300 couriers on the road. Weak answer: a single guess. Follow-up: "Which assumption would you check first with real data?"
17. Average order value rose but revenue fell. How?#
Why it's asked: mix problems catch people who read metrics in isolation. Strong answer: revenue equals orders times average order value, so orders fell faster than order value rose. A likely cause is small-basket customers leaving, perhaps after a minimum-order fee, which raises the average while cutting the total. Weak answer: "Probably a data error." Follow-up: "How would you confirm it?" (Compare order counts by basket-size band before and after the fee.)
SQL and Python interview questions for data scientists#
18. Write a query for 7-day retention by signup week#
Why it's asked: retention by cohort is the metric product teams track every week, and the query tests whether you set the cohort at user grain before joining events. Strong answer: defines retention precisely (any order after day 0 and within 7 days of signup) and builds the cohort first:
with cohort as (
select user_id, signup_at, date_trunc('week', signup_at) as signup_week
from users
),
retained as (
select distinct c.user_id
from cohort c
join orders o
on o.user_id = c.user_id
and o.created_at > c.signup_at + interval '1 day'
and o.created_at <= c.signup_at + interval '7 day'
)
select c.signup_week,
count(*) as users,
count(r.user_id) as retained,
round(count(r.user_id)::numeric / count(*), 3) as retention_7d
from cohort c
left join retained r on r.user_id = c.user_id
group by c.signup_week
order by c.signup_week;Weak answer: joining users to orders and counting rows, which counts orders, not people. Follow-up: "The latest cohort hasn't had seven days yet?" (Exclude it or mark it incomplete.)
19. Find each user's second order and the days since their first#
Why it's asked: window functions are tested in almost every SQL round. Strong answer: numbers orders with a tie-breaker and uses LAG for the gap:
with ranked as (
select user_id, order_id, created_at,
row_number() over (partition by user_id order by created_at, order_id) as rn,
lag(created_at) over (partition by user_id order by created_at, order_id) as prev_at
from orders
)
select user_id, order_id, created_at - prev_at as gap
from ranked where rn = 2;Weak answer: a self-join with MIN that breaks on ties. Follow-up: "Two orders share a timestamp. Which is first?" (Whatever your tie-breaker says; state it.)
20. In Python, compute conversion per arm from raw events, without pandas#
Why it's asked: this is the live coding round, and plain Python shows whether you understand the logic a library hides. Strong answer: states the rules first (a user counts from first exposure, only later orders count, users seen in both arms are excluded and reported), then codes it:
from math import sqrt
from statistics import NormalDist
first, conflict, converted = {}, set(), set()
for user, arm, ts in sorted(exposures, key=lambda e: e[2]):
if user not in first:
first[user] = (arm, ts)
elif first[user][0] != arm:
conflict.add(user)
for user, ts in orders:
if user in first and user not in conflict and ts >= first[user][1]:
converted.add(user)
n, x = {"A": 0, "B": 0}, {"A": 0, "B": 0}
for user, (arm, _) in first.items():
if user not in conflict:
n[arm] += 1
x[arm] += user in converted
p1, p2 = x["A"] / n["A"], x["B"] / n["B"]
p = (x["A"] + x["B"]) / (n["A"] + n["B"])
z = (p2 - p1) / sqrt(p * (1 - p) * (1 / n["A"] + 1 / n["B"]))
p_value = 2 * (1 - NormalDist().cdf(abs(z)))Weak answer: counting orders placed before exposure, or nested loops over every event for every user. Follow-up: "Could excluding users bias the result?" (Report len(conflict); if one arm causes more re-bucketing, exclusion is not neutral.)
21. This query returns more revenue than finance reports. Find the bug#
Why it's asked: a code-review prompt tests grain awareness. Strong answer: checks each table's grain before reading the logic. The usual culprit is joining orders to order items or promotions and then summing an order-level amount, which repeats it once per item. Aggregate items first or sum at the right grain, then reconcile one day by hand. Weak answer: rewriting the query without naming the cause. Follow-up: "Finance excludes refunds and tax. How would you align definitions?"
Machine learning and modelling interview questions for data scientists#
22. Your churn model has 0.92 AUC but the retention team says it's useless. Why?#
Why it's asked: it tests whether you judge a model by the action it drives. Strong answer: AUC ranks all pairs, but the team can contact only, say, the top 5% each month, so precision in that slice matters, along with how many of those users would have stayed anyway. Check lift in the top decile, calibration (does a 0.3 score mean 30%?), and whether top scores are users already cancelling, who cannot be saved. Weak answer: "Tune the threshold." Follow-up: "How would you prove it adds value?" (A randomised holdout of high-score users who get no outreach.)
23. How would you spot target leakage?#
Why it's asked: leakage is the commonest reason an offline model collapses in production. Strong answer: look for features recorded after prediction time, such as a non-null cancellation_reason in a churn model, or one feature with suspiciously high importance. Rebuild features as of a cut-off date, split by time rather than at random, and treat validation scores far above any baseline as a warning. Weak answer: "Use cross-validation." Follow-up: "Can a random split leak?" (Yes, when the same user appears in both folds.)
24. 1% of transactions are fraud. How do you train and evaluate?#
Why it's asked: imbalance breaks default metrics. Strong answer: accuracy is useless (always predicting "not fraud" scores 99%), so report PR-AUC and recall at a fixed precision. Use class weights or downsample the majority class, then recalibrate probabilities. Set the threshold by review-queue capacity: if analysts can review 500 cases a day, pick the score that yields 500. Weak answer: "Oversample and report accuracy." Follow-up: "Fraudsters adapt. How do you monitor the model?"
25. L1 versus L2 regularisation, and when would you pick each?#
Why it's asked: a staple that tests understanding over vocabulary. Strong answer: L1 (lasso) penalises absolute coefficients and drives some to exactly zero, giving a sparse model useful for feature selection. L2 (ridge) penalises squared coefficients, shrinking all smoothly, and is more stable with correlated features, where lasso tends to pick one arbitrarily. Elastic net mixes both; all need features on a common scale. Weak answer: "L1 is for small data." Follow-up: "How do you choose the penalty strength?" (Cross-validation, time-based if the data is temporal.)
Stakeholder communication questions#
26. Write the first three lines of an experiment readout for an executive#
Why it's asked: senior people read the top and stop. Strong answer: decision, effect, confidence. "Recommend launch. The new onboarding raised 30-day orders per user by 2.1% (95% interval 0.8% to 3.4%). Refund rate and support contacts were unchanged." Weak answer: opening with the set-up and the p-value. Follow-up: "The interval crosses zero. Rewrite the first line."
27. Marketing wants a model to predict who will churn. What do you ask first?#
Why it's asked: scoping stops data scientists building models nobody uses. Strong answer: asks what action follows a high score (a discount, an email, a call), what it costs, and whether it changes behaviour, since predicting churn is not preventing it. Often the better first step is an uplift test of the intervention itself. Weak answer: starting with features and algorithms. Follow-up: "How would you evaluate it once live?"
28. An engineering lead says your test is too slow and they will ship without it#
Why it's asked: it tests whether you can protect a decision's quality under a fixed deadline rather than blocking it. Strong answer: accepts the deadline and offers options: ship to 90% with a 10% holdout to measure impact after launch, use CUPED to shorten the run, or test on one high-traffic platform first. Weak answer: "Then the result won't be valid." Follow-up: "Which would you choose and why?"
What interviewers listen for in every answer#
Strong candidates define who counts and at what grain before calculating, check the test (sample ratio, exposure logging, guardrails) before the result, give effects in business units ("about 1,400 extra orders a week"), and name the confounder whenever self-selected groups are compared. The standard reference is "Trustworthy Online Controlled Experiments" by Ron Kohavi, Diane Tang and Ya Xu (2020), whose chapter on trust-related guardrail metrics covers sample ratio mismatch.
For a schedule that works through these questions, see the Data Scientist interview prep plan. For pay, outlook and which flavour of data science a role really is, read things to know before applying for a data scientist job. Then say five answers aloud and practise a timed 30, 45 or 60 minute mock Data Scientist interview with experiment design, a metric case and live Python coding.
Frequently asked questions#
What are the most common data scientist interview questions?#
The most common are designing an A/B test, sizing a sample, diagnosing a drop in a key metric, a cohort retention or window-function SQL query, and a past-project walkthrough. Product roles add questions on success and guardrail metrics and on explaining results to non-specialists. Modelling-heavy roles add evaluation, leakage, class imbalance and regularisation questions.
How do I answer A/B testing interview questions well?#
Start with the hypothesis and the unit of randomisation, then name the primary metric, guardrails, minimum detectable effect, sample size and run length in whole weeks. Before reading any result, say you would check the sample ratio and exposure logging. Interviewers reward candidates who mention peeking, novelty effects and interference without being prompted, and who report effects with an interval.
What SQL is tested in data scientist interviews?#
Expect joins, aggregation with GROUP BY and HAVING, CASE expressions, date truncation and window functions such as ROW_NUMBER, LAG and running sums. Typical tasks are cohort retention, funnels, second orders and deduplication. The common failure is not syntax but grain, such as joining to a child table and then summing a parent-level amount, which inflates totals.
Do product data scientist interviews ask machine learning questions?#
Sometimes, but less than many candidates expect. Product analytics loops focus on experiments, causal inference, metrics and SQL. When modelling comes up it is usually about scoping and evaluation: what action a prediction drives, how you would measure its effect, and how you handle class imbalance. Roles titled applied scientist or machine learning engineer test modelling far more deeply.
How many questions should I prepare for a data scientist interview?#
Prepare two or three past-project stories that can answer most behavioural prompts, and rehearse around 20 technical questions spread across experiment design, metric cases, SQL and Python. Depth beats volume. Being able to handle two follow-ups on a sample size question is worth more than memorising fifty answers you cannot defend under questioning.