Home / DE Associate practice test / Data Transformation and Modeling / Question

Databricks Data Engineer Associate · free practice question

A dashboard needs a fast, approximate count of unique visitors over billions of rows, where a small error margin is acceptable in exchange for much lower…

Exam-style question on Data Transformation and Modeling from the free DE Associate practice test, with the answer and a full explanation below.

Updated November 10, 2026

Data Transformation and Modeling

A dashboard needs a fast, approximate count of unique visitors over billions of rows, where a small error margin is acceptable in exchange for much lower compute cost than an exact distinct count. Which function is the right choice?

  1. Acount(distinct visitor_id), which Spark answers from table statistics at a lower compute cost than a sketch-based estimate.
  2. Bcount("visitor_id"), which scans the column and returns the number of distinct visitor ids present at a low compute cost.
  3. Capprox_count_distinct("visitor_id"), which estimates the unique-visitor count from a HyperLogLog sketch with a small bounded error.
  4. Dsum("visitor_id"), which adds the visitor id values in the column and treats the resulting grand total as the unique-visitor figure.
  5. Efirst("visitor_id"), which samples one visitor id from the column and extrapolates the distinct cardinality from that sampled value.
Answer & explanation

Correct answer: C

WHY C: approx_count_distinct uses a HyperLogLog sketch to estimate cardinality with a small, bounded error at a fraction of the cost of an exact distinct count, which is ideal for billions of rows where approximation is acceptable.

WHY NOT A: An exact count(distinct ...) is not answered from table statistics; it has to shuffle and deduplicate the values, so it is more expensive at scale, not cheaper than a sketch.

WHY NOT B: count counts non-null rows, not distinct values, so it overcounts unique visitors.

WHY NOT D: Summing ids is meaningless as a measure of cardinality.

WHY NOT E: first returns a single value and estimates nothing about the distinct count.

Take the full DE Associate practice test free →

Would you pass today?

This question is one of 45 in the free, timed Databricks Data Engineer Associate practice test. Take it and get a section-by-section score.

Start the free test →