Machine Learning Basics interview questions

25 questions from the Machine Learning Basics course, each with the correct answer and an explanation. Try to answer before you open the answer.

What Machine Learning Is

1. What does a machine learning algorithm learn from?

  1. The programmer's intuition at runtime
  2. Only hand-written if statements
  3. Examples of inputs with their correct outputs (or structure in the inputs)
  4. Random numbers alone
Show answer

Answer: Examples of inputs with their correct outputs (or structure in the inputs)

The data defines what is learned.

Lesson: Rules From Data Instead of Rules by Hand

3. Where does most of the effort in an ML project usually go?

  1. Buying GPUs
  2. Choosing a fancy algorithm
  3. Writing the user interface
  4. Data preparation and evaluation
Show answer

Answer: Data preparation and evaluation

Good data and honest evaluation matter most.

Lesson: The Machine Learning Workflow

Preparing Data

4. Why is training accuracy a poor measure of model quality?

  1. Training data is always wrong
  2. The model may have memorised the training rows
  3. It is always lower than test accuracy
  4. It cannot be computed
Show answer

Answer: The model may have memorised the training rows

Judge models on unseen data.

Lesson: Features, Labels and Train/Test Splits

5. What is a warning sign of data leakage?

  1. A model that underfits
  2. Suspiciously near-perfect test results
  3. Slow training
  4. Missing values in one column
Show answer

Answer: Suspiciously near-perfect test results

Too good to be true usually is.

Lesson: Data Leakage

6. Which model is most sensitive to feature scaling?

  1. A model that always predicts the mean
  2. Decision tree
  3. Random forest
  4. k-nearest neighbours
Show answer

Answer: k-nearest neighbours

Distances are dominated by large-scale features.

Lesson: Scaling and Encoding Features

Regression: Predicting Numbers

7. What does linear regression minimise during training?

  1. The sum of squared differences between predictions and true values
  2. The number of features
  3. The training time
  4. The number of rows
Show answer

Answer: The sum of squared differences between predictions and true values

Least squares is the standard objective.

Lesson: Linear Regression

8. What does an R² of 0 mean?

  1. Every prediction is zero
  2. The model is perfect
  3. The model is no better than always predicting the mean
  4. The data has no rows
Show answer

Answer: The model is no better than always predicting the mean

R2 compares against the mean baseline.

Lesson: Regression Metrics: MAE, RMSE and R²

9. Why compare a model with a baseline?

  1. It trains the model faster
  2. Baselines are always better
  3. To know whether it actually adds value over something simple
  4. It removes the need for a test set
Show answer

Answer: To know whether it actually adds value over something simple

Context makes metrics meaningful.

Lesson: Always Beat a Baseline

Classification: Predicting Categories

10. What does logistic regression output before thresholding?

  1. A probability for the positive class
  2. A cluster id
  3. A continuous price
  4. A decision tree
Show answer

Answer: A probability for the positive class

The threshold turns a probability into a class.

Lesson: Logistic Regression and Probabilities

11. What happens with k = 1 in k-NN?

  1. It needs no data
  2. The model ignores all training data
  3. It always predicts one class
  4. Training accuracy is perfect but the model follows noise
Show answer

Answer: Training accuracy is perfect but the model follows noise

Very flexible models memorise.

Lesson: Decision Trees and k-Nearest Neighbours

12. Recall answers which question?

  1. Of predicted positives, how many were right?
  2. Of all actual positives, how many did the model catch?
  3. How fast is the model?
  4. How many features are used?
Show answer

Answer: Of all actual positives, how many did the model catch?

Recall measures misses.

Lesson: Confusion Matrix, Precision and Recall

13. What usually happens when you lower the classification threshold?

  1. Both always rise
  2. Recall rises and precision falls
  3. Precision rises and recall falls
  4. Nothing changes
Show answer

Answer: Recall rises and precision falls

More cases flagged means more catches and more false alarms.

