AnyLearn
All interview prep
DataMid-levelData Scientist

Data Scientist Interview Prep: Questions and a Mock Test

Data science interviews are unusually varied between companies, because the title covers at least three different jobs. What is consistent is where candidates fail: not on modelling, but on inference. Asked whether a result is real, whether a difference is caused by the change, or what a number would have to be to justify a decision, a lot of otherwise strong people reach for a test they half remember. This page covers the areas the loop actually tests and ends with a graded mock across six of them.

The loop

How the process is structured

The interview loop: each round, how long it runs, and what it tests
RoundLengthWhat it tests
1.SQL and data manipulation[2]Not publishedLive querying against a small schema. Joins that fan out, NULL semantics, window functions for ranking and running totals, and cohort or funnel style aggregations. Marked on correctness rather than elegance.
2.Statistics and experimentation[1]Not publishedDesigning an A/B test end to end, power and minimum detectable effect, interpreting a p-value and a confidence interval correctly, and recognising peeking and multiple comparisons. The literature on trustworthy online experiments, including the KDD 2022 paper on common misunderstandings, is the reference body here.
3.Modelling and validation[2]Not publishedChoosing an approach and defending the evaluation. Cross-validation, leakage, and picking a splitter that matches the data's structure, since group and time series data break the independence assumption that plain k-fold relies on.
4.Product sense and case study[3]Not publishedAn open business question: define success for a feature, or explain why a metric moved. Assessed on structure, on whether you clarify the metric before diagnosing it, and on whether you connect the analysis to a decision someone will actually take.

Bracketed markers point to the dated sources at the end of this article. Loops change; check the retrieval dates before relying on a round count.

Experiments: the design is most of the answer

Nearly every data science loop contains an experimentation round, and the good answers spend most of their time before the test runs rather than after.

The first thing to establish is the metric. Being able to distinguish the primary metric the decision rests on, guardrail metrics that must not degrade, and secondary metrics that provide explanation, is the structure interviewers listen for. A single overall evaluation criterion, agreed in advance, is what stops the analysis becoming a search for something that moved.

The second is the power calculation. You need the baseline rate, the smallest effect that would actually change the decision, and the significance and power you are willing to accept, and from those the sample size and therefore the runtime. Candidates who cannot say what effect size they would care about have skipped the only part of this that requires judgement, since the minimum detectable effect is a business question rather than a statistical one.

The third is randomisation unit. Randomising by request when the user sees several requests breaks independence and understates variance. Randomising by user when the effect spills between users, as in a marketplace or a social graph, produces interference that no amount of statistical care fixes; cluster or geographic randomisation is the usual response.

Running a full week to cover the weekday cycle, and refusing to stop the moment the result crosses significance, are both expected.

What a p-value does not say

This is the single most reliable place to distinguish candidates, because the wrong interpretations are so widespread that they sound normal.

A p-value is the probability of observing data at least as extreme as yours, assuming the null hypothesis is true. It is not the probability that the null hypothesis is true. It is not the probability that your result is a fluke, and one minus the p-value is not the probability that the effect is real. A p-value of 0.04 does not mean there is a 96 percent chance the treatment works.

The practical consequences come up as scenarios. Peeking, that is, checking significance repeatedly and stopping when it crosses the threshold, inflates the false positive rate substantially, because you have given yourself many chances to cross a line that random walks cross. The answers are fixing the sample size in advance, or using a method designed for continuous monitoring such as sequential testing with alpha spending.

Multiple comparisons work the same way across metrics rather than across time: at twenty metrics and a threshold of 0.05, one significant result is the expected outcome under the null. Corrections exist, but the more useful interview answer is to nominate the primary metric before looking.

And a non-significant result is not evidence of no effect. Absence of evidence at your sample size usually means the confidence interval is wide, which is why reporting the interval rather than the verdict is the better habit.

Causal questions on observational data

Not everything can be randomised, and interviewers know it. Expect at least one question where an experiment is impossible and the data is what it is.

