Skip to content

Data science interview questions and answers

259 questions that come up in data science interviews, grouped by topic. Machine learning and statistics are tested almost everywhere. Deep learning, LLMs and MLOps come up more for ML engineer and research roles, and the history of AI is there for the small talk. The deck covers concepts, not SQL or coding rounds.

Each topic opens with the questions to answer first, with their short answers. Every question links to its own page with a longer explanation, usually with a worked example. To test yourself instead, play the flashcards or take a ten-question quiz.

Machine Learning82 questions

Models, metrics and the tradeoffs that decide whether a model survives contact with real data.

What is the bias-variance tradeoff?
Expected squared error splits into squared bias (a model too simple for the truth), variance (sensitivity to which training sample you drew) and irreducible noise. Pushing one down usually lifts the other, so you tune capacity and regularization to minimise the sum, not either term alone.
What is overfitting?
When a model performs very well on its training set but poorly on new data, such as a test set, because it has fit the noise and quirks of the training data instead of only the underlying pattern.
What is the difference between L1 (Lasso) and L2 (Ridge) regularization?
L1 penalizes the absolute magnitude of the coefficients while L2 penalizes the square of the coefficients.
What is the difference between boosting and bagging?
Bagging trains models independently on bootstrap samples and averages or votes their predictions, which mainly reduces variance. Boosting trains weak learners one after another, each focusing on the errors of the ensemble so far, and combines them in a weighted sum, which mainly reduces bias.
What is a confusion matrix?
A table that shows how a classifier's predicted classes compare with the actual classes. For binary classification it is a 2x2 grid of true positives, false positives, true negatives and false negatives; with k classes it is a k × k grid with correct predictions on the diagonal.

More machine learning questions

All 82 machine learning questions with their answers

Statistics56 questions

Inference, uncertainty and the ideas that people most often get subtly wrong in interviews.

What is a p-value?
The probability, if the null hypothesis were true, of getting a result at least as extreme as the one observed. A small p-value means the data would be surprising if there were no effect; it is not the probability that the null hypothesis is true.
What is a confidence interval?
A range computed from a sample by a method that, over repeated samples, captures the true parameter a stated share of the time, such as 95%. The 95% describes the method, not the chance that this particular interval contains the true value.
What is a Type I and a Type II error?
Type I errors are false positives (rejecting a true null hypothesis) and Type II errors are false negatives (missing a real effect).
What is the central limit theorem?
The Central Limit Theorem: the mean of n independent draws from a distribution with finite variance is approximately normal for large n, whatever the population's shape. That is what justifies normal-based confidence intervals and t-tests on non-normal data, provided the sample is large enough for the data's skew.
Why doesn't correlation imply causation?
Because an association can come from a confounder that drives both variables, from causation running the other way, from how the data were selected, or from chance. Only an experiment, or careful causal analysis of observational data, shows that changing one changes the other.

More statistics questions

All 56 statistics questions with their answers

Deep Learning56 questions

Neural networks from backpropagation to attention, and the tricks that make them trainable.

Why do we need activation functions?
Without a nonlinear activation, stacked layers collapse into one linear map: W₂(W₁x + b₁) + b₂ is just another linear function of x. Activation functions add the nonlinearity that lets a neural network learn complex functions, such as XOR, that no linear model can represent.
What is ReLU? How is it better than sigmoid?
ReLU, max(0, x), zeroes negative inputs and passes positive ones through. Unlike sigmoid it doesn't saturate for positive inputs, where its gradient is 1, so it greatly reduces vanishing gradients in deep networks, and it is cheaper to compute.
What is learning rate?
Is a tuning parameter in an optimization algorithm that determines the step size at each iteration while moving toward a minimum of a loss function.
How does dropout regularization work in deep learning?
During training, each unit in a layer is set to zero independently with probability p on every forward pass, so each gradient step trains a different random sub-network. At inference no units are dropped.
What’s pooling in CNN? Why do we need it?
Pooling downsamples each feature map by summarizing small windows, usually with the max or the average. It reduces spatial size and computation, lets deeper layers cover a larger part of the input, and makes features somewhat robust to small shifts. It has no learned weights.

