Regression & Classification Questions with Answers

8 practice questions on Regression & Classification (AI & Machine Learning) with answers and step-by-step solutions. Try 8 samples below, then practise all 8 free in the AptiNest app.

Sample questions

Question 1Easy

Predicting whether a tumour is malignant or benign is an example of:

  1. Classification
  2. Dimensionality reduction
  3. Regression
  4. Clustering

Answer: A. Classification

Explanation

The output is a discrete category. Regression predicts continuous values, such as a price.

Step-by-step solution

  1. The output is one of two categories: malignant or benign.
  2. Predicting a category is classification.
  3. Regression would predict a continuous number.

Why the other options are wrong

  • B. Dimensionality reduction compresses features; it does not predict a label.
  • C. Regression predicts continuous values, not categories.
  • D. Clustering groups unlabelled data; here the labels are known.

Tip: Category = classification; quantity = regression.

Question 2Easy

A logistic regression model computes z = w.x + b = 0 for an input. What probability does it output for the positive class?

  1. 0.73
  2. 1
  3. 0.5
  4. 0

Answer: C. 0.5

Explanation

sigmoid(0) = 1 / (1 + e^0) =
1 / 2 = 0.5, which lies exactly on the decision boundary.

Step-by-step solution

  1. Probability = sigmoid(z) = 1 / (1 + e^(-z)).
  2. With z = 0, e^0 = 1.
  3. So p = 1 / (1 + 1) = 0.5.

Why the other options are wrong

  • A. 0.73 is sigmoid(1), not sigmoid(0).
  • B. Sigmoid only approaches 1 for very large z.
  • D. Sigmoid only approaches 0 for very negative z.

Tip: sigmoid(0) = 0.5, always.

Question 3Easy

Which loss function is most commonly used for linear regression?

  1. Hinge loss
  2. Mean squared error
  3. Cross-entropy
  4. Accuracy

Answer: B. Mean squared error

Explanation

Ordinary least squares minimises the mean of squared differences between predictions and targets.

Step-by-step solution

  1. Linear regression predicts continuous values.
  2. Mean squared error averages the squared differences between predictions and truth.
  3. Minimising MSE gives the ordinary least squares solution.

Why the other options are wrong

  • A. Hinge loss is used for SVM classification.
  • C. Cross-entropy is used for classification probabilities.
  • D. Accuracy is a metric for classification, not a regression loss.

Tip: Regression -> MSE; classification -> cross-entropy.

Question 4Easy

What does the sigmoid function in logistic regression do?

  1. Sorts the predictions from the most to the least confident
  2. Maps any real number to a value between 0 and 1
  3. Maps values to either -1 or 1
  4. Squares the input to make it positive

Answer: B. Maps any real number to a value between 0 and 1

Explanation

sigmoid(z) = 1 / (1 + e^(-z)).

The model predicts class 1 when the probability exceeds a threshold, usually 0.5.

Step-by-step solution

  1. Sigmoid(z) = 1 / (1 + e^(-z)).
  2. Large positive z gives values near 1; large negative z gives values near 0.
  3. So any real number becomes a value in (0, 1), read as a probability.

Why the other options are wrong

  • A. Sigmoid transforms one value; it does not sort anything.
  • C. Mapping to -1 or 1 is the sign function; tanh gives values between -1 and 1.
  • D. Squaring is not what sigmoid does.

Question 5Medium

In k-Nearest Neighbours classification, what happens when k is very small (e.g. k = 1)?

  1. Training becomes slow
  2. The decision boundary becomes a straight line
  3. The model always underfits, because each prediction ignores most of the data
  4. The model becomes sensitive to noise and tends to overfit

Answer: D. The model becomes sensitive to noise and tends to overfit

Explanation

With k = 1 each prediction copies the single closest point, so noisy points create jagged boundaries. Larger k smooths the boundary but can underfit.

Step-by-step solution

  1. With k = 1, each prediction copies the label of the single nearest point.
  2. A noisy or mislabelled point then decides predictions around it.
  3. The boundary becomes very jagged: low bias, high variance, so overfitting.

Why the other options are wrong

  • A. kNN training is just storing data; k does not slow it.
  • B. Small k gives a jagged boundary, not a straight line.
  • C. Underfitting comes from very large k, not small k.

Tip: Small k = overfit, large k = underfit.

Question 6Medium

A model predicts y = 2x + 1. For data points (1, 2), (2, 4), (3, 6), what is the mean squared error?

  1. 2
  2. 1
  3. 3
  4. 0

Answer: B. 1

Explanation

Predictions are 3, 5, 7; each error is 1, so each squared error is 1. MSE = (1 + 1 + 1) / 3 = 1.

Step-by-step solution

  1. Predictions: y(1) = 3, y(2) = 5, y(3) = 7.
  2. Errors: 3 - 2 = 1, 5 - 4 = 1, 7 - 6 = 1.
  3. Squared errors: 1, 1, 1; mean = 3 / 3 = 1.

Why the other options are wrong

  • A. 2 would need squared errors summing to 6.
  • C. 3 is the sum of squared errors, not the mean.
  • D. The line misses every point by 1, so the error is not zero.

Question 7Hard

Which statement about Support Vector Machines (SVM) is correct?

  1. They find the boundary with the maximum margin between classes
  2. They grow a tree of decision rules, splitting on one feature at a time
  3. They assign classes by majority vote of neighbours
  4. They can only handle linearly separable data

Answer: A. They find the boundary with the maximum margin between classes

Explanation

SVMs maximise the margin to the closest points (support vectors). With kernels and soft margins they handle non-linear and overlapping data.

Step-by-step solution

  1. An SVM finds the separating boundary furthest from the nearest points of each class.
  2. Those nearest points are the support vectors.
  3. With kernels, SVMs also handle non-linearly separable data.

Why the other options are wrong

  • B. Splitting on one feature at a time describes decision trees.
  • C. Majority vote of neighbours describes kNN.
  • D. Kernels and soft margins let SVMs handle non-separable data.

Question 8Hard

What does an R-squared value of 0.85 indicate for a regression model?

  1. The model's error is 0.85
  2. The model is correct 85% of the time
  3. The model explains 85% of the variance in the target
  4. 85% of the predictions are within one unit of the truth

Answer: C. The model explains 85% of the variance in the target

Explanation

R^2 = 1 - SS_res / SS_tot compares the model's squared error with that of predicting the mean.

Step-by-step solution

  1. R-squared = 1 - (residual variance / total variance).
  2. 0.85 means 85% of the variation in the target is explained by the model.
  3. It is not an accuracy or error measurement.

Why the other options are wrong

  • A. R-squared is a proportion of explained variance, not an error value.
  • B. Regression has no 'correct' percentage; that is classification accuracy.
  • D. R-squared says nothing about errors within one unit.

Practise all 8 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 AI & Machine Learning topics · All topics