Data Processing: 5 DBX-MLA Questions with Full Explanations
5 questions, one domain: Data Processing from the Databricks Machine Learning Associate (DBX-MLA) exam. It carries about 19% of the exam score. Pick your answer, then check it against the explanation.

Databricks Machine Learning Associate (DBX-MLA) · Data Processing · 5 questions with answers and explanations
📊 About this set
Exam: DBX-MLA · 48 questions · 90 minutes
This set: 4 applied, 1 advanced · 2 scenario, 1 comparison, 1 concept check, 1 troubleshooting · 1 with more than one answer
Question 1 of 5
Which TWO statements about mean imputation of a numeric feature are true? (Select TWO)
Show answer
✅ Answer: A, E
Difficulty: advanced
What a constant fill does
Replacing every missing value with the mean adds rows exactly at the center. Hence the mean is unchanged, the variance falls (more rows with zero deviation), and the covariance with other features falls too, so correlations are weakened. This is a generally accepted statistical fact, which is why large amounts of missingness call for model-based imputation or an indicator column.
Spark detail
Imputer(strategy="mean") is the default and works on numeric columns only.
Why each option works or fails
• ✓ A. Mean unchanged (correct): adding values equal to the mean does not move the mean of the column.
• ✗ B. Row-specific values: mean imputation uses one value for the whole column; neighbor-based fills are a different method.
• ✗ C. Categorical columns: a mean of strings is undefined, and Spark's Imputer documents that it does not support categorical features.
• ✗ D. Strengthens correlations: a constant carries no co-movement with other features, so correlations weaken.
• ✓ E. Variance shrinks (correct): the new rows have zero deviation from the mean, so the spread of the column falls.
🎯 Key idea: Mean imputation keeps the mean, lowers variance and weakens correlations; use it sparingly.
Question 2 of 5
A practitioner wants to measure how strongly two continuous features, age and annual_income, move together in a Spark DataFrame, assuming a roughly linear relationship. Which statistic fits best?
Show answer
✅ Answer: D
Difficulty: applied
Two continuous features
For two numeric features the standard question is how strongly one changes with the other. The Pearson correlation coefficient measures the strength and direction of a linear relationship on a scale from -1 to 1; Spearman correlation does the same for rank (monotonic) relationships. These are generally accepted statistical definitions.
In Spark ML
pyspark.ml.stat.Correlation computes a correlation matrix over a vector column and supports the methods Pearson (default) and Spearman. The chi-squared test, by contrast, requires categorical features and labels.
Why each option works or fails
• ✗ A. Comparing modes: modes describe the most frequent value of each column separately and say nothing about how the two columns vary together.
• ✗ B. Chi-squared test: Spark's ChiSquareTest converts feature/label pairs into a contingency matrix and requires categorical values, so raw continuous columns do not fit.
• ✗ C. Distinct counts: cardinality describes each column separately and is unrelated to joint movement.
• ✓ D. Pearson correlation (correct): it gives a single number between -1 and 1 describing the linear association of the two continuous columns, and Spark ML computes it with Correlation.corr.
🎯 Key idea: Two continuous features are compared with correlation (Pearson for linear, Spearman for monotonic); chi-squared needs categorical data.
Question 3 of 5
A scheduled job must write the mean and the 75th percentile of amount into a Delta table. A teammate suggests running dbutils.data.summarize(df) in the job. Why is df.summary("mean", "75%") the better choice?
summary returns a DataFrame that can be saved, while summarize only displays resultssummary is the only call that reads the complete DataFrame, while summarize samples rowssummarize supports only pandas DataFrames, so it cannot be used with Sparksummarize computes only exact statistics, and the job needs approximate percentilesShow answer
✅ Answer: A
Difficulty: applied
Two ways to summarize
• DataFrame.summary() is a Spark API. It returns a DataFrame, so the statistics can be filtered, joined, or saved with .write.
• dbutils.data.summarize(df) is a notebook utility whose signature is summarize(df, precise): void. It calculates and displays summary statistics and a visualization for a Spark or pandas DataFrame, and returns nothing to use in code. The documentation marks this utility as a Public Preview feature and warns that it analyzes the complete contents of the DataFrame, so it can be expensive on very large DataFrames.
Where each belongs
Use dbutils.data.summarize for interactive exploration in a notebook. Use summary() (or aggregate functions) when the numbers must flow on to code, tables, or other steps.
Why each option works or fails
• ✓ A. (correct): summary("mean", "75%") yields a DataFrame with just the requested rows, which the job can save directly. The notebook utility only renders output for people to read.
• ✗ B. Full read versus sampling: the documentation says the utility analyzes the complete contents of the DataFrame. Sampling is not the difference.
• ✗ C. Pandas only: the utility works on Spark DataFrames and pandas DataFrames, so that is not the reason.
• ✗ D. Exact only: the utility works with approximations by default (precise is false), and exact results are an option. The premise is wrong.
🎯 Key idea: Use summary() when statistics must be consumed in code; dbutils.data.summarize is for display in notebooks.
Question 4 of 5
Which statement about pyspark.ml.feature.Imputer is correct?
Show answer
✅ Answer: A
Difficulty: applied
Imputer facts
From the Spark documentation: Imputer is an estimator that completes missing values using the mean, median or mode of the columns where values are missing. Input columns must be numeric; categorical features are not supported. The default strategy is mean. All nulls are treated as missing, and missingValue (default NaN) can be changed. The statistic is computed after filtering out missing values.
• Because it is an estimator, you call fit first and use the resulting ImputerModel to transform.
Why each option works or fails
• ✓ A. Mean, median and mode on numeric columns (correct): this matches the documented behavior, with mean the default strategy.
• ✗ B. Mean only on any type: median and mode are supported, and categorical columns are not.
• ✗ C. Transformer without fit: Imputer is an estimator whose fit computes the surrogate values.
• ✗ D. Median default on strings: the default is mean, and string columns are not supported.
🎯 Key idea: Imputer: numeric columns, strategy mean (default), median or mode; fit then transform.
Question 5 of 5
To remove outliers from price with the IQR rule, an engineer runs q1, q3 = df.approxQuantile("price", [0.25, 0.75], 0.01) and sets iqr = q3 - q1. Which filter keeps rows inside the standard fences?
df.filter(F.col("price").between(q1 - 1.5*iqr, q3 + 1.5*iqr))df.filter(F.col("price").between(q1 - 1.0 * iqr, q3 + 1.0 * iqr))df.filter(F.col("price").between(q1, q3))df.filter(F.col("price") >= q3 + 1.5 * iqr)Show answer
✅ Answer: A
Difficulty: applied
The IQR rule
The interquartile range is IQR = Q3 - Q1, the spread of the middle half of the data. The usual fences are:
• lower fence: Q1 - 1.5 * IQR
• upper fence: Q3 + 1.5 * IQR
Values outside the fences are treated as outliers. Because quartiles ignore the extreme tails, the fences hardly move when a few extreme values are added.
In Spark
DataFrame.approxQuantile(col, probabilities, relativeError) returns the quartiles as Python floats. A small relativeError such as 0.01 is a cheap approximation. Then between(lower, upper) keeps the rows inside the fences (it is inclusive).
Why each option works or fails
• ✓ A. (correct): The fences at Q1 - 1.5*IQR and Q3 + 1.5*IQR are the standard IQR bounds, and between keeps values inside both, so low and high outliers are removed.
• ✗ B. Multiplier of 1: fences at one IQR beyond the quartiles are tighter than the standard 1.5 and would mark many ordinary values as outliers.
• ✗ C. Between the quartiles: this keeps only the middle half of the data and discards 50% of the rows.
• ✗ D. Only the upper fence, inverted: this keeps values above the upper fence, which are the outliers themselves.
🎯 Key idea: IQR rule: keep values between Q1 - 1.5*IQR and Q3 + 1.5*IQR.
🔗 More from this exam
• 5 Questions to Test Your Databricks Machine Learning Knowledge (DBX-MLA)
• Can You Answer These 5 DBX-MLA Questions on Data Processing?
• Can You Answer These 5 DBX-MLA Questions on Databricks Machine Learning?
• All DBX-MLA practice sets
• Every exam on this blog
📚 More DBX-MLA practice
More DBX-MLA questions: https://hyunhp.github.io/cert-bank/#exam=DBX-MLA
Study guide: https://hyunhp.github.io/cert-bank/study.html#exam=DBX-MLA
These are original practice questions, not real exam questions, and cert-bank is not affiliated with any certification vendor.
Original practice questions written for this blog, not exam dumps.
Comments
Post a Comment