The first move is naming the confounder: something that affects both the treatment and the outcome and therefore manufactures an association between them. Users who opt into a feature differ from those who do not in ways that also drive retention, so comparing them measures the difference between those kinds of people rather than the effect of the feature.

The standard toolkit is worth being able to sketch. Difference-in-differences compares the change over time in a treated group with the change in an untreated one, and its credibility rests entirely on parallel trends before the intervention, which you should say you would check. Regression discontinuity exploits a threshold rule so that units just either side are comparable. Instrumental variables need something that moves treatment without affecting the outcome any other way, which is a strong assumption and rarely available. Propensity matching balances observed covariates and, crucially, does nothing about unobserved ones.

The answer that scores best is usually the one that ends with a caveat: what the estimate assumes, and what would have to be true for it to be wrong. Simpson's paradox is a good thing to be able to describe concretely, because it shows in one example how an aggregate can reverse within every subgroup.

Validation that does not lie to you

Modelling rounds test whether your evaluation would survive contact with reality. scikit-learn's documentation states the core problem plainly: "Learning the parameters of a prediction function and testing it on the same data is a methodological mistake: a model that would just repeat the labels of the samples that it has just seen would have a perfect score but would fail to predict anything useful on yet-unseen data."

The subtler failure is tuning on the test set. As the same documentation puts it, when evaluating hyperparameters "there is still a risk of overfitting on the test set because the parameters can be tweaked until the estimator performs optimally. This way, knowledge about the test set can leak into the model and evaluation metrics no longer report on generalization performance." The structural answer is three splits, or cross-validation for selection with a final untouched holdout for reporting.

Which splitter you use is itself an examinable judgement. Stratified variants preserve class frequencies across folds, which matters when a class is rare. Group-based splitters exist because the independence assumption breaks when samples come in clusters: the requirement is to "ensure that all the samples in the validation fold come from groups that are not represented at all in the paired training fold", so one user's rows cannot appear on both sides.

Time series is the case people get wrong most often. Because of autocorrelation, standard k-fold trains on the future to predict the past. A forward-chaining split, where "successive training sets are supersets of those that come before them", is the honest alternative.

Metrics, and the product judgement round

Most loops include a round that is nominally about analysis and is really about judgement: a metric moved, what do you do.

The expected structure is to clarify before diagnosing. What exactly is the metric, over what population, and is the change larger than its normal variation. A surprising number of alarming movements are logging changes, a bot, a release that altered how an event fires, or a definitional change nobody announced. Checking whether the change is real precedes explaining it.

Then decompose. A rate is a ratio, so it moves when the numerator moves, when the denominator moves, or when the mix underneath changes while every segment stays flat. That last case is Simpson's paradox in operational clothing and is worth naming explicitly.

The metric definition question is the other staple: define success for a described feature. Strong answers distinguish leading from lagging indicators, propose a guardrail so the metric cannot be gamed by harming something else, and say how the metric could be moved in a way nobody wants. Google's Rules of Machine Learning makes the general version of the point in its opening advice, that infrastructure and measurement come before sophistication, and that a first version does not have to be clever to be useful.

The distinguishing habit is stating what decision the number will inform. A metric that no decision depends on is a report, not a measurement.

Open-ended

