mediumMultiple Choice
MLA-C01 Practice Question: A data scientist is working with a dataset…
A data scientist is working with a dataset containing a categorical feature 'country' with 200 unique values. They plan to use a linear regression model. Which encoding method is most suitable to avoid the dummy variable trap while maintaining interpretability?
⚠ Common exam trap
Candidates often mistakenly think one-hot encoding must include all categories, overlooking the dummy variable trap, or assume label encoding is acceptable for nominal data in linear models due to its simplicity.
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
✓
One-hot encoding with dropping the first category
One-hot encoding with dropping the first category is the most suitable method because it creates binary columns for each category except one, avoiding perfect multicollinearity (the dummy variable trap) while preserving interpretability. Each coefficient directly represents the effect of that category relative to the dropped reference category, which is intuitive for linear regression.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Binary encoding
Why it's wrong here
Binary encoding converts the 200 countries into roughly eight bit columns, so individual coefficients represent bit positions rather than countries, destroying interpretability. It is tempting because it compresses high-cardinality features, and would be correct for tree ensembles or memory-constrained pipelines where per-category meaning is not required.
- ✗
Target encoding
Why it's wrong here
Target encoding replaces each country with a statistic derived from the target variable, which leaks label information into training and yields coefficients that no longer express a per-country effect. It is tempting for high-cardinality features, and would suit gradient-boosted trees, but not an interpretable linear model.
- ✗
Label encoding
Why it's wrong here
Label encoding assigns arbitrary integers to countries, imposing a false ordinal ranking that linear regression treats as a single numeric slope, so it cannot represent 200 distinct effects. It is tempting because it is compact, and would be correct for tree-based models, which split on integer thresholds.
- ✓
One-hot encoding with dropping the first category
Why this is correct
One-hot encoding creates a binary column per country, and dropping one category avoids perfect multicollinearity — the dummy variable trap — which would make linear regression coefficients unstable. Retaining 199 columns preserves interpretability, unlike target or ordinal encoding, which impose false ordering on nominal country values.
Go deeper
Related to this question
About these practice questions
This MLA-C01 question is part of Courseiva's 665-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 MLA-C01 practice question is part of Courseiva's free Amazon Web Services 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 MLA-C01 exam.