MLS-C01 Practice Question: Machine Learning Implementation and Operations
A data scientist is using Amazon SageMaker to train an XGBoost model on a dataset with missing values. The dataset has both numeric and categorical features. Which preprocessing step is MOST appropriate before training?
⚠ Common exam trap
Test-takers frequently assume missing values must always be imputed or rows removed, overlooking XGBoost's built-in missing value handling, and they may also confuse label encoding with one-hot encoding, thinking XGBoost can handle categorical features directly without encoding.
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 encode categorical features and let XGBoost handle missing values natively
XGBoost has a built-in mechanism to handle missing values by learning the best direction to split on during training, making explicit imputation unnecessary. One-hot encoding categorical features is required because XGBoost only accepts numeric inputs, and this encoding preserves the categorical information without imposing ordinal relationships. This approach avoids data leakage from imputation and leverages XGBoost's native sparsity-aware algorithm.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Impute missing numeric values with the mean and categorical values with the mode, then train without encoding
Why it's wrong here
Categorical features must be encoded; XGBoost requires numeric input.
- ✗
Remove all rows with missing values and train on the remaining data
Why it's wrong here
Removing rows reduces data size and may introduce bias.
- ✓
One-hot encode categorical features and let XGBoost handle missing values natively
Why this is correct
XGBoost handles missing values by default; one-hot encoding is appropriate for categorical data.
- ✗
Label encode categorical features and use the built-in missing value handling of XGBoost
Why it's wrong here
Label encoding can imply order; one-hot is safer.
Go deeper
Related to this question
About these practice questions
This MLS-C01 question is part of Courseiva's 1,672-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 MLS-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 MLS-C01 exam.