Machine Learning Interview Questions for Freshers
12 machine learning interview questions for freshers and students: supervised learning, overfitting, train and test splits, classification versus regression, accuracy on imbalanced data, feature scaling, precision, recall and k-NN. Each answer explains why the other options are wrong.
CoversBias and varianceFeature engineeringImbalanced dataMetricsML basicsModel evaluationOverfitting
Practice questions with answers
Tap an option: green is right, red is wrong, and the explanation says why.
What makes a learning problem supervised?
Show answer and explanation
Answer: C. The training data includes the correct answer (label) for each example
In supervised learning every training example comes with its target: an email marked spam or not, a house with its sale price. The model learns a mapping from inputs to those labels and is judged on how well it predicts labels for new inputs. Unsupervised learning, such as clustering, finds structure without labels. Supervised learning works on any data type, not only images, and "supervised" refers to the labels, not to someone watching training.
A model scores 99% on its training data but 70% on new data. What is this called?
Show answer and explanation
Answer: C. Overfitting: the model learned noise and details of the training set that don't generalise
A big gap between training and test performance is the classic sign of overfitting: the model memorised quirks of the training examples instead of the general pattern. Fixes include more data, a simpler model, regularization, early stopping and cross-validation to choose settings. Underfitting looks different: poor scores on training and test data alike. Augmentation and normalisation are techniques, not names for this symptom.
Why do you keep a separate test set that the model never sees during training?
Show answer and explanation
Answer: D. To estimate how well the model will perform on new, unseen data
Scoring a model on data it trained on rewards memorisation, so the number is optimistic. A held-out test set, used once at the end, gives an honest estimate of real-world performance. It doesn't speed up training, it actually reduces the training data a little, and libraries will happily train on everything; the split is a methodology choice, not a technical requirement.
What is the difference between classification and regression?
Show answer and explanation
Answer: C. Classification predicts a category; regression predicts a number
The target decides the task. Predicting spam or not spam, or which of ten digits an image shows, is classification. Predicting a house price or tomorrow's temperature is regression. Either can use linear models, trees or neural networks, and neither is inherently more accurate. Note the naming trap: logistic regression is a classification model despite its name.
True or false: on a dataset where 99% of examples are negative, accuracy can make a useless model look good.
Show answer and explanation
Answer: True
True. A model that always predicts "negative" scores 99% accuracy while catching none of the positives you care about, such as fraud or disease. With imbalanced data, look at precision, recall, F1 and the precision-recall curve, and at the confusion matrix, which shows exactly what kinds of mistakes the model makes. Interviewers ask this to see whether you question a single headline metric.
Which kind of model benefits most from scaling features to similar ranges?
Show answer and explanation
Answer: A. Distance- and gradient-based models such as k-NN, SVMs and logistic regression trained with gradient descent
If one feature is income in rupees and another is age in years, distances and gradient steps are dominated by the large-scale feature. Standardisation or min-max scaling puts features on comparable ranges, which helps k-NN, k-means, SVMs and gradient-trained linear models and neural networks. Trees split on thresholds one feature at a time, so scaling doesn't change them. Scaling doesn't add data, and it doesn't impute missing values.
What does precision measure for a classifier?
Show answer and explanation
Answer: A. Of the examples predicted positive, the fraction that are actually positive: TP / (TP + FP)
Precision answers "when the model says positive, how often is it right?", so it drops with false positives. The second option is recall (sensitivity), which drops with false negatives. The fraction of all predictions that are correct is accuracy, and the last option is specificity. A spam filter cares about precision (don't bin real email); a cancer screen cares about recall (don't miss cases).
What does this code print?
y_true = [1, 0, 1, 1, 0, 1]
y_pred = [1, 1, 1, 0, 0, 1]
tp = sum(1 for t, p in zip(y_true, y_pred) if t == 1 and p == 1)
fp = sum(1 for t, p in zip(y_true, y_pred) if t == 0 and p == 1)
fn = sum(1 for t, p in zip(y_true, y_pred) if t == 1 and p == 0)
print(round(tp / (tp + fp), 2), round(tp / (tp + fn), 2))Show answer and explanation
Answer: D. 0.75 0.75
Walk the pairs: positions 0, 2 and 5 are true positives (TP = 3), position 1 is a false positive (predicted 1, actually 0, so FP = 1) and position 3 is a false negative (actually 1, predicted 0, so FN = 1). Precision is 3 / (3 + 1) = 0.75 and recall is 3 / (3 + 1) = 0.75, so it prints 0.75 0.75. The other options come from miscounting: 0.6 would need two errors on one side, and 1.0 would mean no false positives.
In k-nearest neighbours, what happens as you make k very small, such as k = 1?
Show answer and explanation
Answer: B. The model follows individual training points closely: low bias, high variance and sensitivity to noise
With k = 1 each prediction copies the single nearest training point, so one mislabelled or noisy point changes predictions around it: the decision boundary is jagged (high variance, low bias). Larger k averages more neighbours, which smooths the boundary but can blur real patterns (higher bias). k-NN has almost no training step, so k doesn't change training time, and it relies entirely on the training data at prediction time.
How does k-fold cross-validation work?
Show answer and explanation
Answer: B. Split the data into k parts, train on k − 1 and validate on the remaining one, rotate through all parts and average the scores
Each fold takes one turn as the validation set while the other folds train the model, so every example is used for validation exactly once and the average score is a steadier estimate than a single split. It is used to compare models and tune hyperparameters, with a final untouched test set kept for the end. Training on all data and picking the best overfits the choice, removing features is feature selection, and the test set should never be used for training.
Take it as a timed test
- 12 questions
- 15 min
- Pass mark 60%
- Answers shown at the end
Sign in with your email to take the test: we send a 6-digit code, no password. Your scores and reports are saved to your account. The test also uses 10 questions that aren't shown above, so practise for understanding, not memory.
About this paper
This freshers paper has 12 machine learning questions for students and new graduates applying to data science, ML and analyst roles. It covers the ideas interviewers use to check your foundations: what supervised learning needs, how to spot overfitting, why a test set must stay unseen, when accuracy lies, why some models need scaled features, and how precision and recall are calculated, including one small Python calculation to predict. Ten questions are on this page with full explanations. Each timed test draws 12 questions from a larger bank, including ones that aren't shown here, so every attempt is different.
Work each one out before opening the explanation, then take the timed test: 15 minutes, a pass mark of 60%, and a report that shows which topics cost you marks.