
This set of Machine Learning MCQs focuses on regression, the starting point of most ML courses. You will practise linear regression predictions, mean squared error, least squares and the normal equation, gradient descent updates and learning rate behaviour, and logistic regression with the sigmoid, odds and log loss. Several numerical questions mirror GATE DA, university semester papers and data science interview rounds, where quick hand calculation matters.
How to practise: read each question and tap the option you think is correct. You will see right away whether you got it, along with a short explanation, and your score is tracked at the bottom of the screen. This set has 18 questions.
Topics covered in this set
- Linear regression and least squares
- Cost functions: MSE, MAE and R^2
- Gradient descent variants and learning rate
- Normal equation and feature scaling
- Logistic regression, sigmoid and odds
- Cross-entropy (log loss) and decision boundary
Machine Learning MCQs with answers and explanations
Q1. A fitted linear regression model is y = 2 + 3x. What is the predicted value of y when x = 4?
a) 12
b) 10
c) 14
d) 18
Q2. The actual values are 3, 5, 7 and a model predicts 2, 5, 9. What is the mean squared error (to two decimals)?
a) 1.67
b) 1.00
c) 5.00
d) 1.29
Q3. In gradient descent, a weight currently equals 2.0, the gradient of the loss with respect to it is 4.0 and the learning rate is 0.1. What is the weight after one update?
w_new = w - alpha * dJ/dw
a) 2.4
b) 2.0
c) 0.4
d) 1.6
Q4. While training with gradient descent, the loss keeps increasing and oscillating wildly from one iteration to the next. What is the most likely cause?
a) The learning rate is too small
b) The learning rate is too large
c) The model has too few features
d) The data is perfectly linearly separable
Q5. Using ordinary least squares on the points (1, 2), (2, 4) and (3, 5), what is the slope of the best-fit line?
a) 1.5
b) 2.0
c) 1.0
d) 1.67
Q6. What is the value of the sigmoid function at z = 0?
sigmoid(z) = 1 / (1 + e^(-z))
a) 0
b) 1
c) 0.5
d) 0.25
Q7. A logistic regression model has intercept -1 and a single weight 0.5. For an input x = 4, what is the predicted probability of the positive class (approximately)?
a) 0.50
b) 0.73
c) 0.88
d) 0.27
Q8. Why is the squared-error cost usually not used to train logistic regression?
a) It cannot be computed for probabilities
b) It always gives zero gradient
c) It requires labels to be continuous
d) Combined with the sigmoid it gives a non-convex cost with many local minima
Q9. For a single example with true label y = 1, a classifier predicts probability p = 0.8. What is the binary cross-entropy loss (natural log)?
L = -[y ln(p) + (1 - y) ln(1 - p)]
a) 0.223
b) 0.200
c) 1.609
d) 0.040
Q10. What is the maximum value of the derivative of the sigmoid function, and where does it occur?
a) 1 at z = 0
b) 0.5 at z = 0
c) 0.25 at z = 0
d) 0.25 as z tends to infinity
Q11. Which expression gives the closed-form normal equation solution for linear regression weights?
a) theta = X^T X y
b) theta = (X^T X)^(-1) X^T y
c) theta = X^(-1) y^T
d) theta = (X X^T)^(-1) y
Q12. A regression model has residual sum of squares 20 and total sum of squares 100 on a dataset. What is its coefficient of determination R^2?
a) 0.20
b) 0.25
c) 1.25
d) 0.80
Q13. How does stochastic gradient descent (SGD) differ from batch gradient descent?
a) SGD updates parameters using the gradient from one training example at a time
b) SGD computes the exact gradient over the full dataset per update
c) SGD does not need a learning rate
d) SGD can only be used for linear models
Q14. A logistic regression model outputs P(y = 1) = 0.8 for some input. What are the odds in favour of the positive class?
a) 0.8
b) 4
c) 0.25
d) 1.39
Q15. For a logistic regression model with weights w and bias b, what is the shape of the decision boundary in feature space (threshold 0.5)?
a) A circle centred at the origin
b) A sigmoid-shaped curve
c) The hyperplane w^T x + b = 0
d) A set of axis-parallel rectangles
Q16. Why is feature scaling often recommended before running gradient descent on linear regression?
a) It makes the cost contours more circular, so gradient descent converges faster
b) It changes the optimal predictions of the model
c) It removes the need for an intercept term
d) It turns a non-convex cost into a convex one
Q17. Two input features in a linear regression model are almost perfectly correlated. What is the most likely consequence?
a) The training error becomes exactly zero
b) Gradient descent cannot be used at all
c) The model automatically drops one feature
d) Coefficient estimates become unstable with large variances
Q18. A dataset contains a few extreme outliers in the target variable. Which loss function is less sensitive to them?
a) Mean squared error
b) Mean absolute error
c) Squared hinge loss
d) Sum of squared residuals
Quick revision notes
- Linear regression: y_hat = w^T x + b; MSE = (1/n) * sum (y - y_hat)^2.
- Gradient descent update: w := w - alpha * dJ/dw (alpha = learning rate).
- Too large alpha: divergence/oscillation; too small alpha: very slow convergence.
- Normal equation: theta = (X^T X)^(-1) X^T y, no learning rate, costly for many features.
- R^2 = 1 - SS_res / SS_tot.
- Sigmoid: s(z) = 1/(1 + e^(-z)); s(0) = 0.5; s'(z) = s(z)(1 - s(z)), max 0.25.
- Logistic regression models log-odds: ln(p/(1-p)) = w^T x + b.
- Binary cross-entropy: -[y ln p + (1 - y) ln(1 - p)].
Frequently asked questions
Is logistic regression a regression or a classification algorithm?
It is used for classification. It is called regression because it fits a linear model to the log-odds of the positive class, and then converts that score to a probability with the sigmoid function.
How do I choose a good learning rate for gradient descent?
Try values on a log scale such as 0.001, 0.01 and 0.1 and plot the loss over iterations. Pick the largest value for which the loss decreases smoothly without oscillating or diverging.
When should I use the normal equation instead of gradient descent?
The normal equation is convenient when the number of features is small, since it gives the exact solution in one step. For many features or very large datasets, inverting X^T X becomes expensive and gradient descent scales better.
Comments
Post a Comment