Courseiva

CCNA Data Modelling Questions

22 questions · Data Modelling · All types, answers revealed

1
MCQmedium

Refer to the exhibit. The engineer wants to replace only one specific partition in the 'orders' table. What is the best method in Databricks?

A.Run a DELETE statement for the partition and then an APPEND.
B.Use the MERGE command to overwrite only the records in the specific partition.
C.Set 'spark.databricks.delta.retentionDurationCheck.enabled' to false.
D.Enable dynamic partition overwrite mode and perform an INSERT OVERWRITE.
AnswerD

Enabling 'spark.sql.sources.partitionOverwriteMode=dynamic' allows you to replace only the partitions that exist in the write data. This is the correct, atomic, and efficient way to replace a specific date partition without affecting other partitions, making it the standard best practice for partition-level updates in Databricks.

Why this answer

Using 'partitionOverwriteMode=dynamic' with a standard INSERT OVERWRITE operation is the correct way to replace a single partition without affecting the entire table. The default behavior is 'static', which overwrites the whole table. By setting the dynamic mode, the system identifies the partitions present in the incoming data and replaces only those, ensuring minimal impact and preventing accidental data loss across the entire dataset during the overwrite process.

Exam trap

Candidates often overlook the default 'static' partition overwrite mode, which causes them to accidentally delete the entire table content when they only intended to update a single partition.

2
MCQmedium

Which of the following describes the purpose of the 'Gold' layer in a Lakehouse?

A.To store the raw data in an immutable format for historical auditing.
B.To serve as a staging area for data cleaning and filtering.
C.To store business-ready data for analytical use cases.
D.To store only metadata for the entire Lakehouse architecture.
AnswerC

The Gold layer provides final, aggregated datasets that are ready for BI and reporting. By presenting data in this format, it masks the underlying complexity of the raw and silver data, providing a performant and understandable view of the business to end-users and non-technical stakeholders.

Why this answer

The Gold layer is designed for high-performance analytical queries and business intelligence. By storing data in a denormalized or star schema, and by applying business-level aggregations and business rules, this layer is the primary source of truth for downstream reporting tools. It is optimized for the needs of business users, ensuring that they can access consistent and performant data without having to perform complex joins or transformations themselves.

Exam trap

Candidates often misidentify the Gold layer as the location for raw data ingestion or initial data cleaning, confusing it with the Bronze or Silver layers where data is still evolving.

3
MCQhard

A company requires data to be physically deleted from the Bronze layer for GDPR compliance. What is the correct procedure to ensure complete removal?

A.Simply run the DELETE statement; Delta handles physical deletion automatically.
B.Run the DELETE statement and then run the VACUUM command.
C.Use the OPTIMIZE command to force the deletion of the records.
D.Overwriting the table with a filtered subset using the OVERWRITE option.
AnswerB

The DELETE command updates the Delta log to exclude the records from future reads. Running VACUUM removes the orphaned files that contain the deleted data. This combination ensures the records are both logically and physically removed from the data lake, fulfilling the legal requirements of GDPR compliance.

Why this answer

Under GDPR, 'deletion' requires the actual removal of data from all storage locations. In Delta Lake, running a DELETE statement followed by a VACUUM command is necessary. DELETE removes the records from the active state, but the underlying data files remain until VACUUM removes them.

This two-step process ensures the data is logically removed, and then physically purged from the storage provider, satisfying the right to be forgotten.

Exam trap

Candidates frequently select only the DELETE statement, forgetting that Delta Lake maintains historical versions of data files. Without VACUUM, the data remains physically present in the storage layer for recovery purposes.

4
MCQmedium

A financial services firm maintains a Delta Lake table of account transactions that must support both current-state queries and full audit history of every change, including corrections that arrive days later. Regulators require the ability to query the table as it existed at any prior date. Which Delta Lake capability should the engineer rely on to satisfy the audit requirement?

