Regression Questions with Answers

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

Sample questions

Question 1Easy

In simple linear regression y = 2x + 1, what is the predicted y for x = 4?

  1. 9
  2. 8
  3. 10
  4. 7

Answer: A. 9

Explanation

y = 2*4 + 1 = 9.

Step-by-step solution

  1. Plug x = 4.
  2. 2*4 = 8.
  3. 8 + 1 = 9.

Why the other options are wrong

  • B. Forgets the intercept.
  • C. Adds 2 instead of 1.
  • D. Computes 2*3+1 using x-1.

Question 2Easy

In simple linear regression y = a + b x, the parameter b represents

  1. the value of y when x is 0
  2. the change in y for a one-unit increase in x
  3. the average of x
  4. the error of the model

Answer: B. the change in y for a one-unit increase in x

Explanation

The slope b is the expected change in y per unit change in x; a is the intercept.

Step-by-step solution

  1. In y = a + b x, a is the intercept (value of y when x = 0).
  2. B is the slope.
  3. The slope is the change in y for a one-unit increase in x, so the answer is option B.

Why the other options are wrong

  • A. This describes the intercept a, not the slope b.
  • C. The average of x is not a model parameter.
  • D. The error is the residual, not a parameter of the line.

Tip: Slope = change in y per unit change in x; intercept = y when x = 0.

Question 3Medium

Logistic regression outputs a probability by applying which function to a linear score?

  1. ReLU
  2. sigmoid
  3. tanh followed by argmax only
  4. identity

Answer: B. sigmoid

Explanation

The sigmoid 1/(1+e^-z) maps any real score to (0,1). For z = 0 it gives 0.5.

Step-by-step solution

  1. Logistic regression computes a linear score z.
  2. The sigmoid function 1 / (1 + e^(−z)) maps z to a probability between 0 and 1.
  3. So the answer is sigmoid.

Why the other options are wrong

  • A. ReLU outputs values from 0 upwards, not a probability between 0 and 1.
  • C. Tanh gives values from −1 to 1, and argmax is not a probability function.
  • D. The identity function gives the raw score, which can be outside 0 to 1.

Tip: Logistic regression = linear score + sigmoid.

Question 4Medium

Two variables have a perfect negative linear relationship. Their Pearson correlation is

  1. -1
  2. 0
  3. 1
  4. -0.5

Answer: A. -1

Explanation

Perfect inverse linear dependence gives r = -1. r = 0 means no linear relationship.

Step-by-step solution

  1. Pearson correlation runs from −1 to +1.
  2. A perfect negative linear relationship has all points on a downward line.
  3. So the correlation is −1.

Why the other options are wrong

  • B. 0 means no linear relationship.
  • C. +1 means a perfect positive relationship.
  • D. −0.5 is a moderate negative correlation, not a perfect one.

Tip: r = +1 perfect up, −1 perfect down, 0 no linear link.

Question 5Medium

Ridge regression adds which penalty to the loss?

  1. The sum of absolute coefficients
  2. The number of samples multiplied by the learning rate
  3. The sum of residuals
  4. The sum of squared coefficients (L2)

Answer: D. The sum of squared coefficients (L2)

Explanation

The L2 penalty shrinks coefficients smoothly towards zero without usually making them exactly zero.

Step-by-step solution

  1. Loss = squared error + lambda * sum(w^2).
  2. Larger lambda means more shrinkage.
  3. Weights stay small but non-zero.

Why the other options are wrong

  • A. That is Lasso (L1).
  • B. Not part of the penalty.
  • C. That is part of the loss, not the penalty.

Question 6Medium

In ordinary least squares (OLS), the line is chosen to minimise

  1. The sum of absolute residuals
  2. The number of misclassified points
  3. The largest single residual
  4. The sum of squared residuals

Answer: D. The sum of squared residuals

Explanation

OLS picks coefficients that minimise the sum of (y - y_hat)^2.

Step-by-step solution

  1. Residual = y - y_hat.
  2. Square and sum them.
  3. Choose coefficients that minimise it.

Why the other options are wrong

  • A. That is least absolute deviations.
  • B. That is for classification.
  • C. That is a minimax fit, not OLS.

Question 7Medium

Which problem occurs when two input features in linear regression are almost perfectly correlated?

  1. Multicollinearity, which makes coefficients unstable
  2. Heteroscedasticity only
  3. Perfect fit guaranteed
  4. Underfitting that appears only because there are too many training samples

Answer: A. Multicollinearity, which makes coefficients unstable

Explanation

Coefficient estimates swing wildly because the model cannot separate each feature's individual effect.

Step-by-step solution

  1. Two features carry the same signal.
  2. Many coefficient combos fit equally well.
  3. Estimates become unstable.

Why the other options are wrong

  • B. That is non-constant error variance.
  • C. Correlation does not guarantee a perfect fit.
  • D. Multicollinearity is about correlated features.

Question 8Medium

Ordinary least squares chooses the parameters that minimise

  1. the sum of absolute residuals
  2. the largest residual
  3. the number of features
  4. the sum of squared residuals

Answer: D. the sum of squared residuals

Explanation

OLS minimises the sum of squared differences between actual and predicted values.

Step-by-step solution

  1. Ordinary least squares fits a line by minimising the error function.
  2. The error used is the sum of squared residuals.
  3. So the answer is the sum of squared residuals.

Why the other options are wrong

  • A. Absolute residuals are used by least absolute deviation methods, not OLS.
  • B. The largest residual is used in minimax fitting, not OLS.
  • C. The number of features is a model choice, not something OLS minimises.

Tip: OLS = least squares = minimise the sum of squared errors.

Question 9Hard

Data points (1,2), (2,4), (3,6) are fit by y = mx + c using least squares. What are m and c?

  1. m = 1, c = 1
  2. m = 2, c = 0
  3. m = 2, c = 1
  4. m = 0, c = 4

Answer: B. m = 2, c = 0

Explanation

All three points lie exactly on y = 2x, so the residuals are zero.

Step-by-step solution

  1. Slopes: (4-2)/(2-1) = 2.
  2. Intercept: 2 - 2*1 = 0.
  3. Check (3,6): 2*3 = 6.

Why the other options are wrong

  • A. This line gives (1,2), (2,3), (3,4), not the data.
  • C. This line is shifted by 1 from every point.
  • D. A horizontal line at the mean ignores the clear trend.

Question 10Hard

For the points (1,2), (2,4), (3,5), (4,8) the best-fit line is y = 1.9x. The R^2 value is approximately

  1. 0.96
  2. 0.90
  3. 1.00
  4. 0.76

Answer: A. 0.96

Explanation

Residuals are 0.1, 0.2, -0.7, 0.4, so SSE = 0.70; total sum of squares = 18.75. Then R^2 = 1 - 0.7/18.75 = 0.963.

Step-by-step solution

  1. The line y = 1.9x gives predictions 1.9, 3.8, 5.7 and 7.6.
  2. Residuals sum of squares = 0.01 + 0.04 + 0.49 + 0.16 = 0.70; total sum of squares about the mean 4.75 is 18.75.
  3. R² = 1 − 0.70 / 18.75 ≈ 0.963, which is about 0.96.

Why the other options are wrong

  • B. 0.90 is too low for these close points; the residuals are small.
  • C. 1.00 would need zero residuals, but the points do not sit exactly on the line.
  • D. 0.76 does not match the sum of squares calculation.

Tip: R² = 1 − (residual sum of squares / total sum of squares).

Practise all 15 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