Unit 14: Machine learning algorithms - Practice Quiz

ECAP776 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What type of value does linear regression usually predict?

Linear regression Easy
A. A collection of clusters
B. A continuous numerical value
C. A set of decision rules
D. A sequence of labels

2 What does a simple linear regression model fit to the data?

Linear regression Easy
A. A branching tree
B. A circular boundary
C. A straight line
D. A group of centroids

3 In the equation , what does represent?

Linear regression Easy
A. The predicted class
B. The clustering distance
C. The number of samples
D. The slope of the line

4 Which measure is commonly minimized when fitting a linear regression model?

Linear regression Easy
A. Number of clusters
B. Depth of the tree
C. Sum of squared errors
D. Count of neighbours

5 What does the in K-nearest neighbours represent?

K-nearest neighbours Easy
A. The number of clusters produced
B. The number of trees constructed
C. The number of nearby data points considered
D. The number of output variables predicted

6 How does K-nearest neighbours commonly classify a new data point?

K-nearest neighbours Easy
A. By fitting a regression line
B. By selecting a random class
C. By building several trees
D. By taking a neighbour vote

7 Which calculation is commonly used to find nearest neighbours?

K-nearest neighbours Easy
A. Regression slope
B. Euclidean distance
C. Cluster count
D. Tree depth

8 Why are features often scaled before applying K-nearest neighbours?

K-nearest neighbours Easy
A. To remove every outlier
B. To create additional classes
C. To balance distance contributions
D. To increase the sample count

9 What does an internal node in a decision tree usually represent?

Decision trees Easy
A. A group of centroids
B. A fitted regression line
C. A final predicted value
D. A test on a feature

10 What does a leaf node in a classification tree usually provide?

Decision trees Easy
A. A predicted class
B. A feature scaling rule
C. A distance measurement
D. A cluster centroid

11 Which structure best describes a decision tree?

Decision trees Easy
A. A hierarchy of branches
B. A collection of centroids
C. A table of distances
D. A single straight line

12 What is pruning used for in a decision tree?

Decision trees Easy
A. Adding more training rows
B. Creating additional features
C. Increasing every branch depth
D. Removing unnecessary branches

13 A random forest is mainly made up of multiple what?

Random forests Easy
A. Distance matrices
B. Decision trees
C. Cluster centroids
D. Regression lines

14 How does a random forest commonly make a classification prediction?

Random forests Easy
A. It uses the trees' majority vote
B. It averages all feature values
C. It selects the nearest centroid
D. It follows the deepest tree only

15 Why is randomness introduced when building a random forest?

Random forests Easy
A. To eliminate all training data
B. To create varied decision trees
C. To produce a single cluster
D. To force identical tree structures

16 Compared with one deep decision tree, a random forest often helps reduce what?

Random forests Easy
A. The range of labels
B. The number of features
C. The risk of overfitting
D. The need for predictions

17 What type of machine learning algorithm is K-means?

K-means clustering Easy
A. An unsupervised clustering algorithm
B. A supervised classification algorithm
C. A supervised regression algorithm
D. A rule-based sorting algorithm

18 What does represent in K-means clustering?

K-means clustering Easy
A. The number of clusters
B. The number of labels
C. The number of trees
D. The number of features

19 What is a centroid in K-means clustering?

K-means clustering Easy
A. The nearest labeled neighbour
B. The deepest branch of a tree
C. The slope of a fitted line
D. The center of a cluster

20 How is a data point commonly assigned to a cluster in K-means?

K-means clustering Easy
A. By choosing a random tree
B. By following a class label
C. By finding the nearest centroid
D. By selecting the largest cluster

21 A fitted linear regression model is . What prediction does it make when ?

Linear regression Medium
A.
B.
C.
D.

22 A linear regression model is trained by minimizing mean squared error. What is the most likely effect of adding one extreme response-value outlier?

Linear regression Medium
A. It may strongly shift the fitted line
B. It removes the need for an intercept
C. It guarantees a horizontal fitted line
D. It converts the model into a classifier

23 The relationship between two variables is . If the feature is transformed to , which equation expresses in terms of ?

Linear regression Medium
A.
B.
C.
D.

24 A developer standardizes features before fitting linear regression and then evaluates the model on a test set. Which procedure best prevents data leakage?

Linear regression Medium
A. Fit the scaler on all data before splitting
B. Fit the scaler on training data only
C. Fit separate models before standardizing
D. Fit the scaler on test data only

25 Using Euclidean distance, which training point is nearest to the query point ?

K-nearest neighbours Medium
A.
B.
C.
D.

26 A K-nearest neighbours classifier overfits noisy training data when . What is the most appropriate adjustment?

K-nearest neighbours Medium
A. Remove all distance calculations
B. Decrease to sharpen the boundary
C. Increase to smooth the boundary
D. Replace labels with feature means

27 For a query sample, the five nearest neighbours have class labels A, B, A, B, and A. With uniform voting, what class is predicted?

K-nearest neighbours Medium
A. Class B
B. Class A
C. Both classes
D. Neither class

28 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?

K-nearest neighbours Medium
A. To guarantee perfectly balanced classes
B. To prevent income from dominating distance
C. To eliminate the choice of
D. To make every neighbour equally distant

29 A node contains six samples from class A and four from class B. What is its Gini impurity?

Decision trees Medium
A.
B.
C.
D.

30 A decision tree achieves 100% training accuracy but much lower validation accuracy. Which change is most likely to improve generalization?

Decision trees Medium
A. Reduce the maximum tree depth
B. Duplicate every training example
C. Increase the maximum tree depth
D. Remove the validation examples

31 A decision-tree node tests whether temperature <= 20. A sample has temperature = 20. Which branch does it follow?

