Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
You're offline
Unit 14 MCQsMachine learning algorithms
ECAP776 ·
60 questions. Pick an option to check it.
What type of value does linear regression usually predict?
Not quite. Try another option.
Answer: A continuous numerical value
Linear regression predicts continuous numerical values, such as price, temperature, or salary.
Question 2 of 60 · Linear regression · Easy
What does a simple linear regression model fit to the data?
Not quite. Try another option.
Answer: A straight line
Simple linear regression fits a straight line that describes the relationship between two variables.
Question 3 of 60 · Linear regression · Easy
In the equation , what does represent?
Not quite. Try another option.
Answer: The slope of the line
In , is the slope, which shows how much changes when increases by one unit.
Question 4 of 60 · Linear regression · Easy
Which measure is commonly minimized when fitting a linear regression model?
Not quite. Try another option.
Answer: Sum of squared errors
Linear regression commonly finds the line that minimizes the sum of squared differences between actual and predicted values.
Question 5 of 60 · K-nearest neighbours · Easy
What does the in K-nearest neighbours represent?
Not quite. Try another option.
Answer: The number of nearby data points considered
specifies how many nearby training examples are used to make a prediction.
Question 6 of 60 · K-nearest neighbours · Easy
How does K-nearest neighbours commonly classify a new data point?
Not quite. Try another option.
Answer: By taking a neighbour vote
K-nearest neighbours commonly assigns the class that appears most often among the nearest training points.
Question 7 of 60 · K-nearest neighbours · Easy
Which calculation is commonly used to find nearest neighbours?
Not quite. Try another option.
Answer: Euclidean distance
Euclidean distance measures the straight-line distance between data points and is commonly used in K-nearest neighbours.
Question 8 of 60 · K-nearest neighbours · Easy
Why are features often scaled before applying K-nearest neighbours?
Not quite. Try another option.
Answer: To balance distance contributions
Scaling prevents features with larger numerical ranges from dominating the distance calculation.
Question 9 of 60 · Decision trees · Easy
What does an internal node in a decision tree usually represent?
Not quite. Try another option.
Answer: A test on a feature
An internal node tests a feature and sends each example along a branch based on the result.
Question 10 of 60 · Decision trees · Easy
What does a leaf node in a classification tree usually provide?
Not quite. Try another option.
Answer: A predicted class
A leaf node represents the final output of the tree, such as a predicted class.
Question 11 of 60 · Decision trees · Easy
Which structure best describes a decision tree?
Not quite. Try another option.
Answer: A hierarchy of branches
A decision tree organizes tests and outcomes into a branching hierarchical structure.
Question 12 of 60 · Decision trees · Easy
What is pruning used for in a decision tree?
Not quite. Try another option.
Answer: Removing unnecessary branches
Pruning removes branches that add little value, making the tree simpler and reducing overfitting.
Question 13 of 60 · Random forests · Easy
A random forest is mainly made up of multiple what?
Not quite. Try another option.
Answer: Decision trees
A random forest combines predictions from many decision trees.
Question 14 of 60 · Random forests · Easy
How does a random forest commonly make a classification prediction?
Not quite. Try another option.
Answer: It uses the trees' majority vote
For classification, the trees vote, and the class receiving the most votes is usually selected.
Question 15 of 60 · Random forests · Easy
Why is randomness introduced when building a random forest?
Not quite. Try another option.
Answer: To create varied decision trees
Random samples and feature subsets create varied trees whose combined predictions are more robust.
Question 16 of 60 · Random forests · Easy
Compared with one deep decision tree, a random forest often helps reduce what?
Not quite. Try another option.
Answer: The risk of overfitting
Combining many varied trees generally reduces the overfitting associated with a single deep tree.
Question 17 of 60 · K-means clustering · Easy
What type of machine learning algorithm is K-means?
Not quite. Try another option.
Answer: An unsupervised clustering algorithm
K-means groups unlabeled data into clusters, so it is an unsupervised learning algorithm.
Question 18 of 60 · K-means clustering · Easy
What does represent in K-means clustering?
Not quite. Try another option.
Answer: The number of clusters
In K-means, is the number of clusters the algorithm attempts to form.
Question 19 of 60 · K-means clustering · Easy
What is a centroid in K-means clustering?
Not quite. Try another option.
Answer: The center of a cluster
A centroid is the representative center, usually the mean position, of the points in a cluster.
Question 20 of 60 · K-means clustering · Easy
How is a data point commonly assigned to a cluster in K-means?
Not quite. Try another option.
Answer: By finding the nearest centroid
K-means assigns each data point to the cluster whose centroid is nearest.
Question 21 of 60 · Linear regression · Medium
A fitted linear regression model is . What prediction does it make when ?
Not quite. Try another option.
Answer:
Substituting gives .
Question 22 of 60 · Linear regression · Medium
A linear regression model is trained by minimizing mean squared error. What is the most likely effect of adding one extreme response-value outlier?
Not quite. Try another option.
Answer: It may strongly shift the fitted line
Squared errors give large residuals substantial influence, so an extreme outlier can noticeably shift the fitted line.
Question 23 of 60 · Linear regression · Medium
The relationship between two variables is . If the feature is transformed to , which equation expresses in terms of ?
Not quite. Try another option.
Answer:
Because , substitution gives .
Question 24 of 60 · Linear regression · Medium
A developer standardizes features before fitting linear regression and then evaluates the model on a test set. Which procedure best prevents data leakage?
Not quite. Try another option.
Answer: Fit the scaler on training data only
The scaler must learn its statistics only from training data and then apply those statistics to both sets.
Question 25 of 60 · K-nearest neighbours · Medium
Using Euclidean distance, which training point is nearest to the query point ?
Not quite. Try another option.
Answer:
Its distance is , which is smaller than the other distances.
Question 26 of 60 · K-nearest neighbours · Medium
A K-nearest neighbours classifier overfits noisy training data when . What is the most appropriate adjustment?
Not quite. Try another option.
Answer: Increase to smooth the boundary
A larger bases predictions on more neighbours, reducing sensitivity to individual noisy samples.
Question 27 of 60 · K-nearest neighbours · Medium
For a query sample, the five nearest neighbours have class labels A, B, A, B, and A. With uniform voting, what class is predicted?
Not quite. Try another option.
Answer: Class A
Class A receives three votes, while class B receives two.
Question 28 of 60 · K-nearest neighbours · Medium
A K-nearest neighbours model uses age values from 18 to 70 and annual income values from 20,000 to 200,000. Why should these features usually be scaled?
Not quite. Try another option.
Answer: To prevent income from dominating distance
Without scaling, the much larger numerical range of income can dominate distance calculations.
Question 29 of 60 · Decision trees · Medium
A node contains six samples from class A and four from class B. What is its Gini impurity?
Not quite. Try another option.
Answer:
The impurity is .
Question 30 of 60 · Decision trees · Medium
A decision tree achieves 100% training accuracy but much lower validation accuracy. Which change is most likely to improve generalization?
Not quite. Try another option.
Answer: Reduce the maximum tree depth
Limiting depth reduces model complexity and can prevent the tree from fitting training noise.
Question 31 of 60 · Decision trees · Medium
A decision-tree node tests whether temperature <= 20. A sample has temperature = 20. Which branch does it follow?
Not quite. Try another option.
Answer: The branch where the condition is true
The value 20 satisfies the less-than-or-equal-to condition.
Question 32 of 60 · Decision trees · Medium
What is the likely effect of increasing min_samples_leaf when training a decision tree?
Not quite. Try another option.
Answer: It creates fewer, larger leaf nodes
A larger minimum leaf size prevents splits that would create small leaves, usually simplifying the tree.
Question 33 of 60 · Random forests · Medium
Which training strategy is central to a random forest?
Not quite. Try another option.
Answer: Train trees on bootstrap samples and feature subsets
Random forests combine bootstrap sampling with random feature selection to produce diverse decision trees.
Question 34 of 60 · Random forests · Medium
How does a random forest typically produce a final classification prediction?
Not quite. Try another option.
Answer: It uses the majority vote of its trees
For classification, individual tree predictions are commonly combined using majority voting.
Question 35 of 60 · Random forests · Medium
What are out-of-bag samples for a particular tree in a random forest?
Not quite. Try another option.
Answer: Samples omitted from that tree's bootstrap set
Bootstrap sampling leaves out some training examples, which can be used to estimate performance for that tree.
Question 36 of 60 · Random forests · Medium
Why does averaging many relatively uncorrelated decision trees often improve predictions?
Not quite. Try another option.
Answer: It reduces variance while retaining flexible patterns
Averaging diverse trees makes the ensemble less sensitive to fluctuations in the training data.
Question 37 of 60 · K-means clustering · Medium
Two K-means centroids are and . Using Euclidean distance, to which centroid is the point assigned?
Not quite. Try another option.
Answer:
The distance to is , while the distance to is .
Question 38 of 60 · K-means clustering · Medium
A K-means cluster contains the points , , and . What centroid is computed during the update step?
Not quite. Try another option.
Answer:
The centroid is the coordinate-wise mean: .
Question 39 of 60 · K-means clustering · Medium
Which quantity does standard K-means attempt to minimize?
Not quite. Try another option.
Answer: Within-cluster sum of squared distances
K-means minimizes the squared distance from each point to the centroid of its assigned cluster.
Question 40 of 60 · K-means clustering · Medium
A dataset has one feature measured from 0 to 1 and another from 0 to 100,000. What should usually be done before applying K-means?
Not quite. Try another option.
Answer: Scale the features to comparable ranges
Scaling prevents the feature with the larger numerical range from dominating Euclidean distances.
Question 41 of 60 · Linear regression · Hard
A simple linear regression with an intercept gives , , and slope . Define and . If is regressed on with an intercept, what are the new intercept and slope?
Not quite. Try another option.
Answer: Intercept and slope
The original line is . Since and , the transformed line is .
Question 42 of 60 · Linear regression · Hard
The true population model is , where , , and is uncorrelated with both predictors. What is the population slope when is regressed only on ?
Not quite. Try another option.
Answer:
The omitted-variable formula gives .
Question 43 of 60 · Linear regression · Hard
In an ordinary least-squares model, observation has , fitted value , and leverage . Without refitting the model directly, what is its leave-one-out predicted value ?
Not quite. Try another option.
Answer:
The leave-one-out residual is . Therefore, .
Question 44 of 60 · Linear regression · Hard
A regression with an intercept contains predictors satisfying exactly. If the uniquely estimable fitted linear effect is , which condition characterizes every coefficient pair producing those fitted values?
Not quite. Try another option.
Answer:
The predictor contribution is . Collinearity makes the individual coefficients nonunique.
Question 45 of 60 · K-nearest neighbours · Hard
A 1-NN classifier uses Euclidean distance. For query , the two training points are of class A and of class B. What happens if the second feature is multiplied by for both training and query data?
Not quite. Try another option.
Answer: The prediction changes from B to A
Originally, the distances are to A and to B. After scaling, they are to A and to B.
Question 46 of 60 · K-nearest neighbours · Hard
A distance-weighted 4-NN classifier assigns each neighbour weight . The neighbours have labels and distances A at , A at , B at , and B at . Which class is predicted?
Not quite. Try another option.
Answer: Class A, with total weight
Class A receives , while class B receives .
Question 47 of 60 · K-nearest neighbours · Hard
Two points are independently sampled from the uniform distribution on . As increases, what happens to the coefficient of variation of their squared Euclidean distance?
Not quite. Try another option.
Answer: It decreases proportionally to
The squared distance is a sum of independent terms. Its mean grows as and its standard deviation as , so their ratio scales as .
Question 48 of 60 · K-nearest neighbours · Hard
An inverse-distance KNN classifier encounters three training samples exactly at the query: two have class B and one has class A. Other nonzero-distance neighbours have class A. Under the standard zero-distance safeguard, what should it predict?
Not quite. Try another option.
Answer: Class B using only zero-distance samples
A common safeguard restricts voting to samples at zero distance whenever they exist. Their majority class is B, and finite-distance samples are ignored.
Question 49 of 60 · Decision trees · Hard
A binary-class node contains 6 positive and 4 negative samples. A candidate split creates a pure left child containing 4 positives and a right child containing 2 positives and 4 negatives. What is the Gini impurity decrease?
Not quite. Try another option.
Answer:
The parent impurity is . The weighted child impurity is , giving .
Question 50 of 60 · Decision trees · Hard
A balanced dataset has two independent binary features and target , with every input combination equally represented. A tree algorithm refuses splits having zero immediate information gain. What model does it learn at the root?
Not quite. Try another option.
Answer: A stump, despite a perfect depth-2 tree existing
Each feature alone leaves both children class-balanced, so its immediate gain is zero. A greedy rule rejecting zero-gain splits cannot reach the perfect second-level splits.
Question 51 of 60 · Decision trees · Hard
Three candidate subtrees have training misclassification rates and leaf counts , , and . Which subtree minimizes the cost-complexity objective when ?
Not quite. Try another option.
Answer: The subtree with rate and 4 leaves
The three objectives are , , and , respectively. Thus, the four-leaf subtree has the lowest penalized error.
Question 52 of 60 · Decision trees · Hard
A continuous feature is replaced by a strictly increasing transformation of itself before training an exact greedy decision tree. Assuming no missing values and deterministic tie handling, what is preserved?
Not quite. Try another option.
Answer: The candidate partitions and resulting predictions
A strictly increasing transformation preserves feature ordering, so threshold splits induce the same sample partitions. The numerical thresholds themselves generally change.
Question 53 of 60 · Random forests · Hard
Each tree in a random forest draws training observations with replacement from a dataset of size . As , what fraction of observations is expected to be out-of-bag for a particular tree?
Not quite. Try another option.
Answer:
An observation is excluded with probability , which converges to .
Question 54 of 60 · Random forests · Hard
Individual trees have prediction variance , and every pair of trees has prediction correlation . Assuming equal variance and covariance, what is the variance of the average prediction from 100 trees?
Not quite. Try another option.
Answer:
The ensemble variance is .
Question 55 of 60 · Random forests · Hard
A dataset contains one very strong predictor and many weak predictors. What is the likely effect of setting max_features equal to the total number of predictors at every split?
Not quite. Try another option.
Answer: Trees become more correlated, reducing aggregation's variance benefit
The strong predictor is repeatedly selected across trees. This increases tree correlation, weakening the variance reduction obtained by averaging.
Question 56 of 60 · Random forests · Hard
Which statement best compares impurity-based feature importance with held-out permutation importance in a random forest?
Not quite. Try another option.
Answer: Impurity importance favors high-cardinality features; permutation importance can be masked by correlated predictors
Features offering many split points can receive inflated impurity importance. Correlated predictors may substitute for one another, reducing each one's measured permutation effect.
Question 57 of 60 · K-means clustering · Hard
A K-means cluster contains the points , , and . After updating its centroid optimally, what is this cluster's within-cluster sum of squared errors?
Not quite. Try another option.
Answer:
The centroid is . The squared distances are , , and , whose sum is .
Question 58 of 60 · K-means clustering · Hard
For the one-dimensional points , what is the minimum possible K-means objective when ?
Not quite. Try another option.
Answer:
The optimal clusters are and . Their centroids are and , producing total squared error .
Question 59 of 60 · K-means clustering · Hard
A feature in a K-means dataset is multiplied by without changing other features. How does that feature's contribution to every squared Euclidean distance change?
Not quite. Try another option.
Answer: It is multiplied by
K-means uses squared differences. Replacing a difference by changes its contribution from to .
Question 60 of 60 · K-means clustering · Hard
During K-means++ initialization in one dimension, the first center is at . The remaining candidate observations are at , , and , each occurring once. What is the probability that is selected as the next center?
Not quite. Try another option.
Answer:
K-means++ samples in proportion to squared distance from the nearest center. The weights are , , and , so the probability is .
That's unit 14
Answer a few questions and your score shows up here.
Nearly through. Did unit 14 of ECAP776 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 14 of ECAP776 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.