• Follow Us On :
Data Science Interview Questions

Data Science Interview Questions and Answers

Most data science interview questions aren’t actually testing whether you can recite a textbook definition. They’re testing whether you understand the concept well enough to apply it to a messy, real situation, like explaining why a 94% accurate fraud detection model can still be a genuinely bad model. This guide covers the data science interview questions that come up most often across statistics, machine learning, Python, SQL, and the scenario-based rounds that trip up candidates who only memorized definitions.

Each answer here is written the way you’d actually want to say it out loud in an interview: clear, specific, and grounded in why the concept matters rather than just what it means.

How Data Science Interviews Are Usually Structured

Most companies run some version of the same sequence: an HR screen to cover background and expectations, a technical phone screen focused on SQL and Python fundamentals, often a take-home assignment involving exploratory data analysis on a provided dataset, one or more onsite or virtual rounds covering statistics, machine learning, and a business case study, and a final conversation with the hiring manager focused on culture fit and your past projects. Larger companies, particularly in tech, sometimes stretch this to five or more rounds. Smaller companies often compress it into two or three.

Knowing this structure matters because it tells you where to focus your prep time. SQL and Python questions tend to filter out candidates early, statistics and machine learning questions test depth in the middle rounds, and the final rounds increasingly focus on whether you can connect a model’s output to an actual business decision, not just whether the model is technically correct.

Statistics and Probability Interview Questions

1. What is a p-value, and how do you interpret it?

A p-value is the probability of observing a result at least as extreme as the one you got, assuming the null hypothesis is actually true. A p-value of 0.03 means there’s a 3% chance you’d see this result (or a more extreme one) purely by chance if there were no real effect. It doesn’t tell you the probability that your hypothesis is true, which is a common misunderstanding worth avoiding out loud in an interview.

2. Explain the Central Limit Theorem and why it matters.

The Central Limit Theorem states that the sampling distribution of the mean approaches a normal distribution as sample size increases, regardless of the shape of the underlying population distribution. This matters practically because it’s the reason so many statistical tests that assume normality still work reasonably well on real-world data that isn’t normally distributed, as long as the sample size is large enough.

3. What’s the difference between a Type I and Type II error?

A Type I error is a false positive: rejecting a true null hypothesis, like concluding a new feature improved conversions when it actually didn’t. A Type II error is a false negative: failing to reject a false null hypothesis, like missing a real improvement because the test wasn’t sensitive enough to detect it. The two trade off against each other, and which one matters more depends entirely on the cost of each mistake in context.

4. How would you explain a confidence interval to a non-technical stakeholder?

A 95% confidence interval means that if you repeated the same experiment many times, about 95% of the intervals you’d calculate would contain the true population value. It’s a range of plausible values for an estimate, not a guarantee about any single specific interval, and the width of that range reflects how much uncertainty remains given your sample size.

5. Correlation doesn’t imply causation. Can you give a concrete example?

Ice cream sales and drowning incidents are correlated, both rise in summer, but ice cream doesn’t cause drowning. A third variable, warm weather, drives both. In a business context, this comes up constantly: a spike in app usage correlating with a marketing campaign doesn’t prove the campaign caused it, since seasonality, a competitor’s outage, or a product update could all be happening at the same time.

6. How do you design a proper A/B test?

Start by defining a single primary metric and the minimum effect size worth detecting. Calculate the required sample size ahead of time based on your baseline conversion rate and desired statistical power, typically 80%. Randomly assign users to control and treatment groups, run the test for a full business cycle to account for day-of-week effects, and avoid peeking at results early and stopping as soon as you see significance, which inflates your false positive rate.

7. What’s the bias-variance tradeoff?

Bias is error from a model being too simple to capture the true relationship in the data, leading to underfitting. Variance is error from a model being too sensitive to the specific training data, leading to overfitting on noise rather than signal. Reducing one typically increases the other, and the goal is finding the balance that minimizes total error on unseen data, not on the training set.

Machine Learning Interview Questions

8. Your model has 94% accuracy, but the business team isn’t happy. What’s going on?

This usually means the classes are imbalanced. If only 2% of transactions are fraudulent, a model that predicts “not fraud” every single time achieves 98% accuracy while catching nothing at all. Accuracy becomes a nearly meaningless metric under class imbalance. The right response is switching to precision, recall, and the F1 score, and asking what the actual cost of a false negative versus a false positive is for this specific business problem before choosing which metric to optimize.

9. What’s the difference between precision and recall, and when would you prioritize one over the other?

Precision is the proportion of predicted positives that are actually positive; recall is the proportion of actual positives the model correctly identifies. For spam detection, precision usually matters more, since marking a real email as spam is worse than missing an occasional spam message. For a disease screening model, recall usually matters more, since missing a real case has a much higher cost than a false alarm that gets ruled out with further testing.

