Databricks Data Engineer Professional · 10% practice allocation

Databricks Data Engineer Professional: Debugging and Deploying Practice Questions

5 free sample questions from the Debugging and Deploying domain, with answers and explanations. The full Data Engineer Professional bank has 311 questions across 10 domains. Questions are scenario-based and written from the official Databricks exam guide.

1.

A data engineering team is writing unit tests for a PySpark transformation function that filters and aggregates a sales DataFrame. They want to assert that two DataFrames are equal regardless of row order. Which library provides a purpose-built assertion function for this use case in PySpark unit tests?

  • A. pytest-spark, using the assert_frame_equal helper
  • B. unittest, using the built-in assertEqual method on the DataFrame's .collect() result after sorting
  • C. Chispa, using the assert_df_equality function with ignore_row_order=True✓ Correct
  • D. pandas-testing, by converting both DataFrames with .toPandas() and calling pd.testing.assert_frame_equal
Explanation

Chispa is a PySpark-specific testing library that provides assert_df_equality, which natively handles row-order independence, schema comparison, and null semantics — exactly what is needed for DataFrame assertions. pytest-spark does not provide an assert_frame_equal helper. Converting to pandas with .toPandas() works in small tests but does not scale and is not order-agnostic by default. Using unittest.assertEqual on .collect() results is fragile because list equality is order-sensitive, and manually sorting adds complexity without a guarantee of correctness across all data types.

2.

A data engineer is writing a unit test for a PySpark transformation using the Chispa library. The transformation deduplicates a DataFrame by keeping the most recent record per device_id, ordered by event_timestamp. Which Chispa assertion method is MOST appropriate for validating the output DataFrame when row order is not guaranteed?

  • A. assert_dataframes_equal(result_df, expected_df, ignore_row_order=True) to allow comparison regardless of physical row ordering✓ Correct
  • B. assert_schema_equality(result_df.schema, expected_df.schema) because Chispa cannot compare row values for deduplicated DataFrames
  • C. assert_dataframes_equal(result_df, expected_df) with the default settings, since Chispa compares DataFrames row-by-row in order
  • D. assert_approx_dataframes_equal(result_df, expected_df) because deduplication may introduce floating-point rounding in timestamps
Explanation

Chispa's assert_dataframes_equal supports an ignore_row_order=True parameter that sorts both DataFrames before comparing, making it safe when the output order is non-deterministic—which is common after window-based deduplication. Option C is wrong because default Chispa comparison is order-sensitive and would produce false failures when rows are shuffled. Option D is wrong because assert_approx_dataframes_equal is for numeric tolerance, not row ordering. Option B is wrong because assert_schema_equality only validates structure, not row-level data correctness.

3.

A team runs integration tests for a Databricks pipeline by spinning up an ephemeral cluster via a CI/CD job. The test notebook mounts test Delta tables, runs the pipeline logic, and asserts on output table contents. After completing, the cluster must be terminated and costs minimized. Which TWO practices are MOST important for managing costs and reliability in this integration test pattern? (Select TWO)

  • A. Use a single-node cluster (no workers) sized to the minimum required for the test workload.
  • B. Configure the cluster with a 10-minute auto-termination policy as the sole cost-control mechanism.
  • C. Schedule the integration test job to run only on weekends to reduce weekday compute costs.
  • D. Pin the cluster to a specific Databricks Runtime version matching production to ensure test fidelity.✓ Correct
  • E. Use databricks runs submit --wait with the --new-cluster flag so the cluster is created and automatically terminated after the run completes.✓ Correct
  • F. Use the default shared cluster pool to avoid cluster startup latency.
Explanation

Using databricks runs submit --wait with --new-cluster provisions an ephemeral cluster tied to that single run; the cluster is automatically terminated when the run finishes, eliminating the need for manual teardown or relying solely on auto-termination. Pinning the Databricks Runtime version to match production ensures that library versions, Spark behaviors, and Delta protocol features are consistent between tests and production, which is critical for integration test fidelity. Option A (single-node) may be insufficient for integration tests that test distributed behavior. Option B (auto-termination only) is a fallback, not a primary strategy — the cluster could still run for up to 10 minutes after completion needlessly. Option C (weekend scheduling) reduces test frequency and slows feedback loops, which defeats CI/CD goals. Option F (shared cluster pool) introduces test isolation issues since other workloads may be running on the pool.

4.

A team wants to deploy jobs, DLT pipelines, and configuration as code across dev/staging/prod in a repeatable, versioned way. Which Databricks capability is designed for this?

  • A. Databricks Asset Bundles✓ Correct
  • B. Manually recreating jobs in each workspace via the UI
  • C. Emailing notebook exports
  • D. A single all-purpose cluster
Explanation

Databricks Asset Bundles define jobs, pipelines, and configuration as code (YAML) for versioned, repeatable deployment across environments. Manual UI recreation (B) and emailing exports (C) are error-prone and unrepeatable, and a cluster (D) isn't a deployment mechanism.

5.

A senior data engineer is designing a test data management strategy for a team that runs integration tests against Delta tables. The tests must be repeatable and isolated from production data changes. Which TWO practices BEST achieve this? (Select TWO)

  • A. Generate synthetic test fixtures using a pytest fixture function that writes a small, controlled dataset to a temporary Delta table path using spark.createDataFrame() and df.write.format('delta').save(tmp_path), then clean up after the test.✓ Correct
  • B. Use Databricks photon-enabled clusters for integration tests to ensure query results match production performance characteristics.
  • C. Disable Delta transaction log compaction on test tables to ensure full history is always available for test assertions.
  • D. Before each test run, use Delta time travel (RESTORE TABLE ... TO VERSION AS OF 0) to reset the test tables to their initial seeded state.
  • E. Point integration tests directly at production tables using a read-only service principal to ensure tests run against real data.
  • F. Store a snapshot of the required Delta table (captured via DEEP CLONE) in a dedicated test storage container and restore it at the start of each test run.✓ Correct
Explanation

Option A (generating synthetic fixtures) is the gold standard for unit/integration test data management: the test controls its own data, the data is minimal and deterministic, and cleanup is straightforward. Option F (DEEP CLONE into a test container) is the recommended approach for integration tests that need realistic data shapes/schemas: a known-good snapshot is cloned before tests run, providing a stable, isolated baseline that is not affected by production data changes. Option D (RESTORE TO VERSION 0) is only reliable if the table was originally created with version 0 as the seed; transaction log retention and vacuum operations can make this fragile. Option E (reading from production) violates test isolation — production data changes will cause test flakiness. Option C (disabling log compaction) has no bearing on test repeatability. Option B (Photon clusters) is irrelevant to test isolation and repeatability.

Test yourself across every Data Engineer Professional domain

The free Data Engineer Professional practice test mixes about 20 questions weighted like the exam. The full 311-question bank adds instant grading, flashcards and a timed mock exam.

Study this domain

Debugging and Deploying study guide (Data Engineer Professional) →

Other Data Engineer Professional domains

← All Databricks Data Engineer Professional study resources