Home / ML Associate practice test / Data Processing / Question

Databricks Machine Learning Associate · free practice question

A data scientist is working with a dataset containing two columns with missing values: temperature_reading (a continuous numeric feature with a symmetric…

Exam-style question on Data Processing from the free ML Associate practice test, with the answer and a full explanation below.

Updated November 10, 2026

Data Processing

A data scientist is working with a dataset containing two columns with missing values: temperature_reading (a continuous numeric feature with a symmetric, bell-shaped distribution) and product_color (a nominal categorical string feature). Which combination of imputation strategies is most appropriate for each column?

  1. AImpute temperature_reading with the mode, selecting the most common temperature value as the replacement for all missing readings, and impute product_color with the mean after converting color names to integer codes using label encoding — the mean of the encoded integers approximates the most central category in the encoded space
  2. BImpute both temperature_reading and product_color with the median, since the median is the universally most robust imputation method for all feature types and distributions — it resists skewness for continuous features and can be computed on integer-encoded categorical columns without requiring knowledge of the data type
  3. CImpute temperature_reading with the median and product_color with the mean of integer-encoded color values — the median handles all continuous features robustly regardless of distribution shape, and the mean of integer codes provides a numeric central tendency estimate that maps back to the closest category label after rounding
  4. DImpute temperature_reading with the mean because its symmetric bell-shaped distribution ensures the mean equals the median and provides an unbiased, efficient estimate of central tendency; impute product_color with the mode, because the mode — the most frequently occurring color — is the only statistically valid measure of central tendency for nominal categorical data
  5. EImpute both columns with the mean after encoding categorical values as integers, because mean imputation is the default strategy in most machine learning frameworks including PySpark's Imputer class, and using a single consistent strategy across all columns simplifies pipeline design and avoids the need for per-column strategy selection
Answer & explanation

Correct answer: D

WHY D: For temperature_reading — a symmetric continuous distribution — the mean equals the median and is the most efficient unbiased estimator of central tendency, making it appropriate for imputation. For product_color — a nominal categorical feature — arithmetic operations like mean and median are undefined; only the mode (most frequent category) is a valid measure of central tendency for nominal data. WHY NOT A: Using mode for a symmetric continuous feature ignores the full distributional information; using mean of label-encoded nominal categories is statistically invalid because integer codes have no numeric meaning. WHY NOT B: The median cannot be meaningfully computed for nominal categorical strings; PySpark's Imputer explicitly does not support categorical (string) columns. WHY NOT C: Same problem as A — computing mean of label-encoded nominal values produces results that depend entirely on arbitrary encoding order and are statistically meaningless. WHY NOT E: While mean is PySpark Imputer's default, the documentation explicitly warns that the Imputer does not support categorical features and may produce incorrect values for them; applying mean imputation to nominal string columns is incorrect.

Take the full ML Associate practice test free →

Would you pass today?

This question is one of 45 in the free, timed Databricks Machine Learning Associate practice test. Take it and get a section-by-section score.

Start the free test →