Skip to content

Machine Learning Mock Interview: 20 Questions in 50 Minutes

Four rounds that copy a real interview. Answer aloud, then check the model answers.

Mock interview format

  1. Warm-up · 5 minutes — 4 questions
  2. Technical · 20 minutes — 7 questions
  3. Scenario · 15 minutes — 5 questions
  4. HR & behavioural · 10 minutes — 4 questions

Tip: record yourself and listen back. Most people talk too fast and skip the key idea.

Mock progressStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
3 questions free Unlock the rest in seconds
01

Explain precision, recall and F1 score.

Save to ▾
Show answer
Precision is TP / (TP + FP): of the cases flagged positive, how many were right. Recall is TP / (TP + FN): of the actual positives, how many were found. F1 is the harmonic mean of the two and is low if either is low. Use precision when false alarms are costly, such as spam filters; use recall when misses are costly, such as cancer screening or fraud.
02

What is a holdout set and why should it be touched only once?

Save to ▾
Show answer
A holdout or test set is kept aside for the final evaluation after all model and hyperparameter choices are done. If you check it repeatedly and adjust the model, you are indirectly tuning on it, so its score becomes optimistic. Use cross-validation or a separate validation set for decisions, and report the holdout score once as the realistic estimate.
03

What does it mean to deploy a machine learning model?

Save to ▾
Show answer
Deployment makes a trained model available to produce predictions for real users or systems. It can be batch, scoring data on a schedule and writing results to a table, or real-time, serving predictions through a REST API, or streaming, scoring events as they arrive. It includes packaging the model with its preprocessing, setting up infrastructure, logging, monitoring and a retraining plan.
04

What are the assumptions of linear regression?

Save to ▾
Show answer
Linear regression assumes a linear relationship between features and target, independent errors, constant error variance (homoscedasticity), normally distributed errors for valid inference, and little multicollinearity among features. Violations mainly hurt confidence intervals and coefficient interpretation more than raw predictions. Check them with residual plots, Q-Q plots, the Durbin-Watson test and VIF.
05

Plot a learning curve in scikit-learn.

Save to ▾
Show answer
from sklearn.model_selection import LearningCurveDisplay import numpy as np LearningCurveDisplay.from_estimator(model, X, y, cv=5, train_sizes=np.linspace(0.1, 1.0, 6), scoring='roc_auc', n_jobs=-1) plt.show() A persistent gap between curves suggests more data or regularisation; two low curves suggest a richer model or better features.
06

What is a model registry and why is it useful?

TechnicalMLOps and DeploymentMedium
Save to ▾
Show answer
A model registry is a central store of model versions with metadata: training data version, parameters, metrics, owner and stage such as staging or production. It makes promotions and rollbacks controlled and auditable, and lets serving systems load a model by name and version. MLflow Model Registry, SageMaker Model Registry and Vertex AI Model Registry are common examples.
07

Compare batch scoring and real-time inference.

TechnicalMLOps and DeploymentMedium
Save to ▾
Show answer
Batch scoring runs on a schedule, for example nightly churn scores for all customers written to a table; it is simple, cheap and tolerant of slow models. Real-time inference returns predictions on request, such as fraud checks during payment, and needs low latency, high availability, scaling and fresh features. Choose real-time only when the decision must happen at the moment of the event.
08

Detect anomalies with Isolation Forest.

Save to ▾
Show answer
from sklearn.ensemble import IsolationForest iso = IsolationForest(n_estimators=300, contamination=0.01, random_state=42) iso.fit(X_train) scores = -iso.score_samples(X_new) flags = iso.predict(X_new) == -1 Higher scores mean more anomalous. Tune contamination to match how many alerts reviewers can handle.
09

How does gradient boosting work?

Save to ▾
Show answer
Gradient boosting starts with a simple prediction, like the mean, then repeatedly fits a small tree to the negative gradient of the loss, which for MSE is just the residuals. Each tree's output is scaled by a learning rate and added to the ensemble. A lower learning rate with more trees usually generalises better. Any differentiable loss can be used, which makes it flexible.
10

How do you build a scikit-learn pipeline for mixed numeric and categorical data?

Save to ▾
Show answer
Use ColumnTransformer inside a Pipeline so preprocessing is fit only on training folds. from sklearn.compose import ColumnTransformer from sklearn.pipeline import Pipeline from sklearn.impute import SimpleImputer from sklearn.preprocessing import StandardScaler, OneHotEncoder num = Pipeline([('imp', SimpleImputer(strategy='median')), ('sc', StandardScaler())]) pre = ColumnTransformer([ ('num', num, num_cols), ('cat', OneHotEncoder(handle_unknown='ignore'), cat_cols) ]) model = Pipeline([('pre', pre), ('clf', LogisticRegression(max_iter=1000))])
11

