DA0-002 Data Acquisition and Preparation Practice Question
A data analyst is cleaning a dataset and finds that some cells in the 'email' column contain leading spaces. Which string function should be used to remove these spaces?
⚠ Common exam trap
The trap is selecting LTRIM because the question mentions 'leading spaces,' but TRIM is the more complete and standard function for removing spaces from both ends, and exams often expect the general-purpose function.
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
✓
TRIM
The TRIM function removes leading and trailing spaces (and sometimes other whitespace) from a string, which directly addresses the leading spaces in the email column. In most SQL dialects and data tools, TRIM is the standard function for stripping both leading and trailing spaces, making it the correct choice for cleaning the data.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
TRIM
Why this is correct
TRIM removes leading and trailing whitespace characters from a string, directly eliminating the leading spaces found in the email column cells. Other string functions such as REPLACE or LTRIM target different patterns or only one side, whereas TRIM satisfies the exact cleaning requirement stated.
- ✗
LTRIM
Why it's wrong here
LTRIM removes leading spaces only, which matches this requirement, so it is not the failing option here; the question's expected answer is TRIM, which strips leading and trailing spaces. LTRIM would be correct when trailing whitespace must be preserved.
- ✗
REPLACE
Why it's wrong here
REPLACE substitutes every occurrence of a specified substring, so removing leading spaces would also delete interior or trailing ones unless nested in complex logic. It suits standardising known literals such as country codes, not trimming whitespace from one end of a value.
- ✗
SUBSTRING
Why it's wrong here
SUBSTRING extracts a positional slice of a string, so it cannot strip leading whitespace without hard-coded offsets. It is the right tool for parsing fixed-width fields or pulling characters between delimiters, but trimming requires a function that removes leading blanks specifically.
Go deeper
Related to this question
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 →
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.