A.Time travel using the transaction log to query historical versions of the table by version number or timestamp
B.Relying on the underlying cloud object store's versioning to recover previous Parquet files
C.Maintaining a separate archive table populated by a nightly full copy of the transactions table
D.Enabling Change Data Feed to capture row-level changes and querying the feed instead of the table
AnswerA

Delta Lake records every commit in the transaction log, so time travel can reconstruct the table as of a specific version or timestamp, directly satisfying the requirement to query prior states. Corrections create new versions rather than destroying old ones, so auditors can retrieve the exact state at any retained point in time using the same table.

Why this answer

Delta Lake's transaction log records each commit atomically, enabling time travel to any retained version or timestamp. Because late corrections create new versions while prior versions remain queryable, auditors can reconstruct the exact table state at a prior date, which is precisely what the regulatory requirement demands.

Exam trap

The trap here is treating Change Data Feed as a historical snapshot mechanism, when it only surfaces row-level change records rather than a complete reconstructable table state at an arbitrary point in time.

5
MCQeasy

What is the primary benefit of the Medallion architecture in a Databricks Lakehouse?

A.It eliminates the need for data partitioning and Z-Ordering.
B.It provides a clear progression of data quality and structure.
C.It forces all data to be stored in a star schema at all layers.
D.It automatically converts all incoming data to a structured format.
AnswerB

The medallion architecture organizes data into Bronze, Silver, and Gold to represent increasing levels of refinement. This structured approach allows teams to manage data quality incrementally, ensures that business logic is applied consistently, and provides an immutable raw history that can be reprocessed whenever requirements change.

Why this answer

The Medallion architecture provides a clear, structured progression of data quality. By segregating data into Bronze (raw), Silver (cleaned), and Gold (refined) layers, organizations can maintain an immutable audit trail while enabling both technical teams and business analysts to consume the data at the appropriate level of abstraction. This structure simplifies data governance, incremental processing, and data quality management, which are fundamental to building a reliable Lakehouse.

Exam trap

Candidates often mistake Medallion architecture for a data storage optimization technique, focusing on performance gains rather than the primary goal of improving data quality and organizational structure.

6
MCQeasy

An engineer is building a Gold-layer star schema for a sales analytics workload. The business wants to analyze revenue by product, by store, and by promotion independently, and also drill down through a hierarchy of region to country to city. Which dimensional modeling structure best supports these requirements?

A.A fully normalized third-normal-form schema with separate tables for each attribute level
B.A star schema with conformed dimensions that include hierarchical attributes for drill-down
C.A snowflake schema that normalizes each hierarchy level into its own dimension table
D.A single wide denormalized table that embeds all dimensional attributes directly in the fact rows
AnswerB

A star schema places a central fact table joined to denormalized dimensions, and including hierarchical attributes such as region, country, and city within the geography dimension lets analysts drill down without extra joins. Conformed dimensions shared across facts like sales and promotions allow consistent analysis by product, store, and promotion independently while keeping queries simple.

Why this answer

Independent analysis by product, store, and promotion with hierarchical drill-down is the classic use case for a star schema built on conformed dimensions. Denormalized dimensions keep joins few, conformed dimensions keep definitions consistent across facts, and embedded hierarchy attributes like region, country, and city enable drill-down without additional tables.

Exam trap

The trap here is equating normalization with good modeling and choosing a snowflake or 3NF design, when the stated need for simple, consistent drill-down favors a star schema with conformed dimensions.

7
MCQmedium

A Databricks workspace has a Delta table 'transactions' partitioned by 'txn_date'. Analysts frequently run queries that filter on 'txn_date' but also occasionally filter on 'account_id' alone. The table has 10 TB of data, and the team wants to improve performance for the 'account_id' queries without changing the partitioning scheme. Which Delta feature should they implement?

A.Z-ORDER BY account_id
B.Partition the table by account_id as well as txn_date
C.Enable Delta Lake change data feed
D.Convert the table to a Hive table
AnswerA

