All Databricks exams
Free Databricks Certified Data Engineer Professional practice test: 30 questions with answers
30 original questions for Databricks Certified Data Engineer Professional, drawn from every topic area. Answer each one to see whether you got it right and why. No sign-up.
- Free questions
- 30
- Full bank
- 112 questions
Databricks Certified Data Engineer Professional exam guide: topics, cost and format
All 30 Databricks Certified Data Engineer Professional questions with answers
The same questions as the test above, grouped by exam topic. Open any question to see the answer and explanation.
Developing Code for Data Processing using Python and SQL (3 questions)
Question 1
A pipeline must upsert daily change records into a Delta table keyed on customer_id. Duplicate keys can appear within one batch. Which statement produces a correct result?
- AUse MERGE with a deduplicated source, so each customer_id appears at most once before the match is evaluated
- BUse INSERT INTO with the batch as-is, then rely on a later OPTIMIZE to remove the duplicate rows automatically
- CUse MERGE with duplicate keys in the source, since Delta picks the latest row for each key without any rule
- DUse COPY INTO each night with the full history, which overwrites the table and removes any duplicates from the batch
Show answer and explanationHide answer
Correct answer: AMERGE fails when multiple source rows match one target row, so the source must be deduplicated to one row per key first, often by ordering on a timestamp. INSERT leaves duplicates, duplicate keys in MERGE cause errors rather than an automatic choice, and OPTIMIZE does not remove logical duplicates.
Question 2
A PySpark job joins a large fact table to a small dimension table, and one stage is slow. The dimension table is about 20 MB. Which change most directly reduces the shuffle?
- ABroadcast the small dimension table using a broadcast hint or broadcast join
- BConvert the dimension table to a Python list and loop over the fact rows in the driver
- CDisable adaptive query execution so that Spark stops choosing join strategies for the query at runtime
- DRepartition the fact table to 10,000 partitions before the join so that each partition is tiny
Show answer and explanationHide answer
Correct answer: ABroadcasting a small table sends a copy to every executor and avoids shuffling the large side. Very high partition counts add scheduling overhead, looping in the driver does not scale, and disabling adaptive execution removes an optimization rather than fixing the shuffle.
Question 3
A transformation uses a Python UDF on a column of 500 million rows, and it is much slower than the equivalent built-in function. What is the best change?
- AConvert the column to a string before every UDF call so that Python handles the values more efficiently
- BAdd more Python UDFs for each step so the work is spread across more functions and runs in parallel
- CRun the UDF on the driver node only, which avoids the cost of sending data between executors
- DReplace the Python UDF with the equivalent built-in Spark SQL function or a column expression
Show answer and explanationHide answer
Correct answer: DBuilt-in functions run inside the JVM and are optimized, while Python UDFs add serialization overhead, so replacing them is the best fix. Adding UDFs multiplies overhead, running on the driver removes parallelism, and string conversion adds cost.
Data Ingestion & Acquisition (3 questions)
Question 4
A source drops thousands of JSON files into a cloud storage folder each hour. The pipeline must ingest each file exactly once, scale without listing the whole folder, and tolerate new fields in the JSON. Which approach fits?
- AA streaming job that reads the folder with a fixed schema and drops any file that contains a field it does not know
- BA nightly batch that reads every file in the folder and appends all of them to the target table each time
- CA manual COPY INTO run by an engineer each hour, with the file list pasted into the notebook as a parameter
- DAuto Loader with cloudFiles, a checkpoint location, and schema evolution enabled for new fields
Show answer and explanationHide answer
Correct answer: DAuto Loader tracks processed files through its checkpoint, scales with directory notifications or incremental listing, and can evolve the schema for new fields. Nightly full appends duplicate data, manual COPY INTO depends on people, and a fixed schema that drops files loses data.
Question 5
A team ingests a stream from Kafka into a Delta table. After a failure, the job restarts and the team sees duplicate records. Which practice prevents this?
- ADelete the checkpoint each time the job restarts, so that Spark rebuilds the state and no duplicates are written
- BTurn off the checkpoint so that the job starts reading from the latest Kafka offset without any memory of earlier runs
- CKeep the checkpoint location for the stream and make the write idempotent, for example with a MERGE keyed on the event ID
- DWrite the stream to a new table name every hour, so that duplicates from the previous run are never read again
Show answer and explanationHide answer
Correct answer: CKeeping the checkpoint lets the stream resume from its committed offsets, and an idempotent write such as MERGE on the event ID prevents duplicates from replays. Deleting the checkpoint forces reprocessing, disabling it loses position, and new tables each hour fragment the data.
Question 6
A streaming job uses a watermark on event_time for a windowed aggregation. Events can arrive up to ten minutes late. What should the watermark be set to?
- AZero, so that every window closes as soon as its first event arrives, with no waiting for late data at all
- BOne hour, so that very late events are always included even when the state for old windows grows without any limit
- CTen minutes, so that the windows wait for late events within the allowed lateness before the state is dropped
- DEqual to the processing time of the cluster, so that the watermark moves with the wall clock of the driver node
Show answer and explanationHide answer
Correct answer: CA ten-minute watermark lets the aggregation accept events up to that lateness, and state older than the watermark is dropped. Zero drops late events, an hour retains state for too long, and tying it to processing time ignores event time.
Cost & Performance Optimisation (3 questions)
Question 7
A nightly job runs on a large all-purpose cluster that sits idle for most of the day, and costs have risen. The workload is scheduled and predictable. Which change most directly reduces cost?
- AKeep the all-purpose cluster running at its maximum size so that jobs start instantly every time they are scheduled
- BMove the scheduled work to a job cluster or serverless compute that starts for the run and stops when it finishes
- CRun the job on a single-node cluster that the team starts manually each night, without any scheduling or policy
- DAdd more workers to the all-purpose cluster so that the job finishes sooner and the cluster is turned off earlier
Show answer and explanationHide answer
Correct answer: BJob or serverless compute starts for the scheduled run and stops after it, which removes idle cost. Keeping a large cluster always on maximizes idle spend, manual single-node runs add operational work, and more workers raise cost without removing idle time.
Question 8
A job's Spark UI shows one task taking far longer than the others in a shuffle stage. The partition sizes are highly uneven because a few keys have most of the rows. Which approach addresses this?
- ASalt the skewed key or enable adaptive skew handling, so that the large partitions are split across tasks
- BIncrease the number of executors without changing the data distribution, so that the skewed partition gets more CPU
- CReduce the number of partitions to one, so that all rows are processed by a single task with no shuffle at all
- DCache the entire dataset in memory on the driver, so that the skewed key is read from the driver instead of executors
Show answer and explanationHide answer
Correct answer: ASalting skewed keys or enabling adaptive skew handling splits large partitions so tasks finish evenly. More executors do not split one skewed partition, a single partition removes parallelism, and caching on the driver does not distribute the work.
Question 9
A team needs to limit how much a group of developers can spend on compute each month, without restricting the cluster types that the group can use. Which control fits?
- AA rule that every developer must ask a manager in chat before starting each cluster, with no record of the approval
- BRemoving all compute permissions from the developers, so that they can only read notebooks and cannot run any code at all
- CGiving developers a shared administrator account with no limits, so that they can self-manage their own spending
- DCluster policies that cap instance sizes and types, plus budget alerts on the spend of the group
Show answer and explanationHide answer
Correct answer: DCluster policies restrict instance types and sizes, and budget alerts track spend, which together control cost without blocking legitimate work. Chat approvals are unrecorded and manual, removing all compute blocks useful work, and shared administrator accounts remove limits.
Data Transformation, Cleansing, and Quality (3 questions)
Question 10
A declarative pipeline must drop rows with a null customer_id and record how many rows were dropped in the pipeline's quality metrics. Which feature fits?
- AAn expectation with a drop action on customer_id IS NOT NULL, which records the dropped rows in the pipeline event log
- BA Python try and except block around each row that silently skips the bad rows without logging anything at all
- CA separate job that counts the nulls each night and emails the total to the data owner, with no change to the pipeline
- DA WHERE clause in the final view with no record of the removed rows, since the metric is not needed for the team
Show answer and explanationHide answer
Correct answer: AAn expectation with a drop action removes the failing rows and records quality metrics in the pipeline event log. A WHERE clause removes rows without metrics, silent exception handling hides the loss, and a nightly email job is detached from the pipeline.
Question 11
A team follows the medallion pattern. Which layer should hold cleansed, conformed data that is ready for joins and reuse across teams?
- ABronze, where raw data is kept exactly as received, with no cleansing or deduplication applied at all
- BSilver, where data is cleaned, deduplicated and conformed for reuse
- CGold, where only the final aggregates for a single dashboard are stored, with no reusable detail kept
- DA temporary staging schema that is dropped at the end of each run and never used by any other team
Show answer and explanationHide answer
Correct answer: BSilver holds cleansed and conformed data suited to reuse and joins. Bronze keeps raw data, Gold holds business-level aggregates, and temporary staging is not a governed layer.
Question 12
A pipeline reads a table whose schema changed upstream by adding a column. The downstream table must accept the new column without manual changes. Which setting supports this for a Delta MERGE or append?
- ASchema evolution enabled for the write, so the target table adds the new column automatically
- BEnforcing a fixed column list, so that any new column stops the pipeline until a person edits the code
- CCasting every column to string before the write, so that the new column is absorbed without changing any table schema
- DDropping the new column in the source query so that the target schema never sees it, even though the data is needed
Show answer and explanationHide answer
Correct answer: ASchema evolution on the write lets Delta add new columns automatically when the source gains them. Enforcing a fixed list stops the pipeline, casting everything to strings degrades types, and dropping the column loses data the business needs.
Ensuring Data Security and Compliance (3 questions)
Question 13
A table holds personal data, and only a compliance group may see the email column. Other analysts can query the table. Which Unity Catalog feature enforces this?
- AA comment on the email column asking analysts not to read it, with no enforcement on the table itself
- BA notebook setting that hides the output of the email column in the notebooks analysts run on their own laptops
- CA separate copy of the table with the email column removed, shared with all analysts and kept up to date by hand
- DA column mask function that returns masked values to users outside the compliance group
Show answer and explanationHide answer
Correct answer: DA column mask enforces access at query time based on the user's group, so unauthorized users receive masked values. Comments do not enforce anything, a manual copy drifts and duplicates data, and notebook settings do not protect data in queries.
Question 14
A team stores a database password for a job. The password must not appear in the notebook or the job configuration, and access must be audited. Which approach fits?
- APut the password in a notebook variable at the top of the notebook so that the team can change it easily when needed
- BWrite the password into the job's JSON configuration file in the repository, with access restricted to the team members
- CStore the password in a Databricks secret scope backed by the cloud secret manager, and read it at runtime with dbutils.secrets
- DPrint the password in the job's output log so that the operators can copy it when a job needs to be re-run by hand
Show answer and explanationHide answer
Correct answer: CA secret scope backed by the cloud secret manager keeps the password out of code and configuration, and reads are controlled and audited. Notebook variables, repository files and job logs all expose the password.
Question 15
A regulated dataset must be accessible only from approved network locations, and access attempts from elsewhere must be blocked. Which control fits best?
- AAsking users to connect only from the office by policy, with no technical block and no record of the locations used
- BOpening the workspace to all networks, since the data is encrypted at rest and therefore safe from any location
- CGiving every user a VPN password so that the network location does not matter, with no list of approved networks at all
- DNetwork restrictions on the workspace, such as IP access lists or private connectivity, combined with audit logging
Show answer and explanationHide answer
Correct answer: DNetwork restrictions such as IP access lists or private connectivity, with audit logging, enforce approved locations and record attempts. Policy alone is not enforced, encryption at rest does not restrict access locations, and a VPN password with no approved list does not meet the requirement.
Debugging and Deploying (3 questions)
Question 16
A team wants to test a pipeline change automatically before it reaches production. Which practice fits best with Databricks Asset Bundles and a CI system?
- ADeploy each change straight to production and run the tests afterwards, so that the production data shows the true result
- BRun unit and integration tests on each pull request in the CI system, deploy to a test target, and deploy to production only after tests pass
- CSkip the tests for small changes, since small changes never break a pipeline and testing them only slows the team
- DAsk a reviewer to read the code aloud in a meeting, which replaces any automated test or deployment step
Show answer and explanationHide answer
Correct answer: BRunning tests on each pull request, deploying to a test target, and promoting to production after passing is the standard CI and CD flow. Testing after production, skipping small changes and reading code aloud do not provide automated assurance.
Question 17
A notebook in a job works on a developer's cluster but fails on the job cluster with an import error for a library. Which fix is most reliable?
- AInstall the library by hand on the job cluster after each job starts, from a notebook cell that runs before the code
- BCopy the library's source code into a notebook cell, so that Python never has to import it from any package at all
- CDeclare the library as a dependency in the job or cluster configuration, so the same environment is built everywhere
- DRename the library to a shorter name, so that the import resolves without any change to the job or cluster configuration
Show answer and explanationHide answer
Correct answer: CDeclaring the dependency in the job or cluster configuration ensures the same environment on every run. Manual installs after start, copying source into cells and renaming a library are fragile and do not fix the environment.
Question 18
Which TWO are good practices for handling schema changes in production tables? (Choose two.)
- ATest schema changes on a copy first, and check downstream jobs and dashboards before release
- BMake breaking changes without notice, since consumers can adapt quickly on their own
- CVersion schema changes and record them in source control alongside the pipeline code
- DDrop columns without checking which consumers read them, to keep the table lean
- ESkip documenting the schema, so that changes stay quick for the engineering team to make
Show answer and explanationHide answer
Correct answer: A, CTesting on a copy and checking downstream consumers, with versioned changes in source control, keep schema changes safe. Breaking changes without notice, unchecked drops and undocumented schemas each break consumers or hide changes.
Data Sharing and Federation (3 questions)
Question 19
A partner needs read-only access to a curated Delta table in another cloud, without copying the data or granting workspace access. Which feature fits?
- ADelta Sharing, which lets the provider share the table with a recipient who reads it live without copying the data
- BGiving the partner a storage access key so they can read the underlying Delta files directly from their own tools
- CEmailing a nightly export of the table as a compressed file to the partner, with a checksum in the email body
- DCreating a workspace user for the partner with the owner role on the whole catalog, so they can read any table
Show answer and explanationHide answer
Correct answer: ADelta Sharing gives a recipient live, read-only access to shared tables across clouds without copying data or granting workspace access. Exports go stale, storage keys expose the whole bucket, and owner roles give far more than read access.
Question 20
A team needs to query a PostgreSQL database that is outside Databricks, without copying its data into a Delta table first. The database must stay the source of truth. Which feature fits?
- AGiving every analyst the database password, so that they can connect from their own tools with no governance layer
- BA nightly export of the PostgreSQL tables to CSV files that are then loaded into Delta, with a copy kept in the bucket
- CLakehouse Federation with a connection to the database, so that queries read the source live under Unity Catalog governance
- DReplacing the database with a Delta table and migrating the application to write to it, which removes the source system
Show answer and explanationHide answer
Correct answer: CLakehouse Federation queries the external database live through a governed connection, which keeps the source as the truth. Nightly exports copy and lag, sharing passwords removes governance, and replacing the database changes the application unnecessarily.
Question 21
A provider wants to share a Delta table with a recipient in another organization, and revoke access quickly if the contract ends. The recipient must not receive a copy. Which method fits?
- ADelta Sharing with a share and a recipient, where the provider can remove the recipient's access at any time
- BSending the recipient a CSV copy of the table each month, with a note asking them to delete it when the contract ends
- CGiving the recipient a long-lived storage credential for the bucket, with no expiry and no record of its use
- DPublishing the table to a public website, so that anyone can download it and the provider has no need to revoke access
Show answer and explanationHide answer
Correct answer: ADelta Sharing lets the provider revoke a recipient's access without copying the data. Monthly CSV copies cannot be recalled, long-lived credentials are hard to revoke and unaudited, and public publication removes all control.
Monitoring and Alerting (3 questions)
Question 22
A streaming job's lag grows during peak hours, and the team wants an alert before the backlog becomes an incident. Which signal should they monitor?
- AThe number of notebooks that the team has open in the workspace at the time of the peak, as a proxy for activity
- BThe streaming query's input rate versus processing rate and the batch duration, with an alert when lag exceeds a threshold
- CThe count of users logged in to the workspace during the peak, which indicates how many people will query the data
- DThe total storage used by the workspace each month, since storage growth always predicts streaming lag accurately
Show answer and explanationHide answer
Correct answer: BComparing input and processing rates and batch duration shows when a stream falls behind, and an alert on lag catches it early. Notebook counts, monthly storage and login counts do not measure streaming lag.
Question 23
A scheduled pipeline has failed silently for two days because the job reported success even though no rows were written. The team wants to catch this in future. What should they add?
- AA message in the job's success log that says the job finished, with no check of how many rows were written
- BA check on the output row count and freshness, with an alert when the count is zero or the data is stale
- CA rule that the job must run more often, so that a silent failure is noticed sooner by the people who use the data
- DA manual review of the job once a month by the data owner, who checks the output table when they have time for it
Show answer and explanationHide answer
Correct answer: BA check on row count and freshness, with an alert, detects silent failures that report success. A success message without a count hides the problem, running more often does not check output, and a monthly manual review is too slow.
Question 24
A team wants to be alerted when a scheduled job's duration is much longer than its usual run time, so that it can investigate before a deadline is missed. Which approach fits best?
- ASet an alert on the job's run duration against a baseline, with a notification to the on-call channel when the run exceeds it
- BCheck the job's duration by hand once a week, comparing the numbers in a spreadsheet the team maintains manually
- CCount the number of times the job has run this year, since a larger count always means the job is taking longer
- DDisable notifications for the job, so that the on-call team is not disturbed by long runs that eventually finish
Show answer and explanationHide answer
Correct answer: AAn alert on duration against a baseline, sent to on-call, detects slowdowns early. Weekly manual checks are too slow, a run count does not measure duration, and disabling notifications hides the problem.
Data Governance (3 questions)
Question 25
A data owner wants to track which tables and columns feed a critical dashboard, so that a change to a source column can be assessed before it is made. Which Unity Catalog capability provides this?
- AA spreadsheet that each developer updates by hand after every change they make to any table in the workspace
- BA notebook that prints the table names it reads, which is run only once each year by the data owner
- CData lineage in Unity Catalog, which shows upstream and downstream dependencies for tables and columns
- DThe dashboard's refresh schedule, which lists the tables the dashboard reads each time it is refreshed
Show answer and explanationHide answer
Correct answer: CUnity Catalog lineage shows upstream and downstream dependencies at table and column level, which supports impact assessment. A hand-updated spreadsheet drifts, a yearly notebook is stale, and a refresh schedule does not list dependencies.
Question 26
A team wants a data product to be discoverable by other teams, with clear ownership and a defined quality level. Which combination supports this in Unity Catalog?
- AA dashboard that shows the table's row count, with no owner, description, or quality information attached to it
- BAn unlisted table that only the creator knows exists, shared through a private chat message when someone asks for it
- CA shared folder of exported files with no owner or description, named by the date each export was made
- DCatalog entries with owners and descriptions, plus tags that record the quality level, so consumers can find and judge the product
Show answer and explanationHide answer
Correct answer: DOwners, descriptions and quality tags in the catalog make a product discoverable and trustworthy for consumers. Unlisted tables, undescribed exports and row counts alone do not provide ownership or quality information.
Question 27
A data steward must find which downstream tables depend on a sensitive source table in Unity Catalog. Which feature shows this?
- AThe Delta table's Z-order index, which stores references to the tables that read from the source table in its metadata
- BThe table's comment field, which lists each downstream consumer by name whenever someone updates the comment text
- CLineage in Unity Catalog, which shows upstream and downstream table and column relationships for a selected table
- DAn export of the Hive metastore to CSV, which the steward then searches by hand for the source table name each time
Show answer and explanationHide answer
Correct answer: CUnity Catalog lineage shows how tables and columns flow upstream and downstream, which answers the dependency question directly. Comments, Z-order indexes and an exported metastore do not record relationships between tables.
Data Modelling (3 questions)
Question 28
A team designs a fact table for web events. Each event has a variable set of attributes that differ by event type. Analysts need to query common fields quickly and the rest flexibly. Which design fits best?
- AA separate table for every event type, with a manual union written into each report that needs to show all events
- BOne column per attribute across all event types, with most values null for every event type that does not use them
- CA single text column containing all attributes separated by commas, which analysts split by hand in each query they write
- DTyped columns for the common fields, plus a semi-structured column such as a variant or map for the variable attributes
Show answer and explanationHide answer
Correct answer: DTyped columns for common fields keep queries fast, and a semi-structured column holds variable attributes flexibly. A column for every attribute creates sparse tables, comma-separated text is hard to query, and a table per event type forces manual unions.
Question 29
A dimension table must keep one current row per product, and fact rows must always reference the current product key. Which pattern satisfies this when products are overwritten each day?
- AStore the product attributes inside each fact row, so that no dimension table or key is needed for product reporting
- BOverwrite the product table each day with the same key and no history, since the current row is the only one needed
- CAppend a new product row every day with a new key, and let fact rows point to whichever key was current for their date
- DKeep the product table unchanged forever and never update it, so that fact rows never see a changed product attribute
Show answer and explanationHide answer
Correct answer: CAppending a new versioned product row with a key and pointing facts to the key current at their date keeps history and current references correct. Overwriting loses history, storing attributes in facts duplicates them, and never updating leaves stale attributes.
Question 30
A warehouse team must keep the full history of a customer's address, while most queries need only the current address. Which dimensional approach fits?
- AA Type 2 slowly changing dimension with effective dates and a current flag on each version of the customer row
- BA Type 0 dimension that keeps the original address and never applies any later updates to the customer record at all
- CA factless fact table that records each address change as an event row with no measures or attributes stored with it
- DA Type 1 dimension that overwrites the address so that only the latest value is stored for each customer in the table
Show answer and explanationHide answer
Correct answer: AA Type 2 slowly changing dimension adds a new row for each change with effective dates and a current flag, which keeps full history while letting queries filter for the current version. Type 1 overwrites the history, and Type 0 never applies changes, so neither meets the requirement.