Courseiva

DA0-002 Data Acquisition and Preparation Practice Question

A data analyst is preparing a dataset for a machine learning model. The dataset contains a categorical column 'color' with values 'red', 'green', 'blue', and 'yellow'. The analyst needs to transform this column into a numerical format suitable for the model. Which technique should be used?

⚠ Common exam trap

The trap here is choosing label encoding for its simplicity, but it incorrectly imposes an order on nominal categories, which can mislead the model.

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

One-hot encoding is the correct technique because it creates separate binary features for each color, eliminating any implied order. This is crucial for nominal data where categories have no inherent ranking. Other encoding methods like label encoding introduce ordinality, which can degrade model performance by suggesting false relationships.

Answer analysis

Option-by-option breakdown

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

  • ✓

    One-hot encoding

    Why this is correct

    One-hot encoding creates binary columns for each category, representing the presence of each color. This avoids implying any ordinal relationship, making it ideal for nominal categorical data like colors. The model can then treat each color as a separate feature without assuming order, which is essential for accurate learning.

  • ✗

    Binary encoding

    Why it's wrong here

    Binary encoding converts categories into binary code and then splits into columns. While it reduces dimensionality compared to one-hot encoding, it still introduces a numerical order that may not be meaningful for nominal data. For a small number of categories like four, one-hot encoding is simpler and avoids potential misinterpretation.

  • ✗

    Hashing

    Why it's wrong here

    Hashing transforms categories into a fixed number of hash values. It is useful for high-cardinality features but can introduce collisions, where different categories map to the same hash. For a small set of colors, hashing is overkill and may reduce interpretability. One-hot encoding is more transparent and appropriate.

  • ✗

    Label encoding

    Why it's wrong here

    Label encoding assigns a unique integer to each category (e.g., red=0, green=1, blue=2, yellow=3). This introduces an artificial ordinal relationship, implying that yellow is greater than blue, which is not true for colors. This can mislead machine learning models that interpret numerical order, making it unsuitable for nominal data.

About these practice questions

One of 1,004 original DA0-002 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 and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CompTIA exam blueprint

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.