Z-Ordering colocates related data in the same set of files, so queries filtering on account_id can skip many files. It is ideal when the table is already partitioned by txn_date and you need to optimize a secondary column without repartitioning. Running OPTIMIZE ... Z-ORDER BY account_id will reorganize data within each partition, improving data skipping for account_id filters.

Why this answer

Z-Ordering is the correct approach because it reorganizes data within existing partitions to improve data skipping for the specified columns without altering the partition structure. It is specifically designed to optimize queries on high-cardinality columns like account_id. Partitioning by account_id would cause scalability issues, CDF is for change tracking, and Hive tables lack Delta optimizations.

Exam trap

The trap here is assuming that adding another partition column will automatically improve filtering, when high-cardinality partitioning often causes small-file problems and slower queries.

8
MCQmedium

A retail company uses a Databricks Lakehouse with a star schema in the Gold layer. Their fact_sales table has billions of rows and is partitioned by sale_date. Analysts frequently run queries that filter on product_id and join to dim_product. Currently, queries scanning the entire fact table are slow. To improve performance for these queries, which approach is most appropriate?

A.Partition the fact_sales table by product_id.
B.Convert the fact_sales table to a Parquet table and use partition pruning.
C.Apply Z-ORDER BY product_id on the fact_sales table.
D.Add a bloom filter index on product_id.
AnswerC

Z-ORDER BY product_id co-locates related product_id values within each partition, enabling data skipping when filtering on product_id. This reduces the amount of data scanned during joins and filters, directly improving query performance for the described workload. It is a common optimization for high-cardinality columns used in filters and joins.

Why this answer

Z-ORDER BY product_id clusters data within each partition, allowing Delta Lake to skip files that do not contain the filtered product_id values. This reduces I/O and speeds up queries that filter or join on product_id. Partitioning by product_id is impractical due to high cardinality, and the other options do not provide the needed optimization.

Exam trap

The trap here is assuming that partitioning by a frequently filtered column is always beneficial, when high-cardinality columns should instead be optimized with Z-ORDER.

9
MCQhard

A financial institution uses a Databricks Lakehouse with a Silver table transactions that is partitioned by transaction_date. The table is frequently queried with filters on transaction_date and account_id. The data engineering team notices that queries filtering on account_id are slow because they scan all partitions. They want to optimize the table to accelerate these queries without repartitioning. Which Delta Lake feature should they use?

A.Partition the table by account_id as well.
B.Convert the table to a Parquet table and use predicate pushdown.
C.Z-ORDER BY account_id
D.Enable change data feed on the table.
AnswerC

Z-ORDER BY account_id will co-locate similar account_id values within each partition, enabling data skipping for filters on account_id. Since the table is already partitioned by transaction_date, this adds efficient skipping for account_id without changing the partitioning scheme. This directly addresses the slow queries filtering on account_id.

Why this answer

Z-ORDER BY account_id clusters data within each partition by account_id, allowing Delta Lake to skip files that do not contain the filtered account_id values. This accelerates queries filtering on account_id without altering the existing partitioning by transaction_date. Other options either do not improve performance or introduce negative side effects.

Exam trap

The trap here is thinking that adding another partition column will solve the problem, but high-cardinality columns are better handled with Z-ORDER to avoid the small file problem.

10
MCQmedium

A retail company is designing a Gold-layer dimension table in Delta Lake for its product catalog. The catalog changes slowly: a product's category is occasionally reclassified, but historical sales fact rows must continue to reflect the category that was valid at the time of each sale. The team wants to avoid duplicating the entire product row for every change. Which Delta Lake modeling technique should the engineer implement?

A.A junk dimension that collapses category combinations into a separate table keyed by a surrogate
B.Type 1 slowly changing dimension implemented with MERGE INTO that overwrites the category column in place
C.A Type 3 dimension that adds a previous_category column to the existing product row
D.Type 2 slowly changing dimension with effective-date and current-flag columns populated via MERGE INTO
AnswerD

