Model Selection & Cross-Validation Questions with Answers

6 practice questions on Model Selection & Cross-Validation (Machine Learning) with answers and step-by-step solutions. Try 6 samples below, then practise all 6 free in the AptiNest app.

Sample questions

Question 1Easy

In k-fold cross-validation, the data is

  1. Split into two equal parts only
  2. Duplicated k times and evaluated on the same split each round
  3. Sorted by label and then split
  4. Split into k parts; each part is used once as validation while the rest train

Answer: D. Split into k parts; each part is used once as validation while the rest train

Explanation

Each of the k folds acts as the validation set exactly once, and the k scores are averaged.

Step-by-step solution

  1. Divide data into k folds.
  2. Train on k-1, validate on 1.
  3. Repeat k times and average.

Why the other options are wrong

  • A. That is a single hold-out split.
  • B. Folds differ each round.
  • C. Sorting by label would break representativeness.

Question 2Medium

Stratified k-fold is preferred for classification with imbalanced classes because it

  1. Removes the minority class
  2. Increases k automatically
  3. Shuffles the labels randomly between folds to remove any bias
  4. Keeps the class proportions similar in every fold

Answer: D. Keeps the class proportions similar in every fold

Explanation

Without stratification a fold may hold almost no minority samples, giving unstable scores.

Step-by-step solution

  1. Count each class.
  2. Split each class across folds evenly.
  3. Every fold mirrors the full data.

Why the other options are wrong

  • A. It keeps minority samples in all folds.
  • B. k is chosen by you.
  • C. Labels are not shuffled; rows are distributed by class.

Question 3Medium

For 5-fold cross-validation on 1000 samples, how many samples are used to train in each round?

  1. 800
  2. 200
  3. 1000
  4. 500

Answer: A. 800

Explanation

Each fold has 200 rows; training uses the other four folds = 800.

Step-by-step solution

  1. Fold size = 1000/5 = 200.
  2. Train on k-1 = 4 folds.
  3. 4 x 200 = 800.

Why the other options are wrong

  • B. That is the validation fold size.
  • C. Then there would be nothing left to validate on.
  • D. That would be a 2-fold split.

Question 4Medium

A grid search over 3 values of C and 4 values of gamma with 5-fold CV trains how many models in total (excluding any final refit)?

  1. 12
  2. 60
  3. 20
  4. 15

Answer: B. 60

Explanation

3 x 4 = 12 combinations, each trained 5 times = 60.

Step-by-step solution

  1. Combinations: 3*4 = 12.
  2. Each runs 5 folds.
  3. 12 x 5 = 60.

Why the other options are wrong

  • A. This counts only parameter combinations, not the folds.
  • C. Multiplies 4 x 5 and forgets the 3 values of C.
  • D. Multiplies 3 x 5 and forgets the 4 values of gamma.

Question 5Medium

Why should the test set not be used to tune hyperparameters?

  1. The test set is always too small
  2. It leaks information, making the final score over-optimistic
  3. Hyperparameters cannot be tuned on any kind of data at all
  4. It makes the model underfit

Answer: B. It leaks information, making the final score over-optimistic

Explanation

If you pick settings by looking at test performance, the test set stops being unseen and no longer estimates real-world performance.

Step-by-step solution

  1. Tune on validation or CV folds.
  2. Touch the test set only once at the end.
  3. Otherwise the estimate is biased upwards.

Why the other options are wrong

  • A. Size is not the issue; leakage is.
  • C. They are tuned on a validation set or CV.
  • D. Leakage causes optimistic estimates, not underfitting.

Question 6Hard

Which is a data-leakage mistake?

  1. Fitting a scaler on the full dataset before splitting into train and test
  2. Fitting a scaler on the training data and applying it to the test data
  3. Using stratified splits
  4. Holding out a validation set

Answer: A. Fitting a scaler on the full dataset before splitting into train and test

Explanation

Computing mean and standard deviation on all rows lets test-set statistics influence training; fit on train only.

Step-by-step solution

  1. Split first.
  2. Fit the scaler on train only.
  3. Transform both train and test with it.

Why the other options are wrong

  • B. This is the correct procedure.
  • C. Stratification does not leak test information.
  • D. Holding out data is the opposite of leakage.

Practise all 6 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 →

Related topics

See all Machine Learning topics · All topics