How do you approach a time series forecasting problem differently from normal regression?

TechnicalRegression ModelsMedium
Save to ▾
Show answer
Time series data is ordered and autocorrelated, so random splits leak future information. I use time-based splits or TimeSeriesSplit, create lag and rolling-window features from past values only, and handle trend and seasonality. Baselines like last value or seasonal naive come first. Models range from ARIMA and Prophet to gradient boosting on lag features.
12

Validation AUC is 0.99 on a loan default model. What do you suspect?

Save to ▾
Show answer
Such a high score on a hard problem usually signals leakage. I would check feature importances for a suspiciously dominant feature, look for fields recorded after the loan outcome such as collection status, verify preprocessing was fit only on training data, and check for duplicate customers across train and test. Then re-run with a time-based split to confirm a realistic score.
13

Your random forest model file is 2 GB and too slow for real-time scoring. What can you do?

Save to ▾
Show answer
Reduce size by limiting max_depth and min_samples_leaf, using fewer trees since gains flatten after a few hundred, and dropping weak features. Alternatively switch to a gradient boosting model like LightGBM, which usually gives similar accuracy with far smaller, faster models. Converting to ONNX or using a compiled predictor can also speed up inference. Measure accuracy and latency after each change.
14

Your dataset has 800 correlated features and the model trains slowly. What would you do?

Save to ▾
Show answer
I would remove constant and near-duplicate features, drop one from each highly correlated pair, then apply PCA inside the pipeline and keep components explaining about 95 percent of variance. Alternatively, use L1-regularised models or tree importances for supervised selection. I would compare speed and cross-validated scores; often 50 to 100 features give nearly the same accuracy.
15

You need prediction intervals, not just point estimates, for delivery time. How?

ScenarioRegression ModelsHard
Save to ▾
Show answer
Options are quantile regression, training separate models for the 10th and 90th percentiles with GradientBoostingRegressor(loss='quantile') or LightGBM; conformal prediction, which wraps any model and gives intervals with guaranteed coverage; or bootstrapping. I would check calibration: about 80 percent of actual values should fall within an 80 percent interval on a holdout set.
16

Your cross-validation score is 0.85 but the test score is 0.70. What could explain it?

Save to ▾
Show answer
Possible causes: leakage inside CV, such as preprocessing or feature selection fit outside folds; repeated tuning that overfit the CV folds; a test set from a different time period or population; or duplicate entities across folds but not test. I would check pipeline structure, switch to time-based or group splits that match how test data differs, and compare feature distributions between the two sets.
17

Tell me about a time your analysis was not used by stakeholders. What did you learn?

Save to ▾
Show answer
Situation: I built eight customer segments, but marketing did not use them. Task: understand why. Action: I met the team and learned the segments were hard to act on and lacked clear names. I reduced them to five, added a one-page profile and suggested campaign ideas for each. Result: two segments were used in the next campaign. I learned to involve users from the start.
18

Describe a time you found a serious data quality issue late in a project.

Save to ▾
Show answer
Situation: two days before a demo, I noticed sales for one region were doubled. Task: fix it without missing the deadline. Action: I traced it to a join that duplicated rows on a non-unique key, fixed the join, added row-count assertions to the pipeline and retrained. I informed my lead immediately with the impact. Result: the demo went ahead with correct numbers, and the assertions caught a similar issue later.
19

How do you explain the precision-recall trade-off to a business manager?

HR & behaviouralModel Evaluation and TuningEasy
Save to ▾
Show answer
I use their own example. For fraud: 'If we flag more transactions, we catch more fraud, which is recall, but more genuine customers get blocked, which hurts precision. Here is a table of what each threshold means per day: frauds caught, customers disturbed, reviews needed.' Then we choose the threshold together based on cost. Managers relate much better to counts than to percentages.
20

Tell me about a time a production model failed and how you communicated it.

HR & behaviouralMLOps and DeploymentMedium
Save to ▾
Show answer
Situation: our daily scoring job silently produced all-zero scores for two days after an upstream column was renamed. Task: fix it and inform affected teams. Action: I rolled back to cached scores, patched the feature mapping, and sent a short note explaining impact, cause and fix. I then added schema validation and a check on score distribution. Result: the issue never repeated, and teams trusted our alerts more.

Frequently asked questions

How do I use this mock interview?

Set a 50-minute timer, answer every question aloud (or ask a friend to read them), and open answers only after each round. Note every question where your answer missed the key idea.

How often should I take a mock?

Once a week while preparing and once two or three days before a real interview. The question order is fixed, so for fresh practice use the company and experience pages too.