Clustering Questions with Answers

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

Sample questions

Question 1Easy

In k-means, the value k represents

  1. the number of features
  2. the number of iterations
  3. the number of clusters
  4. the learning rate

Answer: C. the number of clusters

Explanation

k is chosen beforehand and fixes how many centroids and clusters are produced.

Step-by-step solution

  1. k-means splits the data into groups called clusters.
  2. The value k is set before training, and it is the count of those groups.
  3. So k is the number of clusters, option C.

Why the other options are wrong

  • A. The number of features is the number of input columns, not k.
  • B. The number of iterations is how many update rounds run, not k.
  • D. The learning rate belongs to gradient-based training, not to k-means.

Tip: In k-means, k is always the number of clusters.

Question 2Easy

k-means clustering requires you to specify in advance

  1. The class labels
  2. The number of clusters k
  3. The maximum depth
  4. The kernel type and its parameters for the chosen model

Answer: B. The number of clusters k

Explanation

You must choose k before running k-means; the elbow or silhouette method can guide the choice.

Step-by-step solution

  1. Choose k.
  2. Assign points to nearest centroid.
  3. Update centroids and repeat.

Why the other options are wrong

  • A. Clustering is unsupervised.
  • C. Depth is a tree parameter.
  • D. Kernels belong to SVMs.

Question 3Medium

k-means results can differ between runs mainly because

  1. it uses labels randomly
  2. it ignores distances
  3. initial centroids are chosen randomly and it may reach a local optimum
  4. it always uses the test set

Answer: C. initial centroids are chosen randomly and it may reach a local optimum

Explanation

k-means converges to a local minimum that depends on initialisation; k-means++ and multiple restarts help.

Step-by-step solution

  1. k-means starts with random centroids.
  2. Random centroids lead to different cluster assignments.
  3. Different clusters may result in local optima.
  4. Local optima are not guaranteed to be the best solution.
  5. So results vary between runs.

Why the other options are wrong

  • A. k-means does not use labels at all; it is unsupervised clustering.
  • B. k-means assigns points using distances to centroids, so ignoring distances is wrong.
  • D. k-means clusters the data it is given, not the test set, so this is not the reason.

Tip: Random initial centroids cause varying results in k-means.

Question 4Medium

Which clustering algorithm can find arbitrary-shaped clusters and label noise points?

  1. k-means
  2. Linear regression
  3. PCA
  4. DBSCAN

Answer: D. DBSCAN

Explanation

DBSCAN groups dense regions and marks sparse points as noise; k-means assumes roughly spherical clusters.

Step-by-step solution

  1. DBSCAN groups points that are packed closely together.
  2. It does not assume round or fixed-shape clusters, so it finds arbitrary shapes.
  3. Points in sparse areas are labelled as noise, so the answer is DBSCAN, option D.

Why the other options are wrong

  • A. k-means assumes roughly round clusters and gives every point a cluster, so it has no noise label.
  • B. Linear regression predicts a number and is not a clustering method.
  • C. PCA reduces the number of dimensions; it does not form clusters or label noise.

Tip: Density-based clustering (DBSCAN) finds odd shapes and marks noise. k-means and PCA do not.

Question 5Medium

The elbow method is used to

  1. choose a suitable number of clusters by plotting inertia against k
  2. choose the learning rate
  3. remove outliers automatically
  4. measure classification accuracy

Answer: A. choose a suitable number of clusters by plotting inertia against k

Explanation

Inertia always falls as k grows; the point where the decrease slows sharply (the elbow) suggests a good k.

Step-by-step solution

  1. The elbow method runs k-means for several values of k.
  2. It plots inertia (the within-cluster sum of squares) against k.
  3. The best k is where the curve bends like an elbow and extra clusters stop helping much, so option A.

Why the other options are wrong

  • B. The learning rate is not part of the elbow method.
  • C. Outlier removal is a separate step; the elbow method does not remove outliers.
  • D. The elbow method uses inertia, not classification accuracy.

Tip: Elbow method: plot inertia against k and pick the bend.

Question 6Medium

Points 1, 2, 9, 10 with initial centroids 1 and 10. After one k-means update, the centroids are

  1. 1 and 10
  2. 1.5 and 9.5
  3. 2 and 9
  4. 5.5 and 5.5

