k-Means Q&A 20 Core Questions
Interview Prep

k-Means Clustering: Interview Q&A

Short questions and answers on k-means: centroids, inertia, choosing k, initialization and limitations.

Centroids Inertia Spherical Clusters Elbow Method
1 What is k-means clustering in one sentence? âš¡ Beginner
Answer: k-means partitions data into k clusters by assigning points to the nearest centroid and updating centroids as the mean of assigned points.
2 Is k-means supervised or unsupervised learning? âš¡ Beginner
Answer: k-means is an unsupervised learning algorithm used for clustering without labels.
3 What objective does k-means try to minimize? 📊 Intermediate
Answer: It minimizes the sum of squared distances (inertia) between points and their assigned cluster centroids.
4 Why is feature scaling important for k-means? 📊 Intermediate
Answer: k-means uses Euclidean distance, so unscaled features with larger ranges can dominate cluster assignments.
5 How do you choose the number of clusters k? 📊 Intermediate
Answer: Common approaches are the elbow method, silhouette score and domain knowledge about the data.
6 Why is initialization important in k-means? 🔥 Advanced
Answer: k-means can converge to local minima; poor initial centroids may lead to bad clustering solutions.
7 What is k-means++ initialization? 🔥 Advanced
Answer: k-means++ chooses initial centroids in a probabilistic, distance-aware way to spread them out and usually improve convergence.
8 What cluster shapes does k-means work best for? 📊 Intermediate
Answer: It works best for roughly spherical, similarly sized clusters separated in Euclidean space.
9 Why is k-means not ideal for clusters with different densities or non-spherical shapes? 🔥 Advanced
Answer: Because it uses mean-based centroids and Euclidean distance, it struggles with elongated, irregular or varying-density clusters.
10 Is k-means deterministic? âš¡ Beginner
Answer: No, with random initialization the result can vary; using multiple runs and k-means++ helps get more stable solutions.
11 What is inertia in k-means? 📊 Intermediate
Answer: Inertia is the sum of squared distances from each point to its assigned centroid; lower inertia implies tighter clusters.
12 Does k-means always reduce inertia as k increases? 📊 Intermediate
Answer: Yes, inertia never increases when you increase k, which is why you need methods like the elbow plot to pick a reasonable k.
13 Can k-means be used for image compression? âš¡ Beginner
Answer: Yes, by clustering pixel colors into k centroids and replacing each pixel with its centroid color, you reduce the color palette.
14 How does k-means handle outliers? 🔥 Advanced
Answer: Poorly—outliers can pull centroids away and distort clusters since means are sensitive to extreme values.
15 How do you evaluate clustering quality without labels? 🔥 Advanced
Answer: You can use internal indices like silhouette score, Davies–Bouldin index, or inspect cluster cohesion and separation.
16 Is k-means guaranteed to converge? 📊 Intermediate
Answer: It is guaranteed to converge in a finite number of steps, but possibly to a local minimum of the objective.
17 Can k-means be used with non-Euclidean distances? 🔥 Advanced
Answer: Standard k-means relies on Euclidean geometry; for other distances, methods like k-medoids are more appropriate.
18 How does mini-batch k-means differ from standard k-means? 🔥 Advanced
Answer: Mini-batch k-means updates centroids using small random batches of data, improving speed on large datasets with approximate results.
19 Give a practical use case for k-means. âš¡ Beginner
Answer: k-means is used for customer segmentation, image color quantization and clustering similar items in recommendation systems.
20 What is the key message to remember about k-means? âš¡ Beginner
Answer: k-means is a simple, fast clustering method that works well for well-separated, spherical clusters, but you must scale features and choose k and initialization carefully.

Quick Recap: k-Means

If you understand centroids, inertia, the effect of k and why shapes matter, you can discuss both strengths and weaknesses of k-means confidently in interviews.