Week 21: Quiz (10 questions, 8/10 to pass)
Answer each, then check against the answer key. Each question ends with a pointer to the Concepts section (§) or notebook cell it tests.
(MCQ) In Unity Catalog's three-level namespace
catalog.schema.object, which of the following is a valid object type? (see Concepts §UC is governance)- A) metastore
- B) volume
- C) workspace
- D) compute plane
(MCQ) You run
VACUUMon a Delta table with default settings, then trySELECT * FROM tbl TIMESTAMP AS OF '30 days ago'. What happens? (see Concepts §Delta gives time travel)- A) It always works, VACUUM only compacts files
- B) It fails, because data files older than 7 days were permanently deleted
- C) It returns an empty table but no error
- D) It returns an error only if the table is partitioned
(Short answer) Why is a Unity Catalog privilege model described as "additive-only," and what are the two privilege kinds a principal needs to read
zrl_.silver.shipments? (see Concepts §privilege model)(MCQ) In notebook
02-medallion-sql.ipynb, the silver query dedupes withROW_NUMBER() OVER (PARTITION BY shipment_id ORDER BY planned_departure)and keepsWHERE rn = 1. What would break if you partitioned bycarrier_idinstead? (see Concepts §medallion; notebook 02 cell 4)- A) Nothing, carrier_id is also unique per row
- B) Distinct shipments from the same carrier would be collapsed
- C) The imputation would stop working
- D) Time travel would fail
(MCQ) Which statement about managed vs. external tables is correct? (see Concepts §Unity Catalog)
- A)
DROP TABLEdeletes data for both - B)
DROP TABLEdeletes data only for managed tables - C) External tables cannot be Delta
- D) Managed tables require a
LOCATIONclause
- A)
(Short answer) Notebook
01-unity-catalog-and-delta-lab.ipynbends by printingbronze rowsandtime-travel versions. Explain why thetime_travel_demotable has exactly 2 versions after the lab runs. (see Notebook walkthrough; notebook 01 cells 9 to 12)(MCQ) You want a filter column (
carrier_id) to enable data skipping but you anticipate re-keying the layout later. Which feature should you use on a new table? (see Concepts §Delta gives time travel)- A) Hive partitioning
- B)
ZORDER BYonly - C) Liquid clustering (
CLUSTER BY) - D)
OPTIMIZEonly
(Short answer) In the worked GRANT example, why must
zrl_analystsreceiveUSE CATALOG ON CATALOG zrl_andUSE SCHEMAandSELECTrather than justSELECTon the table? (see Concepts §privilege model)(MCQ) The notebook
%sqlcellCREATE OR REPLACE TABLE shipments_bronze AS SELECT * FROM read_files('/Volumes/zrl_/zorologistics/raw/shipments.csv', format => 'csv', header => true, inferSchema => true)produces a Delta table because… (see Notebook walkthrough)- A)
read_filesonly outputs Delta - B) Delta is the default table format on Databricks unless you say otherwise
- C) the CSV was already converted by the generator
- D) it is a streaming table
- A)
(MCQ) Which of the following is a consequence of liquid clustering rather than Hive partitioning? (see Concepts §Delta gives time travel)
- A) You can change clustering keys without rewriting the table
- B) It makes time travel impossible
- C) It requires enabling deletion vectors
- D) It is incompatible with
VACUUM
Answer key
B: volume. A volume is a governed object at the
catalog.schema.objectlevel; the metastore is the registry above the catalog, and workspace/compute plane are platform concepts, not UC objects.B: it fails. VACUUM permanently removes data files older than the retention window (default 7 days), so time travel past that window is impossible.
Additive-only means there is no
DENY: a principal can only gain privileges, and the default is "nothing." To read the table a principal needs traversal (USE CATALOG zrl_+USE SCHEMA silver) and action (SELECTon the table). Both kinds are required.B. Partitioning by
carrier_idand keeping one row per partition would collapse all of a carrier's distinct shipments into one;shipment_idis the natural key that must stay unique.B.
DROP TABLEdeletes data only for managed tables; external tables drop metadata only (the data stays in your storage).Two versions = the
CREATE OR REPLACE(version 1, 1,000 rows) and theINSERT(version 2, another 1,000 rows). Each write appends a new transaction log entry, soDESCRIBE HISTORYshows exactly two versions, andVERSION AS OF 1reads the 1,000-row state while current reads 2,000.C: liquid clustering.
CLUSTER BYcolocates data for skipping and lets you change keys without a rewrite;ZORDER BYalone cannot be re-keyed without rewriting.Privileges inherit down, but traversal and action are separate.
SELECTon a table is not enough by itself, the principal must first reach the container withUSE CATALOGandUSE SCHEMA. UC requires the traversal chain plus the action; a bareSELECTgrant withoutUSEgrants on the parents would not permit the read.B. Delta is the default storage layer, every table created on Databricks is a Delta table unless configured otherwise, so
CREATE … AS SELECT FROM read_fileslands as a governed Delta table.A. Liquid clustering's headline benefit over Hive partitioning/Z-order is that you can change the clustering keys without rewriting the table.