SaveMyCert
Log in
5 of 5 free questions left today·for 30 a day
Databricks DEA · Domain 3

Data Transformation and Modeling practice questions

Data Transformation and Modeling is worth 22% of the Databricks DEA exam — the heaviest of the 7 domains. Bronze to silver to gold with PySpark and SQL: cleaning, joins and unions, column and row manipulation, deduplication and aggregation, basic Spark tuning, gold-layer objects in Unity Catalog, and data quality checks. 6 fully worked examples are further down this page, answers included.

Exam weight
22%
the heaviest of the 7 domains
Questions
114
across 3 topics
Free, no account
5/day
a free account allows 30 a day
Explanations
Every option
right and wrong

Build a practice session

5 free questions left today.

Domains

How many?

Mode

Ready when you are

10 fresh questions drawn across 1 of 7 domains, in Learn mode.

Focused review

Every question you answer incorrectly, and every question you flag while practising, is saved here automatically. Finish a session and you can come back to re-drill just those.

6 sample Data Transformation and Modeling questions, fully explained

Questions from the Databricks DEA bank mapped to domain 3, with the answer key and the reasoning behind every option. None of them repeat the examples on the main Databricks DEA practice page.

Question 1Data Transformation and Modeling

A silver order lines table must report a quantity of 0 and a discount of 0.0 where the bronze data has nulls in those two numeric columns. Other numeric columns, such as unit_price, must keep their nulls so data stewards can investigate them. Which PySpark call should the data engineer use?

Choose one.

  • a
    df.fillna(0)

    A single value with no subset fills every numeric column, so unit_price nulls would also become 0.

  • b
    df.fillna({"quantity": 0, "discount": 0.0}) Correct

    Correct. A dictionary maps each column to its own replacement value and leaves every other column untouched.

  • c
    df.dropna(subset=["quantity", "discount"])

    This removes the order lines with missing values instead of reporting them as 0.

  • d
    df.na.replace("null", "0", subset=["quantity", "discount"])

    na.replace swaps matching values; it looks for the string "null", not for missing values, and it does not fill nulls in numeric columns.

The concept

fillna can take a dictionary of column-to-value pairs so each column gets its own default.

Why that’s the answer

fillna({"quantity": 0, "discount": 0.0}) fills only the two named columns. An unscoped fillna(0) also changes unit_price, dropna removes rows instead of filling them, and na.replace replaces existing values rather than nulls.

How to reason it out
  1. Identify which columns need a default and which must keep nulls.
  2. Choose fillna, because the rows must stay.
  3. Pass a dictionary so only the named columns are filled.

Exam tip: fillna({col: value}) fills only the columns you name.

Cleaning, Joining and Reshaping Data with PySpark and SQL (Databricks Data Engineer Associate) — the lesson that teaches this.

Question 2Data Transformation and Modeling

A bronze table loaded from CSV stores order_date as a string such as '03/15/2026' (month first). Analysts need a DATE column in the silver table so they can filter by month. Which PySpark expression should the data engineer use to create the column?

Choose one.

  • a
    col("order_date").cast("date")

    A plain cast expects an ISO-style string such as 2026-03-15, so month-first values do not convert to the right dates.

  • b
    to_date(col("order_date"), "dd/MM/yyyy")

    The pattern reads the first number as the day, so '03/15/2026' does not parse and other dates swap day and month.

  • c
    to_date(col("order_date"), "MM/dd/yyyy") Correct

    Correct. to_date with a pattern that matches the source layout parses the month-first string into a DATE.

  • d
    date_format(col("order_date"), "yyyy-MM-dd")

    date_format turns a date or timestamp into a formatted string; it does not parse a string into a DATE column.

The concept

Standardizing data types in silver means parsing strings with the pattern the source actually uses.

Why that’s the answer

to_date(column, pattern) parses a string using an explicit datetime pattern, so 'MM/dd/yyyy' fits month-first dates. A plain cast only understands ISO dates, the day-first pattern misreads the values, and date_format goes the other way, producing a string.

How to reason it out
  1. Look at the source string layout: month, day, year.
  2. Pick a parsing function that accepts a pattern.
  3. Match the pattern to the layout exactly.

Exam tip: Parse non-ISO date strings with to_date and a pattern that matches the source.

Cleaning, Joining and Reshaping Data with PySpark and SQL (Databricks Data Engineer Associate) — the lesson that teaches this.

Question 3Data Transformation and Modeling