Decision trees Medium
A. Both branches with equal weight
B. The branch where the condition is true
C. Neither branch until retraining
D. The branch where the condition is false

32 What is the likely effect of increasing min_samples_leaf when training a decision tree?

Decision trees Medium
A. It forces every leaf to be pure
B. It changes classification into clustering
C. It creates fewer, larger leaf nodes
D. It creates more, smaller leaf nodes

33 Which training strategy is central to a random forest?

Random forests Medium
A. Train linear models on sequential residuals
B. Train one tree repeatedly on identical data
C. Train trees on bootstrap samples and feature subsets
D. Train clusters using randomly selected centroids

34 How does a random forest typically produce a final classification prediction?

Random forests Medium
A. It uses the majority vote of its trees
B. It averages all original feature values
C. It chooses the label of one random tree
D. It selects the prediction of the deepest tree

35 What are out-of-bag samples for a particular tree in a random forest?

Random forests Medium
A. Samples misclassified by every tree in the forest
B. Samples removed because they contain missing values
C. Samples omitted from that tree's bootstrap set
D. Samples created by averaging nearby observations

36 Why does averaging many relatively uncorrelated decision trees often improve predictions?

Random forests Medium
A. It reduces variance while retaining flexible patterns
B. It converts categorical features into numbers
C. It guarantees zero error on unseen data
D. It removes every source of prediction bias

37 Two K-means centroids are and . Using Euclidean distance, to which centroid is the point assigned?

K-means clustering Medium
A.
B. Neither centroid
C. Both centroids
D.

38 A K-means cluster contains the points , , and . What centroid is computed during the update step?

K-means clustering Medium
A.
B.
C.
D.

39 Which quantity does standard K-means attempt to minimize?

K-means clustering Medium
A. Classification error against known labels
B. Between-cluster sum of squared distances
C. Number of features in each cluster
D. Within-cluster sum of squared distances

40 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?

K-means clustering Medium
A. Sort all rows by the larger feature
B. Convert every feature into a class label
C. Set each initial centroid to zero
D. Scale the features to comparable ranges

41 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?

Linear regression Hard
A. Intercept and slope
B. Intercept and slope
C. Intercept and slope
D. Intercept and slope

42 The true population model is , where , , and is uncorrelated with both predictors. What is the population slope when is regressed only on ?

Linear regression Hard
A.
B.
C.
D.

43 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 ?

Linear regression Hard
A.
B.
C.
D.

44 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?

Linear regression Hard
A.
B. and must hold because ordinary least squares always selects the first collinear predictor
C.
D.

45 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?

K-nearest neighbours Hard
A. The prediction remains class A
B. The prediction remains class B
C. The prediction changes from B to A
D. The prediction changes from A to B

46 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?

K-nearest neighbours Hard
A. Class A, with total weight
B. Class B, with total weight
C. Neither class, because each has two neighbours
D. Class B, because its two neighbours have a smaller arithmetic mean distance and weighted KNN always uses only that mean

47 Two points are independently sampled from the uniform distribution on . As increases, what happens to the coefficient of variation of their squared Euclidean distance?

K-nearest neighbours Hard
A. It decreases proportionally to
B. It increases proportionally to
C. It remains exactly unchanged for every dimension
D. It converges to a positive constant

48 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?

K-nearest neighbours Hard
A. Class B using only zero-distance samples
B. Class A using all selected neighbours
C. Class A using the nearest nonzero sample
D. No class, because inverse-distance weighting cannot be made well-defined when any training distance equals zero

49 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?

Decision trees Hard
A.
B.
C.
D.

50 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?

Decision trees Hard
A. A stump, despite a perfect depth-2 tree existing
B. A perfect tree after splitting on either feature
C. A depth-1 tree with one pure child
D. A depth-2 tree because the algorithm evaluates all pairs of consecutive splits before applying its stopping criterion

51 Three candidate subtrees have training misclassification rates and leaf counts , , and . Which subtree minimizes the cost-complexity objective when ?

Decision trees Hard
A. All three subtrees have the same penalized objective
B. The subtree with rate and 2 leaves
C. The subtree with rate and 4 leaves
D. The subtree with rate and 8 leaves

52 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?

Decision trees Hard
A. The numerical threshold values at every node
B. The impurity value of each individual sample
C. The distances between samples and therefore every split margin
D. The candidate partitions and resulting predictions

53 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?

Random forests Hard
A.
B.
C.
D.

54 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?

Random forests Hard
A.
B.
C.
D.

55 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?

Random forests Hard
A. Trees become more correlated, reducing aggregation's variance benefit
B. Trees become less correlated, improving aggregation's variance benefit
C. Every tree becomes identical because bootstrap sampling no longer occurs when all predictors are considered at each split
D. Bootstrap samples become larger and include more unique observations

56 Which statement best compares impurity-based feature importance with held-out permutation importance in a random forest?

Random forests Hard
A. Impurity importance favors high-cardinality features; permutation importance can be masked by correlated predictors
B. Both measures are unbiased whenever the forest contains sufficiently many trees
C. Impurity importance measures causal effects, whereas permutation importance measures coefficients from an implicit linear model
D. Permutation importance favors high-cardinality features; impurity importance is unaffected by predictor correlation

57 A K-means cluster contains the points , , and . After updating its centroid optimally, what is this cluster's within-cluster sum of squared errors?

K-means clustering Hard
A.
B.
C.
D.

58 For the one-dimensional points , what is the minimum possible K-means objective when ?

K-means clustering Hard
A.
B.
C.
D.

59 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?

K-means clustering Hard
A. It remains unchanged because K-means automatically standardizes every feature before computing cluster assignments
B. It is divided by
C. It is multiplied by
D. It is multiplied by

60 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?

K-means clustering Hard
A.
B.
C.
D.