What they actually ask

  1. 1.Daily active users dropped 8 percent yesterday. You have one hour before a leadership meeting. What do you do?

    What a strong answer covers

    The strongest answers verify before explaining. Is the drop real or an artefact: a logging or SDK change, a tracking outage, a bot filter that started or stopped working, a definitional change. Is it outside normal variation, checked against the same weekday historically rather than against yesterday. Then decomposition along the dimensions most likely to isolate it: platform, app version, geography, new versus returning, acquisition channel. A drop concentrated in one platform and one app version is a release; a drop spread evenly everywhere is more likely a measurement or an external event. Good candidates say explicitly what they would report if the hour runs out, which is the honest scope of what is known rather than a guess dressed as a finding.

  2. 2.Design an A/B test for a new checkout flow.

    What a strong answer covers

    Expected: a primary metric tied to the decision, usually completed purchases per visitor rather than conversion rate on the checkout page alone, since the latter can be improved by driving away uncertain users earlier. Guardrails such as revenue per visitor, refund rate and latency. Randomisation at the user level, persisted across sessions and devices as far as identity allows. A power calculation from baseline rate and minimum detectable effect, giving a sample size and therefore a runtime, run in whole weeks. Then the analysis plan agreed in advance: no peeking, or an explicitly sequential method. Strong candidates also mention an A/A check or sample ratio mismatch test, because an imbalance in assignment counts invalidates everything downstream and is common.

  3. 3.Users who use our messaging feature retain 40 percent better. Should we push everyone toward messaging?

    What a strong answer covers

    The answer must identify selection: people who message are already more engaged, so the comparison measures the kind of user rather than the effect of the feature. Strong candidates propose the experiment that would settle it, randomising exposure to a prompt or the feature itself, and note that the estimate from such a test is the effect on those induced to use it rather than on everyone. Where an experiment is impossible, they reach for matched comparison on pre-period behaviour, difference-in-differences around a launch, and explicitly state what remains unaddressed, namely unobserved confounders. The best answers also question the decision: even a genuine effect does not mean pushing every user toward the feature is net positive once annoyance and guardrails are considered.

  4. 4.Your experiment shows a 2 percent lift with p = 0.06. The product manager wants to ship. What do you say?

    What a strong answer covers

    The weak answers treat 0.05 as a law. The strong ones reframe: the threshold is a convention, and the useful output is the confidence interval and the decision's cost structure. If the interval spans from slightly negative to strongly positive, the honest statement is that the data are compatible with a small harm and with a meaningful gain. Then ask what shipping costs: an easily reversible UI change with no downside risk is a different decision from an irreversible one. Options include extending the test if power was the limitation, but only if that was planned rather than a response to the result, since extending until significance is peeking. Candidates who mention that a non-significant result is not evidence of no effect are demonstrating the right instinct.

  5. 5.How would you define success for a newly launched notification feature?

    What a strong answer covers

    Expected structure: what decision the metric informs, then a primary metric, then guardrails. Good candidates avoid measuring the feature's own usage, since notification opens can be raised by sending more notifications, which is exactly the behaviour nobody wants. They propose an outcome further downstream, such as retained sessions attributable to the notification, and pair it with guardrails: opt-out rate, uninstall rate, and complaints. They distinguish leading indicators available in days from lagging ones like retention that take weeks, and they explicitly name how the metric could be gamed. Mentioning novelty effects, where engagement spikes then decays, and that this argues for a longer measurement window, is a strong signal.

  6. 6.You are given a dataset of loan applications and asked to predict default. Walk me through your approach.

    What a strong answer covers

    Expected coverage: clarify the decision and its costs first, since the relative price of a false positive and a false negative determines the metric and the threshold. Then temporal structure, because loans mature over time and a random split leaks the future; a time-based split is required. Then label definition, what counts as default and over what horizon, and the censoring problem for recent loans that have not had time to default. Then leakage hunting, particularly features recorded after the decision such as collections activity. Evaluation should use precision-recall rather than accuracy given imbalance, with calibration if the score feeds an expected-loss calculation. Strong candidates raise fairness and regulatory constraints unprompted, including that removing a protected attribute does not remove proxies for it.

Worked examples

Three sample questions, answered

These three show the level the mock is pitched at, with the answer and the reasoning in the open. The graded paper keeps its answer key server-side.

1.An A/B test returns p = 0.03. Which interpretation is correct?
Inference, p-values and intervals
  • If the null hypothesis were true, data at least this extreme would occur 3 percent of the time
  • There is a 3 percent probability that the null hypothesis is true
  • There is a 97 percent probability that the treatment works
  • The treatment effect is 3 percent smaller than measured

Why: A p-value is computed under the assumption that the null is true; it is the probability of the observed data or more extreme, given that assumption. It is not a probability attached to the hypothesis itself. Reversing the conditioning is the most common statistical error in interviews and in published analysis alike.