10. What is cross-validation, and why not just use a single train-test split?

Cross-validation splits the data into several folds, training on some and validating on the rest, rotating through all folds so every data point is used for both training and validation across different runs. This gives a more reliable estimate of how a model will generalize than a single split, which can produce a misleadingly good or bad score purely by chance depending on which rows happened to land in the test set.

11. Explain the difference between feature selection and feature extraction.

Feature selection chooses a subset of existing features that are most relevant to the target, discarding the rest. Feature extraction creates new features by transforming or combining the original ones, like using PCA to compress many correlated variables into a smaller number of components. Selection keeps original, interpretable features; extraction trades some interpretability for a more compact representation.

12. What’s the difference between L1 and L2 regularization?

Both add a penalty term to a model’s loss function to discourage overly large coefficients and reduce overfitting. L1 (Lasso) can shrink some coefficients all the way to zero, effectively performing feature selection automatically. L2 (Ridge) shrinks coefficients toward zero but rarely to exactly zero, which tends to work better when most features genuinely contribute at least a small amount to the prediction.

13. Why does XGBoost often outperform a single decision tree, and when would you still choose a simpler model?

XGBoost builds an ensemble of trees sequentially, with each new tree correcting the errors of the ones before it, which typically produces much stronger predictive accuracy than any single tree alone. That said, a simpler model like logistic regression is often the better choice when interpretability matters more than raw accuracy, such as in regulated industries where you need to explain exactly why a decision was made.

14. How would you explain an ROC curve and AUC to someone unfamiliar with them?

An ROC curve plots the true positive rate against the false positive rate across every possible classification threshold. AUC, the area under that curve, summarizes overall model performance into a single number between 0.5 (no better than random guessing) and 1.0 (perfect separation between classes). It’s useful for comparing models independent of any single chosen threshold, though it can be misleading on heavily imbalanced datasets, where precision-recall curves often tell a more honest story.

15. What’s the difference between supervised, unsupervised, and reinforcement learning?

Supervised learning trains on labeled data, where the correct output is already known, covering tasks like classification and regression. Unsupervised learning works with unlabeled data, finding structure on its own through techniques like clustering or dimensionality reduction. Reinforcement learning is different from both: an agent learns by taking actions in an environment and receiving rewards or penalties, gradually improving its strategy through trial and error rather than learning from a fixed labeled dataset upfront.

16. What is one-hot encoding, and when would you avoid it in favor of a different approach?

One-hot encoding converts a categorical variable into multiple binary columns, one per category, which works well for algorithms that assume numerical input without implying any order between categories. It becomes impractical once a categorical feature has very high cardinality, hundreds or thousands of unique values, since it creates an equally large number of sparse columns. In that situation, target encoding or embedding-based approaches usually scale better than one-hot encoding.

Python and Coding Interview Questions

17. Why are NumPy arrays faster than Python lists for numerical work?

NumPy arrays store elements of a single fixed type in one contiguous block of memory, and operations run using precompiled, optimized code instead of looping through elements in pure Python. Python lists store separate objects with their own overhead, and any calculation on them typically requires an explicit Python-level loop, which is considerably slower for large datasets. Our NumPy tutorial with examples covers this comparison directly with runnable code.

18. How would you handle missing data in a Pandas DataFrame?

The right approach depends on how much is missing and why. For a small proportion of missing rows in an otherwise complete dataset, dropping them with dropna() is often fine. For a numeric column with more significant gaps, median or mean imputation is a common default, while forward-fill (ffill) tends to make more sense for time series data. For columns where missingness itself might be predictive, a separate indicator flag can preserve that signal rather than just filling it in silently.

19. What’s the difference between .apply(), .map(), and .applymap() in Pandas?

.map() works only on a Series, applying a function element-wise. .apply() works on both Series and DataFrames and can operate row-wise or column-wise, making it more flexible for more complex transformations. .applymap() (or .map() on a full DataFrame in newer Pandas versions) applies a function to every individual element across an entire DataFrame at once.

20. What’s the difference between a list and a tuple in Python, and when would you choose one over the other?

Lists are mutable, meaning their contents can be changed after creation, while tuples are immutable. Tuples are generally faster and use less memory, and their immutability makes them a safer choice for data that shouldn’t change, like fixed configuration values or dictionary keys, since tuples (unlike lists) can be used as dictionary keys precisely because they’re hashable.

21. How do you identify and handle outliers in a dataset?

