Clustering Questions with Answers

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

Sample questions

Question 1Easy

In k-means, what does k represent?

  1. The number of features
  2. The number of clusters
  3. The number of iterations
  4. The number of nearest neighbours

Answer: B. The number of clusters

Explanation

k is chosen in advance, e.g. using the elbow method or silhouette scores.

Step-by-step solution

  1. K-means partitions data into k groups.
  2. Each group has one centroid.
  3. So k is the number of clusters, chosen in advance.

Why the other options are wrong

  • A. The number of features is the data's dimensionality.
  • C. Iterations run until convergence and are not k.
  • D. Nearest neighbours is the k in kNN, a different algorithm.

Tip: k-means: k clusters. kNN: k neighbours.

Question 2Medium

What is the "elbow method" used for in k-means?

  1. Choosing k by plotting within-cluster error against k
  2. Initialising the centroids at points that are as far apart as possible
  3. Measuring cluster purity against labels
  4. Detecting outliers in a cluster

Answer: A. Choosing k by plotting within-cluster error against k

Explanation

Inertia always decreases as k grows; the bend (elbow) where improvement slows suggests a reasonable k.

Step-by-step solution

  1. Run k-means for k = 1, 2, 3, ...
  2. Plot within-cluster sum of squares (inertia) against k.
  3. Choose the k where the curve bends and gains flatten: the elbow.

Why the other options are wrong

  • B. Spreading the initial centroids apart is k-means++ initialisation.
  • C. Purity needs true labels; the elbow method uses none.
  • D. The elbow method chooses k, it does not find outliers.

Question 3Medium

What does a dendrogram show in hierarchical clustering?

  1. The ROC curve of the clustering
  2. The training loss after each epoch of the clustering algorithm
  3. The order and distance at which clusters are merged (or split)
  4. The centroid of each cluster

Answer: C. The order and distance at which clusters are merged (or split)

Explanation

Cutting the dendrogram at a chosen height gives a particular number of clusters.

Step-by-step solution

  1. Hierarchical clustering merges (or splits) clusters step by step.
  2. A dendrogram is a tree diagram of those merges.
  3. Branch height shows the distance at which clusters joined; cutting it at a height gives clusters.

Why the other options are wrong

  • A. ROC curves evaluate classifiers, not clusterings.
  • B. Hierarchical clustering has no epochs or training loss.
  • D. Centroids belong to k-means, not the dendrogram.

Question 4Medium

Which clustering algorithm can find arbitrarily shaped clusters and mark outliers as noise, without specifying the number of clusters?

  1. DBSCAN
  2. Gaussian mixture with 2 components
  3. K-medoids
  4. K-means

Answer: A. DBSCAN

Explanation

DBSCAN groups points in dense regions (eps, min_samples). K-means assumes roughly spherical clusters and needs k.

Step-by-step solution

  1. DBSCAN grows clusters from dense regions (points with enough neighbours within eps).
  2. Clusters can take any shape because they follow density.
  3. Points in sparse regions are labelled noise, and k is never specified.

Why the other options are wrong

  • B. A Gaussian mixture with 2 components fixes the cluster count and assumes elliptical shapes.
  • C. K-medoids needs k and favours compact, round clusters.
  • D. K-means needs k and assumes roughly spherical clusters.

Tip: Odd shapes + outliers + unknown k -> DBSCAN.

Question 5Medium

K-means with k = 2 is run on 1-D points 1, 2, 4, 5, 9 with initial centroids 1 and 5. After the first assignment and update step, what are the new centroids?

  1. 1.5 and 6
  2. 2.33 and 7
  3. 2 and 6
  4. 1 and 5

Answer: A. 1.5 and 6

Explanation

Assign each point to the nearer centroid:
- 1, 2 -> centroid 1 (4 is nearer to 5);
- 4, 5, 9 -> centroid 5.

New centroids are the means:
(1 + 2)/2 = 1.5 and (4 + 5 + 9)/3 = 6.

Step-by-step solution

  1. Assign each point to the nearer centroid (1 or 5).
  2. 1, 2 go to centroid 1; 4, 5, 9 go to centroid 5 (4 is 3 from 1 but 1 from 5).
  3. New centroids: (1 + 2) / 2 = 1.5 and (4 + 5 + 9) / 3 = 6.

Why the other options are wrong

  • B. 2.33 and 7 wrongly puts 4 in the first cluster.
  • C. 2 and 6 miscomputes the mean of 1 and 2.
  • D. These are the starting centroids; the update moves them.

Question 6Hard

Why is k-means sensitive to the initial choice of centroids?

  1. The number of clusters changes during training
  2. It always converges to the global minimum, so the start point affects only the speed
  3. It converges to a local minimum that depends on the start
  4. It does not use the centroids after initialisation

Answer: C. It converges to a local minimum that depends on the start

Explanation

Different initialisations can give different final clusters. k-means++ initialisation and multiple restarts (n_init) mitigate this.

Step-by-step solution

  1. K-means minimises within-cluster distance by local improvement steps.
  2. It stops at the first point where no step helps: a local minimum.
  3. Different starting centroids can lead to different final clusters.

Why the other options are wrong

  • A. k is fixed during training.
  • B. K-means is not guaranteed to reach the global minimum.
  • D. Centroids are updated every iteration.

Tip: Fix: multiple restarts (n_init) and k-means++ initialisation.

Practise all 6 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 AI & Machine Learning topics · All topics