Databricks Machine Learning Associate · 19% practice allocation

Databricks Machine Learning Associate: ML Workflows Practice Questions

5 free sample questions from the ML Workflows domain, with answers and explanations. The full Machine Learning Associate bank has 461 questions across 4 domains. Questions are scenario-based and written from the official Databricks exam guide.

1.

A data scientist is working in a Databricks notebook and wants to quickly generate a statistical summary of a PySpark DataFrame sensor_df that includes count, mean, standard deviation, min, and max for all numeric columns. Which of the following approaches is the MOST straightforward way to accomplish this?

  • A. sensor_df.summary()
  • B. sensor_df.describe()✓ Correct
  • C. dbutils.data.summarize(sensor_df)
  • D. sensor_df.printSchema()
Explanation

sensor_df.describe() returns count, mean, stddev, min, and max for all numeric (and string) columns, which is exactly what is requested. sensor_df.summary() also works but additionally includes percentile statistics (25%, 50%, 75%) that go beyond the basic set described — describe() is the more direct match to the stated requirements. dbutils.data.summarize(sensor_df) produces a richer, notebook-rendered profile (including histograms and null counts), which is more than what was asked and is a Databricks-specific utility rather than a standard API call. printSchema() only shows column names and data types, not any statistical summaries.

2.

A data scientist needs to measure the statistical association between a binary categorical feature churned (values: 0 or 1) and a nominal categorical feature subscription_plan (values: 'basic', 'standard', 'premium') in a dataset. Which correlation or association metric is MOST appropriate for this scenario?

  • A. Cramér's V✓ Correct
  • B. Pearson correlation coefficient
  • C. Spearman rank correlation
  • D. Point-biserial correlation
Explanation

Cramér's V is a measure of association between two categorical variables derived from the chi-squared statistic. It is appropriate when both variables are categorical (nominal or ordinal), as is the case here with churned (binary categorical) and subscription_plan (nominal categorical). Pearson correlation measures the linear relationship between two continuous numeric variables and is not valid for nominal categorical data. Spearman rank correlation is appropriate for ordinal data or monotonic relationships between continuous variables, but subscription_plan has no meaningful ordinal ranking. Point-biserial correlation measures the relationship between one binary variable and one truly continuous variable; while churned is binary, subscription_plan is nominal with multiple non-numeric levels, making point-biserial inapplicable.

3.

A data scientist is constructing TF-IDF text features in a PySpark ML pipeline for a document classification task. Which sequence of transformers is correct?

  • A. IDF → HashingTF → Tokenizer
  • B. HashingTF → Tokenizer → IDF
  • C. Tokenizer → IDF → HashingTF
  • D. Tokenizer → HashingTF → IDF✓ Correct
Explanation

The correct order for TF-IDF in PySpark ML is: (1) Tokenizer splits the raw text string into a list of tokens, (2) HashingTF maps those tokens to term-frequency vectors via feature hashing, and (3) IDF (an Estimator) is fit on the corpus and transforms the TF vectors into TF-IDF weighted vectors. Placing HashingTF before Tokenizer fails because HashingTF expects a sequence of tokens, not a raw string. Starting with IDF is impossible since IDF requires TF vectors as input. Placing IDF before HashingTF inverts the dependency — IDF rescales TF vectors and cannot produce them.

4.

A data scientist is conducting EDA on a PySpark DataFrame products_df with a column price. They want to visualize the distribution of price and assess whether it is approximately normally distributed. They call display(products_df.select('price')) and use the built-in chart editor. Which chart type available in the Databricks built-in visualization is BEST suited for assessing the shape of the distribution of a single continuous variable?

  • A. Histogram✓ Correct
  • B. Bar chart
  • C. Pie chart
  • D. Scatter plot
Explanation

A histogram bins a continuous variable into intervals and shows the frequency or density of each bin, making it the standard chart type for assessing the shape of a distribution (e.g., normality, skewness, modality). Databricks built-in visualizations include histograms as a chart type accessible from the display() chart editor. A bar chart is used for comparing discrete categories, not for visualizing the distribution of a continuous variable. A scatter plot shows the relationship between two variables and is not suitable for displaying the distribution of a single variable. A pie chart shows proportions of a whole for categorical data and is entirely inappropriate for a continuous distribution.

5.

A data scientist is performing missing value imputation during EDA on a medical dataset. The column blood_pressure has 12% missing values. After investigation, the missingness pattern appears to be related to the patient's age and diagnosis columns (i.e., Missing At Random — MAR). Which imputation strategy is MOST statistically appropriate for this scenario?

  • A. Dropping all rows where blood_pressure is null
  • B. Mean imputation using the global column mean
  • C. Multiple Imputation by Chained Equations (MICE)✓ Correct
  • D. Forward-fill (ffill) based on row order
Explanation

MICE (Multiple Imputation by Chained Equations) is specifically designed for Missing At Random (MAR) data, where missingness depends on other observed variables. MICE iteratively models each feature with missing values as a function of other features, producing statistically sound imputations that preserve relationships between variables — critical for a medical dataset. Forward-fill is appropriate for time-series data where the previous value is a reasonable proxy for a missing value; it is not appropriate here because row order in a medical dataset is not temporally meaningful for blood pressure. Mean imputation ignores the MAR structure (the fact that missingness relates to age and diagnosis) and reduces variance, leading to biased model inputs. Dropping rows with 12% missingness wastes data and can introduce bias if the missingness is not completely at random (MCAR).

Test yourself across every Machine Learning Associate domain

The free Machine Learning Associate practice test mixes about 20 questions weighted like the exam. The full 461-question bank adds instant grading, flashcards and a timed mock exam.

Study this domain

ML Workflows study guide (Machine Learning Associate) →

Other Machine Learning Associate domains

← All Databricks Machine Learning Associate study resources