Common approaches include the interquartile range (IQR) method, flagging anything beyond 1.5 times the IQR above the third quartile or below the first, and z-score thresholds for roughly normal data. Whether to remove, cap, or leave outliers depends entirely on context: a genuinely erroneous sensor reading should probably be removed, while an unusually large but legitimate transaction might be exactly the pattern a fraud model needs to learn from.

SQL Interview Questions

22. Write a query to find the second-highest salary in an employee table.

sql
SELECT DISTINCT base_salary AS second_highest_salary
FROM employees
ORDER BY base_salary DESC
LIMIT 1 OFFSET 1;

Using DISTINCT avoids returning a duplicate value if multiple employees share the highest salary, and adjusting the OFFSET value generalizes this to find the nth-highest salary.

23. What’s the difference between INNER JOIN, LEFT JOIN, and FULL OUTER JOIN?

An INNER JOIN returns only rows with matches in both tables. A LEFT JOIN returns every row from the left table, with NULL values filled in for any columns from the right table that don’t have a match. A FULL OUTER JOIN returns every row from both tables, matching where possible and filling in NULL on either side where there’s no match.

24. Explain how a window function like RANK() differs from GROUP BY.

GROUP BY collapses multiple rows into a single summary row per group, losing the individual row-level detail. A window function like RANK() OVER (PARTITION BY department ORDER BY salary DESC) calculates a value across a defined “window” of related rows while still returning every individual row, which is exactly what you need for tasks like ranking employees within a department without losing each employee’s own record.

25. What’s the difference between WHERE and HAVING?

WHERE filters individual rows before any grouping happens. HAVING filters groups after a GROUP BY aggregation has already been applied, which is why you can use HAVING COUNT(*) > 5 to filter for groups with more than five rows, but you can’t do the equivalent filtering with WHERE on an aggregated value directly.

26. What’s the difference between a subquery and a CTE (Common Table Expression)?

Both let you break a complex query into smaller logical pieces. A subquery is nested directly inside another query, which can get hard to read once nesting goes more than one or two levels deep. A CTE, defined with a WITH clause, names that intermediate result and can be referenced multiple times in the main query, which generally makes complex queries considerably more readable and easier to debug.

27. What is database normalization, and why would you sometimes deliberately denormalize a table?

Normalization organizes data to reduce redundancy, typically by splitting information into related tables connected through foreign keys, which avoids the same fact being stored (and potentially updated inconsistently) in multiple places. Denormalization intentionally reintroduces some redundancy, often by combining related tables, to speed up read-heavy queries in analytics and reporting contexts where join performance matters more than the storage efficiency and update safety normalization provides.

Behavioral and Scenario-Based Questions

28. Walk me through a model you built that didn’t work as expected, and what you did about it.

This is one of the more common questions in senior-level interviews now, and it’s checking something specific: whether you can honestly diagnose a real failure rather than only describing successes. A strong answer names a specific model, states clearly what you expected going in, describes exactly what the evaluation metrics showed instead, and explains what you changed afterward, whether that was different features, a different algorithm, or a realization that the business problem itself was framed incorrectly from the start.

29. How would you explain a complex model to a non-technical stakeholder?

Focus on the business question the model answers and the tradeoffs involved, not the mechanics of the algorithm. Instead of explaining gradient boosting, you might say the model flags the 5% of transactions most likely to be fraudulent, and explain what happens to a real customer if the model gets that flag wrong in either direction. Concrete examples and a clear statement of the tradeoff between catching more fraud and inconveniencing legitimate customers usually land better than technical detail.

30. Describe a time you disagreed with a stakeholder about how to interpret data.

A good answer here shows you can hold a technical position while still respecting the stakeholder’s business context, and that you know how to resolve the disagreement with evidence rather than authority. Frame it around what the actual disagreement was, what additional analysis or data you brought to the conversation, and how it was ultimately resolved, ideally in a way that shows you were willing to update your own view if the evidence supported it.

31. How do you prioritize which analysis to work on when everything feels urgent?

Strong answers usually reference some combination of expected business impact, effort required, and how time-sensitive the underlying decision actually is. Mentioning a specific framework, like weighing impact against effort, or simply describing how you’ve had a direct conversation with a stakeholder to clarify true urgency versus perceived urgency, shows a level of judgment that goes beyond just working through a to-do list in the order it arrived.

32. How do you communicate uncertainty to a stakeholder who wants a simple, definitive answer?

Rather than hiding the uncertainty to avoid an uncomfortable conversation, a good approach is translating it into terms the stakeholder actually cares about: instead of citing a wide confidence interval, framing it as “we’re fairly confident this change increased conversions somewhere between 2% and 8%, and here’s what that range means for the rollout decision.” Giving a range alongside a clear recommendation usually lands better than either a false sense of precision or a vague non-answer.