Lesson: Choosing the Decision Threshold

Generalisation: Overfitting and Validation

14. Low training error but much higher test error indicates what?

  1. Data leakage is impossible
  2. Underfitting
  3. A perfect model
  4. Overfitting
Show answer

Answer: Overfitting

The model learned noise specific to the training set.

Lesson: Underfitting and Overfitting

15. Why use cross-validation instead of one split?

  1. It averages over several splits, giving a more reliable estimate
  2. It makes training faster
  3. It removes the need for data
  4. It guarantees zero error
Show answer

Answer: It averages over several splits, giving a more reliable estimate

More splits, less luck.

Lesson: Cross-Validation

16. What happens when regularisation is far too strong?

  1. Training stops working entirely
  2. The model overfits more
  3. The model underfits
  4. The data gets larger
Show answer

Answer: The model underfits

Too much penalty makes the model too simple.

Lesson: Regularisation

Ensembles, Tuning and Interpretation

17. How does a random forest reduce overfitting compared with one deep tree?

  1. It removes the test set
  2. It uses only one feature
  3. It averages many trees trained on random subsets
  4. It trains a single shallow rule
Show answer

Answer: It averages many trees trained on random subsets

Averaging cancels individual trees' noise.

Lesson: Random Forests and Gradient Boosting

18. Why evaluate on the test set only once, at the end?

  1. Tuning against it would make the final score optimistic
  2. The test set expires
  3. It is too large to use twice
  4. Cross-validation requires it
Show answer

Answer: Tuning against it would make the final score optimistic

Keep the final exam unseen.

Lesson: Hyperparameter Search

19. What does high permutation importance tell you?

  1. The feature should be deleted
  2. The feature causes the outcome
  3. The feature has missing values
  4. The model relies heavily on that feature for its predictions
Show answer

Answer: The model relies heavily on that feature for its predictions

Importance is about the model, not causation.

Lesson: Which Features Matter? Permutation Importance

Unsupervised Learning

20. Why not choose k simply by the lowest inertia?

  1. Inertia is always zero
  2. Inertia always decreases as k increases
  3. Inertia increases with k
  4. k-means has no inertia
Show answer

Answer: Inertia always decreases as k increases

Use an elbow or silhouette instead.

Lesson: Clustering With k-Means

21. What does PCA order its components by?

  1. Alphabetical feature name
  2. The amount of variance each captures
  3. Training time
  4. Class labels
Show answer

Answer: The amount of variance each captures

The first component captures the most variance.

Lesson: Dimensionality Reduction With PCA

22. Why should anomaly flags usually be reviewed?

  1. Review makes training faster
  2. Anomaly detectors are always perfect
  3. Flags are random
  4. Some flagged points are unusual but legitimate
Show answer

Answer: Some flagged points are unusual but legitimate

Unusual is not the same as bad.

Lesson: Anomaly Detection

Putting It Together Responsibly

23. Why put preprocessing inside a pipeline?

  1. The same steps are fit on training folds only and reused identically in production
  2. Pipelines make models larger
  3. It is required for decision trees only
  4. It removes the need for a test set
Show answer

Answer: The same steps are fit on training folds only and reused identically in production

Pipelines prevent leakage and mismatch.

Lesson: An End-to-End Mini Project

24. Why monitor a model after deployment?

  1. Monitoring trains the model
  2. Models improve automatically
  3. Data and the world change, so performance can decay
  4. It is only needed for regression
Show answer

Answer: Data and the world change, so performance can decay

Deployment is the start, not the end.

Lesson: Responsible Machine Learning

25. Which item belongs on an ML project checklist?

  1. Skip the baseline
  2. Tune on the test set
  3. Split off the test set first and use it only once
  4. Fit scaling on all data before splitting
Show answer

Answer: Split off the test set first and use it only once

Honest evaluation underpins everything else.

Lesson: A Machine Learning Project Checklist

← Back to the course