A Type 2 dimension inserts a new versioned row whenever the category changes and closes the prior row with an end date, preserving history. Fact rows can then join on the surrogate key or on the effective-date range valid at the transaction timestamp, so each sale continues to show the correct historical category without duplicating the whole catalog for unchanged attributes.

Why this answer

Preserving point-in-time accuracy for a slowly changing attribute requires versioned dimension rows with validity ranges and a current flag, which is the defining behavior of a Type 2 slowly changing dimension. A MERGE INTO statement can close the existing row and insert a new one atomically, letting fact rows resolve the correct historical category through an effective-date join or surrogate key.

Exam trap

The trap here is assuming that overwriting the category in place is acceptable because the requirement only mentions the current catalog view, when the point-in-time accuracy clause specifically demands versioned history.

11
MCQhard

An engineer needs to optimize a massive table that is frequently joined with other large tables. Which strategy is most effective for performance?

A.Increase the number of partitions to spread the data across more nodes.
B.Apply Z-Ordering to the join keys.
C.Cast all join keys to strings to ensure data type compatibility.
D.Use a broadcast join for all large-table join operations.
AnswerB

Z-Ordering on join keys physically co-locates related data, which is essential for join efficiency. This reduces the need for extensive shuffling during join operations, as the compute engine can perform more efficient local joins. This is a critical optimization for large-scale analytical tables within the Lakehouse architecture.

Why this answer

For large-scale joins, the most effective strategy is to Z-Order the join keys. This ensures that records with the same join keys are physically stored together, allowing the Databricks engine to use merge joins rather than costly shuffle-heavy hash joins. By minimizing data movement across the cluster during the shuffle phase, Z-Ordering on join keys significantly reduces execution time and resource consumption for complex, large-scale join operations.

Exam trap

Candidates often suggest partitioning by the join key, failing to realize that high-cardinality join keys result in millions of small files, which severely degrades cluster performance.

12
MCQmedium

Which design pattern is best suited for handling late-arriving data in a medallion architecture?

A.Discard all late-arriving records to ensure a clean source-of-truth.
B.Update the Silver layer using a MERGE operation that matches on event time.
C.Append late-arriving data to the Bronze layer but ignore it in all downstream layers.
D.Create a separate 'late_data' table and join it to the main table every month.
AnswerB

The MERGE operation is ideal for late-arriving data because it can identify existing records and update them with the corrected information. By using event time as a matching key, the pipeline can ensure that even if data arrives out of order, the state of the Silver table remains accurate.

Why this answer

Late-arriving data is common in streaming and batch pipelines. Using a watermarking strategy combined with a merge or upsert operation allows the system to process incoming data while maintaining the integrity of historical windows. By allowing late records to update existing states, the system remains accurate despite delays from the source, which is critical for time-sensitive financial or operational reporting where accuracy is paramount.

Exam trap

Candidates often suggest using append-only strategies or creating separate tables for late data, which complicates downstream consumption and breaks the integrity of historical reporting.

13
MCQmedium

A logistics company wants to analyze shipment delays. The fact table `fact_shipments` has a `delay_minutes` measure. The team needs to slice delays by the reason for delay, which can be one of several predefined categories. Which dimension modeling approach is most suitable?

A.Create a dimension table `dim_delay_reason` with a surrogate key and reference it from the fact table.
B.Create a snowflake schema by normalizing delay reasons into multiple tables.
C.Use a junk dimension to combine delay reason with other low-cardinality attributes.
D.Store the delay reason as a string column directly in the fact table.
AnswerA

A dedicated dimension table for delay reasons allows efficient slicing and grouping. It ensures consistency and supports adding new reasons without altering the fact table. This is a standard star schema approach. In Databricks, it can be joined efficiently and optimized with Z-ORDER.

Why this answer

A dedicated dimension table for delay reasons provides a clean, efficient way to slice shipment delays. It supports consistent categorization and easy addition of new reasons. Storing as a string in the fact table or snowflaking adds performance and maintenance overhead.

A junk dimension would obscure the ability to analyze by delay reason alone.