A data engineer builds a silver table with CREATE OR REPLACE TABLE ... AS SELECT on a SQL warehouse, where ANSI mode is on. The bronze amount column is a string, and a few rows contain 'N/A'. The statement must succeed, keep those rows, and leave their amount null for review. Which expression should replace the amount column?

Choose one.

  • a
    try_cast(amount AS DECIMAL(12,2)) AS amount Correct

    Correct. try_cast returns NULL for a value it cannot convert instead of raising an error, so the rows stay with a null amount.

  • b
    CAST(amount AS DECIMAL(12,2)) AS amount

    Under ANSI mode a malformed value makes CAST raise an error, so the whole statement fails on the 'N/A' rows.

  • c
    coalesce(CAST(amount AS DECIMAL(12,2)), 0) AS amount

    The CAST still fails on 'N/A' before coalesce runs, and even without the error it would report 0 rather than null.

  • d
    CAST(amount AS DOUBLE) AS amount

    Casting to DOUBLE raises the same invalid-input error under ANSI mode, and a binary floating type is a poor fit for money.

The concept

try_cast converts what it can and returns NULL for invalid values instead of failing the query.

Why that’s the answer

With ANSI mode on, CAST of a malformed string raises an error and the CTAS fails. try_cast(amount AS DECIMAL(12,2)) returns NULL for 'N/A' and converts every valid value, which meets all three requirements. Wrapping CAST in coalesce does not prevent the error, and casting to DOUBLE fails the same way.

How to reason it out
  1. Note that ANSI mode makes invalid casts raise errors.
  2. The rows must stay, so filtering them out is not an option.
  3. Use the cast variant that returns NULL on invalid input.

Exam tip: Need a cast that never fails on bad input? Use try_cast; it returns NULL.

Cleaning, Joining and Reshaping Data with PySpark and SQL (Databricks Data Engineer Associate) — the lesson that teaches this.

Question 4Data Transformation and Modeling

The finance team reconciles daily revenue from a silver payments table against the bank to the cent. In bronze, amount is a string such as '1049.99'. Which target type should the data engineer cast amount to when standardizing types for the silver table?

Choose one.

  • a
    DOUBLE

    DOUBLE is a binary floating-point type; sums of many cent values can drift by tiny amounts and fail an exact reconciliation.

  • b
    DECIMAL(18,2) Correct

    Correct. DECIMAL stores exact base-10 values with two decimal places, so sums reconcile to the cent.

  • c
    FLOAT

    FLOAT is also binary floating point and has even less precision than DOUBLE, so large totals lose cents.

  • d
    DECIMAL(5,2)

    This is exact, but only three digits are left before the decimal point, so amounts of 1000 or more do not fit.

The concept

Monetary values belong in an exact DECIMAL type with enough precision for the largest amount.

Why that’s the answer

DECIMAL(precision, scale) is exact, so cent values add up without rounding drift; precision 18 leaves room for large totals. DOUBLE and FLOAT are approximate binary types, and DECIMAL(5,2) is exact but too small for amounts of 1000 and above.

How to reason it out
  1. The requirement is exact cent-level totals.
  2. Exclude approximate floating types.
  3. Choose a DECIMAL with enough digits before the decimal point.

Exam tip: Money: exact DECIMAL with enough precision, never FLOAT or DOUBLE.

Cleaning, Joining and Reshaping Data with PySpark and SQL (Databricks Data Engineer Associate) — the lesson that teaches this.

Question 5Data Transformation and Modeling

A nightly Lakeflow Jobs task reads a bronze table, cleans it with PySpark and rebuilds the silver table main.silver.orders from scratch. Last week a failed run was retried and the silver table ended up with every row twice. Which write should the task use so that a rerun leaves exactly one copy of the cleaned data?

Choose one.

  • a
    cleaned.write.mode("append").saveAsTable("main.silver.orders")

    Append adds the rebuilt rows to what is already there, which is exactly how the retry duplicated the table.

  • b
    cleaned.write.mode("overwrite").saveAsTable("main.silver.orders") Correct

    Correct. Overwrite replaces the table contents in one Delta commit, so any number of reruns ends with one copy.

  • c
    cleaned.write.mode("ignore").saveAsTable("main.silver.orders")

    Ignore skips the write when the table already exists, so after the first night the silver table would never refresh.

  • d
    cleaned.write.mode("errorifexists").saveAsTable("main.silver.orders")

    This default mode fails when the table exists, so every run after the first would error instead of rebuilding.

