DA0-002 Data Analysis Practice Question
A data analyst is working with a dataset that contains a column 'purchase_date' stored as a string in the format 'YYYY-MM-DD'. The analyst needs to calculate the number of days between each purchase and the current date. Which data transformation is required?
⚠ Common exam trap
The trap here is thinking that string manipulation alone can compute date differences, but without a proper date type, calculations are error-prone and complex.
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
✓
Convert the string to a date data type.
Calculating the number of days between dates requires date arithmetic, which is only possible if the values are in a date data type. Converting the string to a date allows the use of built-in functions to compute differences. Other transformations like integer conversion or encoding do not support date calculations.
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 one-hot encoding to the string.
Why it's wrong here
One-hot encoding creates binary columns for each unique category, which is useful for categorical variables in machine learning. However, it does not enable date calculations; it would create many columns and lose the temporal ordering needed to compute day differences.
- ✗
Normalize the string values to a 0-1 range.
Why it's wrong here
Normalization scales numeric values to a range, typically 0-1. It is applied to numerical features to bring them to a common scale. It cannot be applied to date strings and would not facilitate date arithmetic; it would be meaningless for date data.
- ✗
Convert the string to an integer data type.
Why it's wrong here
Converting 'YYYY-MM-DD' to an integer would not preserve date semantics. The string contains hyphens and represents a calendar date, not a numeric value. Arithmetic on integers would not yield meaningful day differences without additional complex parsing.
- ✓
Convert the string to a date data type.
Why this is correct
To calculate the difference between dates, the string must be converted to a date data type so that date arithmetic can be performed. Many tools and languages provide functions to parse strings into dates, enabling subtraction to yield the number of days.
About these practice questions
This DA0-002 question is part of Courseiva's 1,004-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 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.