DA0-002 Data Analysis Practice Question
A marketing analyst wants to segment customers based on purchasing behavior and demographics. The dataset includes continuous variables (spending amount, frequency) and categorical variables (region, gender). The analyst decides to use k-means clustering. What should the analyst do to prepare the data?
⚠ Common exam trap
Test-takers frequently assume k-means can natively handle mixed data types because it is a common clustering algorithm, but it strictly requires numerical input and scale normalization to avoid skewed distance calculations.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Standardize continuous variables and one-hot encode categorical variables
K-means clustering relies on Euclidean distance, which is sensitive to the scale of features. Standardizing continuous variables (e.g., spending amount, frequency) ensures they contribute equally to distance calculations, while one-hot encoding categorical variables (e.g., region, gender) converts them into numerical form without implying ordinal relationships, allowing k-means to process mixed data types correctly.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use raw data because k-means works with mixed types
Why it's wrong here
K-means computes Euclidean distance, so categorical fields such as region and gender cannot be averaged meaningfully; they must be encoded, typically one-hot, and continuous variables scaled. Raw mixed data would let spending magnitude dominate and treat category codes as ordered numbers. It suits purely numeric, similarly scaled datasets.
- ✓
Standardize continuous variables and one-hot encode categorical variables
Why this is correct
K-means computes Euclidean distance, so unstandardised continuous variables with larger ranges dominate. Standardising spending and frequency equalises their influence, while one-hot encoding converts region and gender into numeric binary columns, since k-means cannot process categorical labels directly.
- ✗
Apply PCA first to reduce dimensionality
Why it's wrong here
PCA can be applied after standardization, but it is not necessary for data preparation.
- ✗
Remove categorical variables entirely
Why it's wrong here
Dropping categorical fields discards the region and gender attributes the segmentation explicitly requires, leaving only continuous spending and frequency inputs. It is tempting because k-means computes Euclidean distance and cannot natively handle strings, so removal is a quick fix; one-hot encoding or k-prototypes would retain those variables instead.
Go deeper
Related to this question
About these practice questions
This DA0-002 question is part of Courseiva's 1,004-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DA0-002 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DA0-002 exam.