Exam trap

The trap here is thinking that storing the reason as a string in the fact table is simpler and sufficient, but it leads to poor query performance and data quality issues.

14
MCQeasy

In the medallion architecture, which layer is primarily responsible for applying business logic and historical aggregations?

A.The Bronze layer acts as the primary layer for historical aggregation and business logic.
B.The Silver layer is designed for applying complex business logic and final aggregations.
C.The Gold layer is designed for applying business logic and historical aggregations.
D.The Raw layer stores all business logic results for future auditing.
AnswerC

Gold is the analytical layer. It transforms Silver data into business-ready aggregates, KPIs, and reports. By focusing on business logic here, the engineering team ensures that the data is prepared specifically for downstream consumption, reducing the computational load on end-user tools while ensuring consistent metrics across the organization.

Why this answer

The Gold layer is the final stage of the medallion architecture, where data is prepared for consumption by BI tools and data science applications. It involves cleaning, transforming, and aggregating data according to business rules. This layer represents the 'source of truth' for analytical reporting, as it is structured to support specific business use cases rather than representing the raw or cleaned granular data found in earlier layers.

Exam trap

Test-takers frequently confuse the Silver layer with the Gold layer, incorrectly assuming historical aggregations and business-level logic happen before data cleansing and integration are fully complete.

15
MCQmedium

A data engineer is designing a Gold layer table for a retail company. The table must support efficient queries that filter on product_category (low cardinality) and sort by transaction_timestamp (high cardinality). The table is expected to grow to petabytes. Which Delta Lake table design should the engineer choose to optimize both filtering and sorting?

A.Z-ORDER BY both product_category and transaction_timestamp.
B.Partition by product_category only, without Z-ORDER.
C.Partition by product_category and Z-ORDER BY transaction_timestamp.
D.Partition by transaction_timestamp and Z-ORDER BY product_category.
AnswerC

Partitioning by product_category, which has low cardinality, avoids the small file problem and enables partition pruning for filters on that column. Z-ORDER BY transaction_timestamp clusters data within each partition to accelerate sorting and range queries on that column. This combination optimally supports both filtering and sorting.

Why this answer

Partitioning by the low-cardinality product_category enables efficient partition pruning for filters. Z-ORDER BY the high-cardinality transaction_timestamp clusters data within partitions, speeding up sorting and range queries on that column. This combined approach leverages both partitioning and Z-ORDER appropriately, avoiding the pitfalls of partitioning on high-cardinality columns.

Exam trap

The trap here is partitioning by a high-cardinality column like transaction_timestamp, which leads to many small partitions and poor performance.

16
Multi-Selecthard

A data engineer is designing a Gold layer table that must support slowly changing dimension (SCD) Type 2 for a customer dimension. The source data arrives daily with updates to customer attributes. The engineer wants to implement this using Delta Lake. Which two features or techniques are essential for maintaining SCD Type 2? (Choose two.)

Select 2 answers
A.Using Delta Lake's generated columns for surrogate keys
B.Partitioning the dimension table by effective_start_date
C.MERGE INTO with condition on business key and effective dates
D.Delta Lake time travel to query previous versions
E.Adding columns for effective start date, end date, and current flag
AnswersC, E

MERGE INTO is essential for SCD Type 2 because it allows updating existing records (e.g., setting end dates) and inserting new versions in a single atomic operation. By joining on the business key and comparing effective dates, you can expire old rows and add new ones. This ensures historical accuracy and ACID compliance in Delta Lake.

Why this answer

SCD Type 2 requires a mechanism to expire old records and insert new ones, which is achieved with MERGE INTO. Additionally, the dimension table must include columns to track the validity period of each version, such as effective dates and a current flag. Time travel, generated columns, and partitioning are not essential for implementing SCD Type 2.

Exam trap

The trap here is confusing time travel with SCD Type 2 maintenance; time travel is for reading historical snapshots, not for managing dimension history.

17
MCQeasy