GenAI, LLMs, and MLOps Questions (A Growing 2026 Focus)

33. What is retrieval-augmented generation (RAG), and why would you use it?

RAG combines a large language model with a retrieval step that pulls relevant information from an external dataset before generating a response, rather than relying solely on what the model learned during training. This matters because it lets a model answer questions about private, current, or company-specific information without retraining the model itself, and it reduces the risk of the model confidently generating incorrect information about topics its training data didn’t cover well.

34. What’s the difference between fine-tuning a model and prompt engineering?

Fine-tuning updates a model’s internal parameters using additional training examples, which can meaningfully change its behavior but requires more data, compute, and expertise. Prompt engineering adjusts the input given to an existing model without changing its parameters at all, which is faster and cheaper but has a lower ceiling for how much it can change fundamental model behavior. Most practical applications start with prompt engineering and only move to fine-tuning once prompting alone can’t reliably produce the needed output.

35. How would you evaluate whether an LLM’s output is good enough for a production use case?

This depends heavily on the task, but generally involves defining specific success criteria upfront (accuracy on a labeled test set, consistency across repeated runs, absence of specific failure modes like fabricated facts), building a small evaluation set of representative real examples, and treating human review as part of the ongoing evaluation loop rather than a one-time check before launch, since model behavior can drift as usage patterns shift over time.

36. What does MLOps mean in practice, and why does it matter beyond just building a good model?

MLOps covers everything involved in getting a model into production and keeping it reliable there: version control for data and models, automated testing and deployment pipelines, and ongoing monitoring for performance degradation or data drift. A model that scores well in a notebook is only useful if it can be deployed reliably, monitored for when its real-world performance starts diverging from its training-time performance, and updated without breaking whatever system depends on it.

Tips for Preparing Well

Practice with real, messy datasets rather than only clean textbook examples, since interviewers increasingly test how you handle ambiguity and imperfect data rather than clean, pre-processed inputs. Prepare three to five specific project stories using the STAR method (situation, task, action, result) so you’re not improvising your best examples under pressure. Reread your own past projects closely before an interview, since being unable to explain a decision from a project on your own resume is one of the fastest ways to lose credibility in a technical round. Finally, treat mock interviews as seriously as the real ones. Practicing out loud, not just reading questions silently, is what actually builds the fluency interviewers are evaluating.

Frequently Asked Questions

How many rounds does a typical data science interview process have?

Usually three to five: an HR screen, a technical phone screen, sometimes a take-home assignment, one or more onsite or virtual technical rounds, and a final hiring manager conversation. Large tech companies sometimes extend this to five or more rounds.

Should I focus more on Python or SQL when preparing?

Both matter, but SQL questions are increasingly used as an early filter, since they test whether you can extract and reason about data under time pressure, which reflects real day-to-day work more directly than an isolated Python coding puzzle. Neither should be skipped in favor of the other.

Do data science interviews still ask heavy math and statistics questions?

Yes, statistics remains a core pillar, particularly concepts like p-values, confidence intervals, and experiment design, since these come up constantly in real analytical work regardless of which specific tools or models a company uses.

Are LLM and generative AI questions common now, even for non-AI-focused roles?

Increasingly yes, particularly in senior-level loops, even at companies that aren’t building AI products directly. Interviewers are checking basic familiarity with concepts like RAG and prompt engineering, since so many analytics workflows now touch these tools in some form.

What’s the best way to practice SQL window functions before an interview?

Work through real scenario questions, ranking rows within groups, calculating running totals, comparing a row to the previous one with LAG(), rather than only memorizing syntax. Interviewers generally care more about whether you reach for the right window function for a given problem than whether you have the exact syntax memorized perfectly.

Where to Go From Here

These data science interview questions cover the core areas that come up across nearly every hiring process: statistics, machine learning, Python, SQL, behavioral rounds, and the newer wave of LLM and MLOps questions showing up more often in 2026. The fastest way to move from recognizing these answers to actually giving them well under pressure is practicing out loud with real projects and real datasets, not just reviewing this list silently.

If you want to strengthen the fundamentals behind these questions, our Python tutorial, NumPy tutorial with examples, and Machine Learning tutorial cover the material most of these questions are built on. For the growing number of questions touching NLP and language models specifically, our Natural Language Processing tutorial is a solid next stop. For a broader look at how the data scientist role is projected to grow, the U.S. Bureau of Labor Statistics Occupational Outlook Handbook is a reliable reference, and scikit-learn’s model evaluation documentation is worth bookmarking for a deeper look at the metrics covered in the machine learning section above.

Leave a Reply

Your email address will not be published. Required fields are marked *