Data Science Data Science Data Cleaning and Preparation Questions and Answers 2 — Questions and Answers
Question 1: Which technique is most appropriate for handling missing values in a time series dataset?
- Forward fill or interpolation (Correct answer)
- Deleting all rows with missing values
- Replacing with the global mean
- Ignoring missing values entirely
Correct answer: Forward fill or interpolation
Forward fill and interpolation preserve temporal continuity, making them ideal for time series data where adjacent values are related.
Question 2: What is the primary risk of removing outliers without domain knowledge?
- Losing valid but extreme observations that represent real phenomena (Correct answer)
- Improving model accuracy too much
- Reducing dataset size below minimum thresholds
- Creating new duplicate records
Correct answer: Losing valid but extreme observations that represent real phenomena
Outliers may represent genuine rare events, and removing them without understanding the domain can eliminate important signal from the data.
Question 3: When performing one-hot encoding on a categorical variable with 50 unique values, what problem is most likely to arise?
- The curse of dimensionality from creating too many sparse features (Correct answer)
- Loss of ordinal relationships between categories
- Automatic deletion of the original column
- Negative values appearing in the encoded columns
Correct answer: The curse of dimensionality from creating too many sparse features
One-hot encoding a high-cardinality feature creates 50 new binary columns, dramatically increasing dimensionality and sparsity.
Question 4: What does the term 'data leakage' refer to in the context of data preparation?
- Information from outside the training set improperly influencing model building (Correct answer)
- Sensitive data being exposed to unauthorized users
- Data being lost during transfer between systems
- Memory overflow during large dataset processing
Correct answer: Information from outside the training set improperly influencing model building
Data leakage occurs when information that would not be available at prediction time is used during training, leading to overly optimistic performance estimates.
Question 5: Which method is best suited for normalizing a feature that contains significant outliers?
- Robust scaling using median and interquartile range (Correct answer)
- Min-max scaling to the 0-1 range
- Z-score standardization using mean and standard deviation
- Log transformation followed by min-max scaling
Correct answer: Robust scaling using median and interquartile range
Robust scaling uses the median and IQR, which are resistant to outliers, unlike min-max or z-score methods that are heavily influenced by extreme values.
Question 6: What is the correct order of operations when preparing a dataset with missing values and features requiring scaling?
- Impute missing values first, then apply feature scaling (Correct answer)
- Apply feature scaling first, then impute missing values
- Remove missing values and scaling simultaneously
- Scale only the complete cases and leave missing values as-is
Correct answer: Impute missing values first, then apply feature scaling
Imputation must occur before scaling because most scaling methods cannot handle missing values and would either error or produce misleading results.
Which technique is most appropriate for handling missing values in a time series dataset?