Data Scientist interview questions
100 real questions with model answers and explanations for Junior candidates.
See a Data Scientist resume example →Practice with flashcards
Spaced repetition · Hunter Pass
Questions
Mean, median, and mode describe a dataset's center in different ways.
- Mean is the arithmetic average and works best for roughly symmetric data.
- Median is the middle sorted value and is robust to outliers and skew in data such as incomes or session durations.
- Mode is the most frequent value and suits categorical data such as device type.
- Reporting mean and median together helps reveal skew because a large gap warns that either number alone may mislead.
Why interviewers ask this: Use cases per measure plus the mean-median gap as a diagnostic show working statistical instinct.
Variance and standard deviation both measure how widely values spread around the mean.
- Variance is the average squared deviation from the mean.
- Standard deviation is the square root of variance and uses the original units, such as dollars rather than squared dollars.
- Products with equal average sales but different standard deviations require different planning because the more volatile one needs more safety stock and careful forecasting.
Why interviewers ask this: The same-units point and a business consequence turn definitions into understanding.
Percentiles and the interquartile range describe position and spread without relying on a single average.
- The p-th percentile is the value below which p percent of observations fall, so a two-second 95th percentile latency means 95 percent of requests are faster.
- Quartiles are the 25th, 50th, and 75th percentiles.
- The interquartile range is the distance from the 25th to the 75th percentile and measures spread while ignoring extreme tails.
- Percentiles show what specific groups of users experience more clearly than an overall average.
Why interviewers ask this: Connecting percentiles to user experience rather than formulas is the applied view interviewers want.
A distribution is skewed when one tail is much longer than the other.
- Right skew is common in money and duration data.
- The long tail pulls the mean toward itself while the median remains more stable, so the mean may sit far above a typical observation under heavy right skew.
- Check the shape with a histogram before choosing a summary statistic or using the raw variable in a model that assumes symmetry.
Why interviewers ask this: Look-at-the-shape-first is the habit this question verifies beyond the definition.
The normal distribution is a symmetric bell-shaped distribution centered on its mean.
- About 68 percent of values lie within one standard deviation of the mean and about 95 percent lie within two.
- It appears often because sums and averages of many small independent effects tend toward normality under the central limit theorem.
- Measurement errors are a standard example of this pattern.
- Business metrics such as revenue and delays are often heavily skewed, so normality must be checked rather than assumed.
Why interviewers ask this: The check-not-assume caveat separates practitioners from textbook reciters.
The central limit theorem says that sample means tend toward a normal distribution as the sample grows, regardless of the source distribution's shape.
- This behavior lets us build confidence intervals and tests for averages even when the original data is skewed.
- The approximation becomes useful only with enough observations.
- Small samples and heavy-tailed data can make it unreliable, so the theorem has conditions rather than being automatic.
Why interviewers ask this: Stating what CLT licenses in practice, inference on means, is the understanding being probed.
A population is the full group of interest, while a sample is the subset actually observed.
- A good sample is representative, meaning every relevant part of the population has a fair chance of inclusion.
- Randomization helps provide that fair chance.
- Larger samples improve precision, but representativeness matters more because a biased sample of a million can answer the wrong question very precisely.
Why interviewers ask this: Representativeness-over-size is the core insight, and the biased-million example proves it landed.
Sampling bias appears when observed data systematically excludes relevant parts of the population.
- Opt-in bias occurs when survey data includes only users who chose to respond.
- Survivorship bias occurs when a churn model sees only customers who stayed long enough to build a history and misses fast leavers.
- Generalizing weekday observations to weekends mixes different populations.
- Biased data can look perfectly clean, so ask how the data came to exist and who is missing before analyzing it.
Why interviewers ask this: The who-is-missing framing and data-origin questioning show mature skepticism about data.
Correlation shows that two variables move together, while causation means changing one actually changes the other.
- Ice cream sales correlate with drownings because summer affects both.
- Feature users may retain better because engaged users both use more features and stay longer, not because the feature causes retention.
- Observational data supports correlational claims, while causal claims need experiments such as A/B tests or careful causal methods.
- Confusing correlation with causation can lead to expensive wrong decisions.
Why interviewers ask this: The hidden-common-cause mechanism and the experiment requirement are the two parts that must both appear.
Pearson's correlation coefficient measures the direction and strength of a linear relationship from minus one to one.
- The sign gives the direction, the magnitude gives the strength, and zero means no linear relationship.
- It misses nonlinear patterns, so even a perfect U-shaped relationship can have a value near zero.
- It is sensitive to outliers because one extreme point can create or destroy an apparent correlation.
- Always inspect a scatter plot because identical coefficients can hide very different relationships.
Why interviewers ask this: Naming nonlinearity and outlier fragility, with the plot as the antidote, completes the answer.
Simpson's paradox occurs when a trend seen in every subgroup reverses after the groups are combined.
- Different group sizes act as hidden weights in the aggregate result.
- For example, every department may admit women at a higher rate while the overall rate appears lower because women applied more often to competitive departments.
- Check important conclusions across meaningful segments before trusting an aggregate because changes in group composition can mislead dashboards.
Why interviewers ask this: Recognizing aggregation as a source of reversed conclusions is a core analytical defense being tested.
Independent events do not change each other's probabilities, while conditional probability accounts for known information.
- For independent events, the joint probability equals the product of their individual probabilities.
- Conditional probability P(A given B) is the probability of A once B is known to have happened.
- Dependence means P(A given B) differs from P(A).
- Data science often asks conditional questions, such as churn probability given that a user stopped opening the app.
Why interviewers ask this: Recasting business questions as conditional probabilities shows the concept is operational, not formal.
Bayes' theorem updates a prior belief with new evidence while accounting for how common the target condition is.
- The probability of a disease after a positive test depends on both test accuracy and disease prevalence.
- A 99 percent accurate test for a disease affecting one person in a thousand produces roughly ten false alarms for each true case because the healthy group is so large.
- Fraud detection and spam filtering follow the same logic, so rare targets can make even good classifiers generate many false positives.
Why interviewers ask this: The base-rate calculation applied to fraud or spam shows genuine grasp, not formula recall.
A p-value measures how surprising the observed result would be if the null hypothesis were true.
- Formally, it is the probability of data at least as extreme as observed under the null hypothesis.
- It is neither the probability that the null hypothesis is true nor the probability that the finding matters.
- A tiny p-value can accompany a microscopic effect that is statistically significant but practically useless.
- Report effect size alongside the p-value to show practical importance.
Why interviewers ask this: Both the correct definition and the two classic misreadings must appear for a passing answer.
A hypothesis test compares observed data with what the null hypothesis predicts under a threshold chosen in advance.
- Define a null hypothesis, usually no effect or difference, an alternative hypothesis, and a significance level such as 0.05 before viewing results.
- Calculate the p-value and reject the null in favor of the alternative when it falls below the threshold.
- A 0.05 threshold permits about one false alarm in twenty tests on pure noise.
- Running many tests without correction therefore creates false discoveries.
Why interviewers ask this: The false-alarm budget framing and the multiple-testing warning show applied understanding.
A 95 percent confidence interval expresses the precision of an estimate through a repeated-sampling procedure.
- Across repeated samples, intervals built this way would contain the true population value 95 percent of the time.
- A conversion estimate of 5.2 percent plus or minus 0.3 is much more precise than the same estimate plus or minus 3.
- Larger samples and lower variance produce narrower intervals.
- If a decision changes within the interval's range, the data does not yet support that decision firmly.
Why interviewers ask this: Using interval width as a decision-readiness check is the practical skill beyond the definition.
A trustworthy A/B test follows a plan set before launch and preserves random assignment.
- Random assignment should make the groups differ only by the treatment.
- Fix sample size and duration in advance with a power calculation instead of stopping when results look favorable.
- Declare one primary metric before launch rather than searching across many outcomes.
- Peeking, stopping early, nonrandom splits, and fishing across twenty metrics inflate false positives or break the comparison.
Why interviewers ask this: Naming peeking and metric fishing as the classic sins shows exposure to real experimentation.
Outliers should be detected systematically and handled according to their cause.
- Use box plots, histograms, the 1.5 IQR rule, or extreme z-scores to find unusual observations.
- Fix or remove data errors, but keep genuine extremes such as a very large customer.
- Handle valid extremes with robust statistics, winsorization, or separate reporting when appropriate.
- Never silently delete points that spoil a preferred story because outliers may be the main finding.
Why interviewers ask this: Investigate-then-decide instead of automatic removal is the judgment this question screens.
A probability distribution describes the possible values of a random quantity and how likely they are.
- Discrete distributions cover countable outcomes such as purchases, clicks, or defects and assign probability to exact values.
- Continuous distributions cover measurements such as time or weight, where probability applies to intervals and is represented by a density.
- The distinction determines suitable plots, summary statistics, and models for the variable.
Why interviewers ask this: Linking the distinction to plot and model choice grounds an abstract definition.
Common probability distributions match different data-generating processes.
- The binomial distribution models successes in a fixed number of trials, such as conversions among one thousand visitors.
- The Poisson distribution models event counts per interval, such as support tickets per hour, and is useful for rare events.
- The exponential distribution models waiting time between events, such as time until the next failure.
- The normal distribution models sums and averages of many small effects or measurement noise, but using it for heavy-tailed money data produces systematically wrong conclusions.
Why interviewers ask this: Matching distributions to their generating stories is the recognition skill interviewers probe.
Locked questions
- 21
What is expected value, and how is it used in decisions?
probability - 22
What is the difference between standard deviation and standard error?
dispersioninference - 23
How do you think about whether a sample is large enough?
- 24
You compare this month's metrics to last month's and see growth. What could fool you?
monitoring - 25
How do you explain a statistical result to a non-technical stakeholder?
communicationstakeholder-management - 26
What is the difference between a pandas DataFrame and a Series?
pandas - 27
You receive a new dataset as CSV. What are your first steps in pandas?
pandas - 28
How do you filter rows in pandas, and what trips beginners up?
pandas - 29
How does groupby work in pandas, and what does a typical aggregation look like?
pandasaggregation - 30
What goes wrong when merging DataFrames, and how do you protect yourself?
pandas - 31
How do you work with missing values in pandas?
missing-datapandas - 32
What do you use value_counts for during data inspection?
pandas - 33
Why are vectorized operations preferred over apply with a Python function in pandas?
pandaspython - 34
What is NumPy, and why is it faster than plain Python lists?
numpypython - 35
What is broadcasting in NumPy, at an intuitive level?
numpy - 36
What is the difference between loc and iloc?
pandas - 37
How do you find and handle duplicates in a pandas DataFrame?
pandas - 38
How do you work with dates in pandas?
pandas - 39
The dataset is bigger than your RAM. What are your options in Python?
python - 40
How do you make your analysis reproducible?
reproducibility - 41
What Jupyter notebook habits separate clean work from chaos?
python - 42
What does exploratory data analysis involve, and what are you looking for?
exploratory - 43
Which plot do you choose for which question?
chart-choice - 44
How do you read a box plot?
charts - 45
What makes a visualization misleading, even unintentionally?
dataviz - 46
What is a correlation heatmap good for, and where does it mislead?
correlationcharts - 47
Which SQL is essential for a data scientist pulling modeling data?
sql - 48
What must you watch for when joining tables to assemble a modeling dataset?
- 49
When do you aggregate in SQL versus in pandas?
sqlaggregationpandas - 50
How do you sample data for prototyping, and what can sampling break?
samplingprototypes - 51
What is the difference between supervised and unsupervised learning?
supervisedunsupervised - 52
What is the difference between classification and regression?
classification - 53
Why do you split data into train and test sets, and how?
train-test - 54
What is overfitting, and how do you detect it?
overfitting - 55
Explain the bias-variance tradeoff and how it affects model selection.
bias-variancedispersion - 56
What is cross-validation, and why is it important?
cross-validationvalidation - 57
What is data leakage, and what does it look like in practice?
leakage - 58
How does linear regression work, and what should a junior know about its assumptions?
regression - 59
How do you interpret the coefficients of a linear regression?
regression - 60
What is the difference between MSE, RMSE, and MAE?
evaluation - 61
What does R-squared tell you, and what are its limits?
evaluation - 62
What does logistic regression do, and how do you read its output?
regression - 63
How does a decision tree work, and what are its strengths and weaknesses?
trees - 64
How do you keep a decision tree from overfitting?
overfittingtrees - 65
How does k-nearest-neighbors work, and what must you handle for it to perform decently?
knn - 66
What is a random forest, and why does it beat a single decision tree?
ensemblestrees - 67
What is gradient boosting, at an intuition level, and where does XGBoost fit?
boosting - 68
How does k-means clustering work, and how do you choose the number of clusters?
clustering - 69
When does accuracy mislead as a metric?
monitoring - 70
Explain precision and recall and the tradeoff between them.
evaluation - 71
How do you read a confusion matrix?
evaluation - 72
What is the F1 score, and when is it the right metric?
monitoring - 73
What does ROC AUC measure, at an intuition level?
evaluation - 74
How do you handle imbalanced datasets?
imbalancedsoft-skills - 75
Why start with a simple baseline model?
modeling - 76
What is a feature, and what does feature engineering look like in practice?
feature-engineering - 77
How do you encode categorical variables, and when does each method fit?
feature-engineering - 78
A categorical feature has thousands of distinct values. What do you do?
distinct - 79
What is feature scaling, and which models need it?
scaling - 80
How do you handle missing values when preparing features for a model?
missing-datasoft-skills - 81
Why can too many features hurt, and what are simple selection approaches?
feature-selection - 82
What is target leakage in features, and how do you audit for it?
feature-engineering - 83
Why use a three-way split into train, validation, and test?
validation - 84
What is the difference between model parameters and hyperparameters?
hyperparameters - 85
How does hyperparameter tuning work at a practical level?
hyperparameters - 86
How do you understand which features drive your model's predictions?
explainability - 87
What is a scikit-learn Pipeline, and what problem does it solve?
ci-cd - 88
What is the difference between fit, transform, and fit_transform, and why does it matter?
sklearn - 89
How do you present model results to business stakeholders?
stakeholder-managementcommunication - 90
Walk me through a machine learning project end to end.
ml - 91
Your model looked great offline but performs poorly in production. What do you check?
mlops - 92
A stakeholder asks for AI, but the problem is solvable with a simple rule. How do you respond?
stakeholder-managementcommunication - 93
Your analysis contradicts what a stakeholder strongly believes. How do you communicate it?
communicationstakeholder-management - 94
The deadline is near, and the model could still be improved. How do you decide when to stop?
estimation - 95
How do you keep growing as a junior data scientist?
- 96
A teammate needs to continue your analysis. What do you hand over?
- 97
How long do you dig into a problem alone before asking for help?
- 98
A senior data scientist proposes an approach you think is flawed. What do you do?
- 99
How can a model be unfair or biased, and what should a junior watch for?
fairness - 100
What makes a portfolio project actually convincing to interviewers?