The concept

The save mode decides what a write does when the target silver table already exists.

Why that’s the answer

A full rebuild should replace the table, and mode("overwrite") does that atomically in Delta Lake, so a retry produces the same result. Append duplicates on reruns, ignore stops refreshing after the first run, and errorifexists fails once the table exists.

How to reason it out
  1. The job rebuilds the whole table each night.
  2. A retry must give the same result as one successful run.
  3. Choose the save mode that replaces existing contents.

Exam tip: Full rebuild of a silver table = overwrite; append is for new rows only.

Cleaning, Joining and Reshaping Data with PySpark and SQL (Databricks Data Engineer Associate) — the lesson that teaches this.

Question 6Data Transformation and Modeling

A SQL-only analytics team cleans bronze customer data with a SELECT that trims names, fixes types and drops rows without an email. They want each scheduled run to replace a physical silver table with the latest cleaned result. Which statement should they run?

Choose one.

  • a
    CREATE TABLE IF NOT EXISTS main.silver.customers AS SELECT ...

    IF NOT EXISTS creates the table on the first run and then does nothing, so later runs never refresh it.

  • b
    INSERT INTO main.silver.customers SELECT ...

    INSERT INTO appends, so each run adds another full copy of the cleaned customers.

  • c
    CREATE OR REPLACE VIEW main.silver.customers AS SELECT ...

    A view stores only the query and recomputes it at read time; the team asked for a physical table.

  • d
    CREATE OR REPLACE TABLE main.silver.customers AS SELECT ... Correct

    Correct. CREATE OR REPLACE TABLE AS SELECT writes the query result to a Delta table and replaces its contents on each run.

The concept

CREATE OR REPLACE TABLE AS SELECT (CTAS) is the SQL way to write a cleaned result to a new silver table.

Why that’s the answer

CTAS with OR REPLACE materializes the SELECT into a Delta table and swaps in the new contents each run. IF NOT EXISTS stops refreshing after the first run, INSERT INTO appends duplicates, and a view does not store data.

How to reason it out
  1. The output must be a physical table.
  2. Each run must replace, not add to, the contents.
  3. Pick CREATE OR REPLACE TABLE AS SELECT.

Exam tip: Rebuild a silver table in SQL with CREATE OR REPLACE TABLE ... AS SELECT.

Cleaning, Joining and Reshaping Data with PySpark and SQL (Databricks Data Engineer Associate) — the lesson that teaches this.

What Databricks DEA domain 3 tests, topic by topic

The official exam guide breaks Data Transformation and Modeling into 3 topics. The question bank follows the same split, so a weak topic shows up as a cluster of misses you can go back and read.

Published Databricks DEA practice questions per topic in Data Transformation and Modeling
TopicWhat it coversQuestions
Cleaning, Joining and Reshaping Data with PySpark and SQLOfficial exam-guide objectives (Section 3): "Implement data cleaning by reading bronze tables with PySpark/SQL, cleaning nulls, standardizing data types, and writing to new silver tables." "Combine DataFrames with operations such as Inner join, left join, broadcast join, multiple keys, cross join, union, and union all." "Manipulate columns, rows, and table structures by adding, dropping, splitting, renaming column names, applying filters, and exploding arrays."38
Deduplication, Aggregation and Basic Spark TuningOfficial exam-guide objectives (Section 3): "Perform data deduplication operations and aggregate operations on DataFrames, such as count, approximate count distinct, and mean, summary." "Understand the basic tuning parameters (spark.sql.shuffle.partitions, spark.default.parallelism, spark.executor/driver.memory, spark.sql.autoBroadcastJoinThreshold) and re-measure the performance."38
Gold Layer Objects and Data QualityOfficial exam-guide objectives (Section 3): "Understand the difference between, and how to build, Gold layer objects such as materialized views, views, streaming tables, and tables for BI and analytics teams in Unity Catalog." "Apply data quality checks and validation rules to ensure reliable Silver and Gold datasets."38
Total114

Revise Data Transformation and Modeling before you drill it

Other Databricks DEA domains

Data Transformation and Modeling: your questions

Data Transformation and Modeling is domain 3 of the Databricks DEA exam guide and carries 22% of the scored content — the heaviest of the 7 domains. On a 45-question paper that works out to roughly 10 questions, though Databricks does not publish an exact per-domain count and individual exam forms vary.

Source

The domain weight and topic list on this page come from the official Databricks DEA exam guide.