2.Why does checking an experiment's significance daily and stopping when p first drops below 0.05 inflate false positives?
Experiment design and A/B testing
  • Because daily aggregation reduces the effective sample size
  • Because the variance estimate becomes biased with repeated computation
  • Because you take many chances to cross a threshold that random fluctuation will eventually cross
  • Because early users differ systematically from later ones

Why: The 5 percent error rate applies to a single test at a predetermined sample size. Testing repeatedly gives the statistic many opportunities to wander across the boundary, so the realised false positive rate is far above nominal. Fixing the sample size in advance, or using a sequential method with an explicit spending function, is the fix.

3.You have one row per patient visit, several visits per patient. Which cross-validation splitter is appropriate?
Validation and model selection
  • Standard k-fold, because rows are the unit of analysis
  • Stratified k-fold, to preserve outcome frequencies
  • A shuffle split with a large test fraction
  • A group-based split, so no patient appears in both training and validation

Why: Rows from the same patient are not independent, so a random split lets the model memorise patient-specific patterns and be tested on the same patients. The documented requirement is to "ensure that all the samples in the validation fold come from groups that are not represented at all in the paired training fold". Stratification addresses class balance, a different problem.

The mock

An 18-question knowledge check

This is a knowledge check, not a simulation. The real loop happens on a whiteboard, in an editor, and in conversation. What this paper does measure is the underlying knowledge those rounds draw on: each question is tagged with a topic, grading happens per topic, and a weak topic points you at the course that fixes it.

Your paper0 / 18 answered
  1. 1.What does a 95 percent confidence interval actually describe?
    Inference, p-values and intervals
  2. 2.You test 20 metrics at a 0.05 threshold and one is significant. What is the most reasonable conclusion?
    Inference, p-values and intervals
  3. 3.An experiment finds no significant difference. What follows?
    Inference, p-values and intervals
  4. 4.In an A/B test the control group received 51.4 percent of traffic instead of the intended 50 percent. What should you do?
    Experiment design and A/B testing
  5. 5.You are testing a change in a two-sided marketplace where buyers and sellers interact. What is the main threat to randomising by user?
    Experiment design and A/B testing
  6. 6.Why run an A/A test?
    Experiment design and A/B testing
  7. 7.A confounder is best described as a variable that
    Causal inference from observational data
  8. 8.What assumption does difference-in-differences rest on most critically?
    Causal inference from observational data
  9. 9.A treatment appears beneficial in every hospital, but harmful when all hospitals are pooled. What is this?
    Causal inference from observational data
  10. 10.What does propensity score matching correct for, and what does it leave untouched?
    Causal inference from observational data
  11. 11.Why does tuning hyperparameters against the test set undermine the reported score?
    Validation and model selection
  12. 12.For time series data, why is standard k-fold cross-validation inappropriate?
    Validation and model selection
  13. 13.Why does stratified k-fold exist?
    Validation and model selection
  14. 14.A team reports that checkout conversion rate rose while total purchases fell. Which explanation is most consistent?
    Metric definition and measurement traps
  15. 15.What makes a good guardrail metric?
    Metric definition and measurement traps
  16. 16.Engagement spikes for two weeks after a feature launches, then returns to baseline. What is the likely explanation?
    Metric definition and measurement traps
  17. 17.You need the most recent order per customer from an orders table. Which approach is correct?
    SQL for analysis
  18. 18.Counting distinct users per day from an events table, your numbers are higher than the product team's. What is the most likely cause?
    SQL for analysis
18 questions left to answer.
Apparatus

Sources

Hiring loops change. Every claim above carries a retrieval date so you can judge how current it is.

  1. [1]Kohavi, Tang and Xu, Trustworthy Online Controlled Experiments, and the experimentation paper archive · retrieved 2026-08-13
  2. [2]scikit-learn, Cross-validation: evaluating estimator performance · retrieved 2026-08-13
  3. [3]Google, Rules of Machine Learning: Best Practices for ML Engineering · retrieved 2026-08-13
Keep preparing

Refresh your memory

Free learning paths covering the ground this loop tests, whatever your score. Each one ends with a shareable certificate.