Answer: B. 1.5 and 9.5

Explanation

Assignment gives clusters {1,2} and {9,10}. The new centroids are their means: 1.5 and 9.5.

Step-by-step solution

  1. Point 1 and point 2 are nearer to centroid 1 (distance 0 and 1) than to centroid 10 (distance 9 and 8).
  2. Points 9 and 10 are nearer to centroid 10 (distance 1 and 0) than to centroid 1.
  3. New centroid for {1, 2} is (1 + 2) / 2 = 1.5; for {9, 10} it is (9 + 10) / 2 = 9.5.
  4. The new centroids are 1.5 and 9.5, option B.

Why the other options are wrong

  • A. Centroids move to the mean of their assigned points, so they do not stay at 1 and 10.
  • C. 2 and 9 do not match the means 1.5 and 9.5 of the assigned points.
  • D. 5.5 is the mean of all four points together, not a centroid after the assignment step.

Tip: One k-means update: assign each point to its nearest centroid, then move each centroid to the mean of its points.

Question 7Medium

Points 1, 2, 10 and 11 on a line are clustered by k-means with k=2. The final centroids are

  1. 1 and 11
  2. 5.5 and 5.5
  3. 2 and 10
  4. 1.5 and 10.5

Answer: D. 1.5 and 10.5

Explanation

Clusters {1,2} and {10,11} have means 1.5 and 10.5.

Step-by-step solution

  1. Natural groups: {1,2} and {10,11}.
  2. Mean of first: 1.5.
  3. Mean of second: 10.5.

Why the other options are wrong

  • A. These are extreme points, not cluster means.
  • B. Two centroids at the same point cannot form two clusters; the mean of all four points is 6, not 5.5.
  • C. These are the inner points rather than the means.

Question 8Medium

The within-cluster sum of squares for clusters {1,2} and {9,10} with centroids 1.5 and 9.5 is

  1. 0.5
  2. 1.0
  3. 2.0
  4. 81

Answer: B. 1.0

Explanation

Cluster 1: 0.25+0.25 = 0.5; cluster 2: 0.5; total 1.0.

Step-by-step solution

  1. Cluster {1, 2} has centroid 1.5: (1 - 1.5)^2 + (2 - 1.5)^2 = 0.25 + 0.25 = 0.5.
  2. Cluster {9, 10} has centroid 9.5: (9 - 9.5)^2 + (10 - 9.5)^2 = 0.25 + 0.25 = 0.5.
  3. Total within-cluster sum of squares is 0.5 + 0.5 = 1.0, option B.

Why the other options are wrong

  • A. 0.5 is only one cluster's sum; both clusters must be added.
  • C. 2.0 counts the squared distances twice as much as they should be.
  • D. 81 is far too large, because each point is only 0.5 away from its centroid.

Tip: WCSS: square each point's distance to its own centroid, then add everything up.

Question 9Medium

A silhouette score close to +1 for a point means

  1. The point is an outlier
  2. The point lies exactly on a boundary
  3. The point is in the wrong cluster and nearer to another one
  4. The point is well matched to its own cluster and far from others

Answer: D. The point is well matched to its own cluster and far from others

Explanation

Silhouette = (b - a)/max(a, b), where a is mean in-cluster distance and b is nearest other cluster distance.

Step-by-step solution

  1. a: distance to own cluster.
  2. b: distance to nearest other cluster.
  3. b much greater than a gives near +1.

Why the other options are wrong

  • A. Outliers tend to have low or negative scores.
  • B. That gives a score near 0.
  • C. That gives a negative score.

Question 10Hard

Which clustering algorithm can find arbitrarily shaped clusters and mark noise points without needing k?

  1. k-means
  2. Gaussian-mixture hard assignment
  3. DBSCAN
  4. Hierarchical clustering with a fixed cut at k

Answer: C. DBSCAN

Explanation

DBSCAN grows clusters from dense regions defined by eps and min points; sparse points become noise.

Step-by-step solution

  1. Pick eps and minPts.
  2. Core points have enough neighbours.
  3. Chain dense areas; leftovers are noise.

Why the other options are wrong

  • A. k-means needs k and prefers round clusters.
  • B. It needs the number of components and assumes Gaussian shapes.
  • D. Needs k for the cut and no noise label.

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