A retail company wants to analyze sales by product, store, and date. The data team is designing the Gold layer and needs to choose between a star schema and a snowflake schema. Which factor most strongly favors a star schema in a Databricks Lakehouse?

A.Star schemas simplify queries and improve performance by minimizing joins.
B.Star schemas reduce data redundancy by normalizing dimension tables.
C.Star schemas enforce referential integrity through foreign key constraints.
D.Star schemas require less storage space than snowflake schemas.
AnswerA

Star schemas use denormalized dimensions, which reduces the number of joins needed for analytical queries. This simplicity leads to faster query performance, especially in a Lakehouse where join operations can be expensive. Databricks' Photon engine and Delta Lake optimizations work well with star schemas. This is a key reason to choose a star schema.

Why this answer

Star schemas minimize joins by denormalizing dimensions, which simplifies queries and boosts performance. In Databricks, this aligns well with Delta Lake and Photon optimizations. Snowflake schemas normalize dimensions, increasing joins and complexity.

Storage and referential integrity are not primary advantages of star schemas.

Exam trap

The trap here is assuming that star schemas reduce redundancy, but they actually increase redundancy to improve query performance.

18
MCQhard

A healthcare company uses a Databricks Lakehouse. The Silver layer contains a table patient_visits that is updated with late-arriving data. The table is partitioned by visit_date. The data engineering team needs to efficiently merge new data that may include updates to existing records and inserts of new records. They want to minimize the impact on existing data and ensure ACID compliance. Which Delta Lake operation should they use?

A.Use Delta Lake change data feed to apply changes.
B.INSERT OVERWRITE patient_visits SELECT * FROM new_data
C.DELETE FROM patient_visits WHERE visit_id IN (SELECT visit_id FROM new_data); INSERT INTO patient_visits SELECT * FROM new_data
D.MERGE INTO patient_visits USING new_data ON patient_visits.visit_id = new_data.visit_id WHEN MATCHED THEN UPDATE SET * WHEN NOT MATCHED THEN INSERT *
AnswerD

The MERGE operation allows for efficient upserts by matching on visit_id. It updates existing records and inserts new ones in a single ACID transaction, minimizing data rewriting. This is the standard approach for handling late-arriving data in Delta Lake and ensures atomicity and consistency.

Why this answer

The MERGE statement is designed for upserts, allowing updates to existing records and inserts of new records in one atomic operation. It minimizes data rewriting by only touching affected files and maintains ACID compliance. Other options either overwrite data, are non-atomic, or do not apply changes.

Exam trap

The trap here is using INSERT OVERWRITE or a delete-then-insert pattern, which can lead to data loss or non-atomic operations.

19
MCQeasy

A data engineer is building a Silver layer table that combines data from multiple Bronze tables. The engineer wants to ensure that the Silver table only contains the most recent version of each record based on a 'last_updated' timestamp. Which Delta Lake operation should be used to achieve this?

A.DELETE then INSERT the new records
B.Use Delta Lake time travel to revert to a previous version
C.INSERT OVERWRITE with the entire dataset
D.MERGE INTO with a condition that updates when the source timestamp is greater
AnswerD

MERGE INTO allows you to update existing records when the incoming data has a newer timestamp and insert new records when they don't exist. This ensures that the Silver table always reflects the latest version. It is the standard way to upsert data in Delta Lake while maintaining ACID compliance.

Why this answer

MERGE INTO is the correct operation because it can conditionally update existing rows with newer timestamps and insert new rows, ensuring the Silver table contains only the latest version of each record. INSERT OVERWRITE, DELETE+INSERT, and time travel do not provide the same atomic upsert capability and would either be inefficient or incorrect for this scenario.

Exam trap

The trap here is thinking that INSERT OVERWRITE is sufficient for incremental updates, but it actually replaces all data and does not handle record-level versioning.

20
MCQmedium

Refer to the exhibit. An engineer observes that queries filtering on 'customer_id' are running slowly despite Z-Ordering. What is the most likely cause?