More deep learning questions

All 56 deep learning questions with their answers

Generative AI16 questions

Large language models in practice: prompting, retrieval, evaluation and the tradeoffs behind shipping them.

When do you use RAG instead of fine-tuning?
RAG when the model lacks knowledge: facts that change, are private, or need a citation. Fine-tuning when it lacks behaviour: a format, a tone, a narrow task. An index is cheaper to update than weights, so reach for RAG first.
What do temperature, top-p and top-k control?
How the next token is sampled: temperature flattens or sharpens the distribution, top-k keeps the k likeliest tokens, top-p the smallest set whose mass reaches p. Near zero for extraction and code; raise it only when you want variety.
What is an embedding?
A fixed-length vector for text, an image or audio, placed so similar meanings land near each other, which turns search into a nearest-neighbour lookup. Vectors only compare within one model, and closeness is not relevance, hence rerankers.
How do you evaluate a RAG system?
Retrieval and generation separately. Retrieval: recall@k and nDCG on labelled question-document pairs. Generation: faithfulness (every claim supported by the context), relevance and citations. Many bad answers are retrieval failures.
What is the KV cache, and why does it cap concurrency?
Attention keys and values for the prefix, cached per layer, so each new token attends over saved state instead of recomputing the sequence. The cache grows with batch size, sequence length and layers, so GPU memory rather than compute limits throughput.

More generative AI questions

All 16 generative AI questions with their answers

MLOps14 questions

What happens after a model ships: drift, monitoring, deployment and the system design questions around them.

What is data drift?
A change in the distribution of a model's inputs between training and production, so the live features stop looking like the data it learned from. When P(X) moves but P(y | X) stays the same, it is called covariate shift.
What is concept drift?
A change in the relationship between the inputs and the target, P(y | X), so the same inputs now call for a different prediction. The model's learned rules go stale even when the input data looks unchanged.
What is training-serving skew?
A mismatch between how features are computed for training and how they are computed when the model serves predictions, so the live model sees inputs that differ from what it learned from. It is a pipeline bug, not a change in the world.
How do you monitor a model before its labels arrive?
Watch proxies until the ground truth lands: data quality, drift in the inputs and in the predictions, and, for a well-calibrated classifier, an estimate of performance from its own confidence scores. Confirm with realized performance once the labels arrive.
Why can a model that wins offline lose in an A/B test?
Offline metrics are computed on logged data that the old system shaped, against a proxy target, while the A/B test measures the real outcome on live users. Selection bias in the logs, a weak proxy, feedback loops and added latency all open a gap.

More MLOps questions

All 14 MLOps questions with their answers

History35 questions

The people, papers and moments that built the field, from the perceptron to the Transformer.

Who invented the perceptron?
Frank Rosenblatt. Bonus. The invention of the perceptron generated a great deal of excitement and was widely covered in the media.
When was the Turing Test created?
1950, in Turing's paper "Computing Machinery and Intelligence", which swapped the question of whether machines think for an imitation game judged over text. Its weakness is that it rewards convincing conversation rather than understanding — a critique now aimed straight at LLMs.
Who envisioned and created the ImageNet dataset?
Fei-Fei Li, who argued from 2007 that models were starved of data rather than ideas and used crowdsourced labelling to reach roughly 14 million images across 20,000+ categories. The 2012 ILSVRC contest run on it is where AlexNet made deep learning mainstream.
What is the name of the computer program that first beat a professional Go player without a handicap?
AlphaGo, by Google DeepMind. It beat European champion Fan Hui 5-0 in October 2015, the first win by a computer over a professional on a full 19 × 19 board without handicap.

More history questions

All 35 history questions with their answers

Created by santiviquez

About · Quizzes · History of AI · To suggest new questions or report an error send me a dm.