Sample questions
Question 1Easy
Predicting whether a tumour is malignant or benign is an example of:
- Classification
- Dimensionality reduction
- Regression
- Clustering
Answer: A. Classification
Explanation
The output is a discrete category. Regression predicts continuous values, such as a price.
Step-by-step solution
- The output is one of two categories: malignant or benign.
- Predicting a category is classification.
- 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?
- 0.73
- 1
- 0.5
- 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
- Probability =
sigmoid(z) = 1 / (1 + e^(-z)).
- With z = 0, e^0 = 1.
- 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?
- Hinge loss
- Mean squared error
- Cross-entropy
- Accuracy
Answer: B. Mean squared error
Explanation
Ordinary least squares minimises the mean of squared differences between predictions and targets.
Step-by-step solution
- Linear regression predicts continuous values.
- Mean squared error averages the squared differences between predictions and truth.
- 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?
- Sorts the predictions from the most to the least confident
- Maps any real number to a value between 0 and 1
- Maps values to either -1 or 1
- 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
- Sigmoid(z) = 1 / (1 + e^(-z)).
- Large positive z gives values near 1; large negative z gives values near 0.
- 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)?
- Training becomes slow
- The decision boundary becomes a straight line
- The model always underfits, because each prediction ignores most of the data
- 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
- With k = 1, each prediction copies the label of the single nearest point.
- A noisy or mislabelled point then decides predictions around it.
- 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?
- 2
- 1
- 3
- 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
- Predictions: y(1) = 3, y(2) = 5, y(3) = 7.
- Errors: 3 - 2 = 1, 5 - 4 = 1, 7 - 6 = 1.
- 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?
- They find the boundary with the maximum margin between classes
- They grow a tree of decision rules, splitting on one feature at a time
- They assign classes by majority vote of neighbours
- 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
- An SVM finds the separating boundary furthest from the nearest points of each class.
- Those nearest points are the support vectors.
- 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?
- The model's error is 0.85
- The model is correct 85% of the time
- The model explains 85% of the variance in the target
- 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
- R-squared = 1 - (residual variance / total variance).
- 0.85 means 85% of the variation in the target is explained by the model.
- 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 →