Courseiva

Databricks-DE-Pro Data Transformation, Cleansing, Quality Practice Question

A Data Engineer is working on a Delta Live Tables (DLT) pipeline that ingests JSON files from cloud storage. The pipeline must drop rows where the 'email' column is null and also flag rows where 'age' is negative as invalid, but still process them. Which combination of DLT expectations should be used?

⚠ Common exam trap

Watch out — candidates often confuse expect_or_drop with expect; the former drops rows, while the latter only records metrics.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Use @dlt.expect_or_drop("valid_email", "email IS NOT NULL") and @dlt.expect("non_negative_age", "age >= 0")

The correct approach uses expect_or_drop for the email null rule to remove those rows, and expect for the age rule to record violations without dropping. This satisfies both the drop and flag requirements simultaneously. Other expectation types either fail the pipeline, only log metrics, or drop rows that should be retained.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Use @dlt.expect_all({"valid_email": "email IS NOT NULL", "non_negative_age": "age >= 0"})

    Why it's wrong here

    expect_all only tracks metrics for both conditions; it does not drop rows with null email. The requirement explicitly states that rows with null email should be dropped, so this approach fails to enforce that data quality rule.

  • ✗

    Use @dlt.expect_or_fail("valid_email", "email IS NOT NULL") and @dlt.expect_or_drop("non_negative_age", "age >= 0")

    Why it's wrong here

    expect_or_fail would cause the pipeline to fail on null email, not drop the rows. Also, expect_or_drop on non-negative age would drop rows with negative age, but the requirement is to flag them, not drop. This does not meet the scenario.

  • ✗

    Use @dlt.expect_all_or_drop({"valid_email": "email IS NOT NULL", "non_negative_age": "age >= 0"})

    Why it's wrong here

    expect_all_or_drop would drop rows that violate either condition, meaning rows with negative age would also be dropped. However, the requirement is to flag negative age rows and keep them, so this option incorrectly drops those rows.

  • ✓

    Use @dlt.expect_or_drop("valid_email", "email IS NOT NULL") and @dlt.expect("non_negative_age", "age >= 0")

    Why this is correct

    Using expect_or_drop for email nulls removes those rows, while expect for negative age records and retains them, flagging as invalid. This matches the requirement to drop rows with null email and flag negative ages without dropping them.

About these practice questions

One of 267 original Databricks-DE-Pro practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Databricks exam blueprint

This Databricks-DE-Pro practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-DE-Pro exam.