A.The partition columns should include 'customer_id' to improve the pruning speed.
B.Z-Ordering must be performed on the partition columns instead of the join columns.
C.The queries lack filters on 'region' or 'date', preventing effective partition pruning.
D.The file format should be changed to Parquet to improve individual file read performance.
AnswerC

Because the table is partitioned by region and date, failing to include these in the WHERE clause forces the engine to scan every partition. Z-Ordering only clusters data within individual partitions. If the engine doesn't prune the partitions first, the Z-Ordering benefits are largely ignored during the scan.

Why this answer

The exhibit shows that the table is partitioned by 'region' and 'date', while Z-Ordering is applied to 'customer_id'. If queries filter on 'customer_id' but do not provide 'region' or 'date', the engine must scan all partitions. Z-Ordering is only effective within each partition.

If the data is not well-clustered or the partitions are too large, the engine cannot skip files effectively, leading to high latency during execution.

Exam trap

Candidates often blame the Z-Ordering configuration itself, assuming it is broken, rather than realizing that Z-Ordering cannot overcome the lack of partition pruning in the query filter.

21
Multi-Selecthard

A data engineering team is modeling a large Delta Lake fact table that stores clickstream events. Analysts frequently run queries that filter by event_date and then aggregate by user_id, and the table receives continuous appends plus occasional late-arriving corrections. The team wants to reduce bytes scanned and improve join performance. Which two design choices are most appropriate? (Choose two.)

Select 2 answers
A.Convert the table to a Parquet external table and rely on the query engine to infer partitioning
B.Partition the table by event_date and apply Z-ORDER on user_id within each partition
C.Use liquid clustering on event_date and user_id instead of traditional Hive-style partitioning
D.Enable Change Data Feed on the table so late-arriving corrections are captured automatically
E.Partition the table by user_id to maximize file skipping for user-level aggregations
AnswersB, C

Partitioning by event_date enables partition pruning so queries filtering on a date range skip unrelated files, while Z-ORDER on user_id co-locates related user rows within each partition's files. Together they reduce bytes scanned for both the date filter and the user aggregation, and Z-ORDER statistics let Delta skip files whose user_id min/max ranges fall outside the predicate.

Why this answer

The workload filters on event_date and aggregates by user_id, so layout must accelerate both. Partitioning by event_date with Z-ORDER on user_id gives reliable partition pruning plus co-located user data, while liquid clustering on both columns achieves similar skipping without rigid high-cardinality directories and can be adapted incrementally as access patterns change.

Exam trap

The trap here is reaching for a high-cardinality partition column like user_id, which feels aligned with the aggregation but in practice creates a small-file problem and does nothing for the dominant date filter.

22
MCQmedium

A financial institution is building a Gold layer table that must support point-in-time queries to reconstruct account balances as of any past date. The source data includes transactions with effective dates and an audit log of changes. Which modeling technique is most appropriate?

A.Use Delta Lake time travel to query previous versions of the table.
B.Use a Type 1 slowly changing dimension (SCD) to overwrite old values.
C.Create a Type 3 slowly changing dimension (SCD) with previous value columns.
D.Implement a Type 2 slowly changing dimension (SCD) with effective start and end dates.
AnswerD

Type 2 SCD preserves history by creating new rows for changes, with effective start and end dates. This allows point-in-time queries by filtering on the desired date. In Databricks, this can be implemented using Delta Lake's merge operations and time travel. It is the standard technique for temporal analysis in data warehousing.

Why this answer

A Type 2 SCD retains full history by adding new rows with effective date ranges, enabling accurate point-in-time queries. This is essential for financial data where past states must be reconstructable. Delta Lake time travel is limited by retention and not designed for continuous history.

Type 1 and Type 3 SCDs lack the necessary historical depth.

Exam trap

The trap here is confusing Delta Lake time travel with a full history tracking mechanism, but time travel only retains versions for a limited period and does not model changes explicitly.

Ready to test yourself?

Try a timed practice session using only Data Modelling questions.