Sample questions
Question 1Easy
In machine learning, what are "features"?
- The predicted output values that the model produces for each example
- The input variables used to make a prediction
- The hyperparameters of the model
- The errors made on the test set
Answer: B. The input variables used to make a prediction
Explanation
Features (independent variables) are the measurable inputs, such as area and location for predicting house price. The value being predicted is the label or target.
Step-by-step solution
- A model maps inputs to an output.
- The measurable inputs (age, income, pixel values) are the features.
- The value being predicted is the target or label.
Why the other options are wrong
- A. That describes predictions (outputs), not inputs.
- C. Hyperparameters are settings chosen before training, not data columns.
- D. Errors on the test set are used for evaluation, not as inputs.
Tip: Features = inputs (X); label/target = output (y).
Question 2Easy
Why is a dataset split into training and test sets?
- Because models cannot handle large datasets in one piece
- To make training faster by giving the model fewer examples to process
- To increase the number of features available
- To estimate how well the model generalises to unseen data
Answer: D. To estimate how well the model generalises to unseen data
Explanation
Evaluating on the same data used for training gives an over-optimistic estimate; a held-out test set simulates new data.
Step-by-step solution
- The model learns patterns from the training set.
- The test set is held back and never shown during training.
- Scoring on it estimates performance on new, unseen data.
Why the other options are wrong
- A. Splitting is about honest evaluation, not memory limits.
- B. Speed is not the purpose; fewer training rows usually hurts the model.
- C. Splitting rows does not add any features.
Tip: Train to learn, test to judge.
Question 3Easy
Gradient descent updates model parameters by moving them:
- Towards zero regardless of the loss
- In the direction of the gradient of the loss
- In the direction opposite to the gradient of the loss
- To random values each iteration, keeping the change only if the loss goes down
Answer: C. In the direction opposite to the gradient of the loss
Explanation
The gradient points towards steepest increase; stepping against it (scaled by the learning rate) decreases the loss.
Step-by-step solution
- The gradient points in the direction where the loss increases fastest.
- To reduce the loss, step the opposite way.
- Update: w = w - learning_rate x gradient.
Why the other options are wrong
- A. Updates depend on the loss gradient, not a pull towards zero.
- B. Moving along the gradient increases the loss.
- D. Random trial-and-error is not gradient descent.
Tip: Minus sign: w new = w - lr x gradient.
Question 4Medium
What is "data leakage" in machine learning?
- A model that consumes too much memory
- Using too few features, so the model cannot capture the true pattern in the data
- Losing rows while loading a CSV file
- Test or target information influencing training
Answer: D. Test or target information influencing training
Explanation
Example: scaling with statistics computed on the whole dataset before splitting, or a feature that is only known after the outcome. It inflates evaluation scores.
Step-by-step solution
- Leakage means information unavailable at prediction time sneaks into training.
- Examples: test rows used to fit a scaler, or a feature computed from the target.
- The model then looks great in evaluation but fails in real use.
Why the other options are wrong
- A. Memory use is unrelated to leakage.
- B. Too few features causes underfitting, not leakage.
- C. Losing rows is a data-loading bug, not leakage.
Tip: Suspiciously high accuracy? Check for leakage first.
Question 5Medium
What is the role of a validation set?
- Replacing the test set entirely
- Training the final model weights
- Tuning hyperparameters without touching the test set
- Storing mislabelled examples so they can be corrected before final training
Answer: C. Tuning hyperparameters without touching the test set
Explanation
If the test set were used for tuning, it would leak into model selection and no longer give an unbiased final estimate.
Step-by-step solution
- Training data fits the model's weights.
- Validation data compares settings such as depth or learning rate.
- The test set is kept untouched for one final, unbiased check.
Why the other options are wrong
- A. The test set is still needed for the final unbiased estimate.
- B. Weights are learned on the training set.
- D. The validation set is not a store for bad labels.
Tip: Train = learn weights, validation = tune, test = final report.
Question 6Medium
Which of the following is a hyperparameter rather than a learned parameter?
- The weights of a linear regression model
- The split thresholds learned by a decision tree
- The biases of a neural network
- The learning rate of gradient descent
Answer: D. The learning rate of gradient descent
Explanation
Hyperparameters are set before training (learning rate, tree depth, k in k-NN). Parameters are learned from data.
Step-by-step solution
- Learned parameters are found by the training algorithm from data.
- Hyperparameters are set by you before training starts.
- The learning rate is chosen beforehand and controls how training runs.
Why the other options are wrong
- A. Weights are learned from data during training.
- B. Split thresholds are chosen by the tree algorithm from data.
- C. Biases are learned just like weights.
Tip: If training sets it, it is a parameter; if you set it, it is a hyperparameter.
Question 7Hard
Why should feature scaling (e.g. standardisation) be fitted on the training set only and then applied to the test set?
- Scalers cannot process more than one dataset
- Scaling the test set is never needed
- The test set has different features from the training set, so it needs its own scaler
- Fitting on all data leaks test statistics into training
Answer: D. Fitting on all data leaks test statistics into training
Explanation
Fit the scaler (mean and standard deviation) on training data, then transform both sets. scikit-learn Pipelines do this automatically inside cross-validation.
Step-by-step solution
- A scaler learns statistics such as mean and standard deviation.
- Fitting it on all data lets test-set statistics shape the training data.
- Fit on training data only, then apply the same transform to test data.
Why the other options are wrong
- A. Scalers can transform any number of datasets once fitted.
- B. Test data must be scaled the same way, or the model sees different units.
- C. Train and test have the same features; a separate scaler would scale them inconsistently.
Tip: fit on train, transform on everything.
Practise all 7 questions free
The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.
Open this topic in the app →