Courseiva
Machine Learning and Deep LearningmediumMultiple ChoiceObjective-mapped

AI0-001 Machine Learning and Deep Learning Practice Question

A machine learning engineer is building a spam filter. The dataset contains 10,000 emails, of which 1,000 are spam. The engineer decides to use a Random Forest classifier. Which preprocessing step is most critical to ensure the model generalizes well to new, unseen emails?

⚠ Common exam trap

CompTIA often tests the concept of data leakage by presenting preprocessing steps that seem harmless but actually incorporate test set information, tricking candidates into thinking scaling or dimensionality reduction is always necessary for tree-based models.

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

Split the data into training and testing sets before any other preprocessing

Splitting the data into training and testing sets before any other preprocessing prevents data leakage. If preprocessing like normalization or PCA is applied to the entire dataset first, the test set information influences the training process, leading to overly optimistic performance estimates and poor generalization to new, unseen emails.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Apply Principal Component Analysis (PCA) to reduce dimensionality

    Why it's wrong here

    PCA may discard useful information and is not necessary for Random Forest.

  • Normalize the numerical features to have zero mean and unit variance

    Why it's wrong here

    Random Forest is not sensitive to feature scaling.

  • Split the data into training and testing sets before any other preprocessing

    Why this is correct

    Splitting first prevents data leakage and ensures realistic evaluation.

  • Encode all features using one-hot encoding

    Why it's wrong here

    One-hot encoding is not universally needed and may increase dimensionality unnecessarily.

About these practice questions

One of 754 original AI0-001 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AI0-001 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 AI0-001 exam.