Sample questions
Question 1Easy
The main reason to partition a large table by date is to:
- Encrypt older data with a stronger key
- Guarantee that every row in the table has a unique primary key
- Make the table readable as plain text
- Let queries on a date range read only relevant data
Answer: D. Let queries on a date range read only relevant data
Explanation
Most analytical queries filter on time, so date partitions prune effectively.
Step-by-step solution
- Date partitioning splits data by time periods.
- Queries often filter data within specific dates.
- This reduces the amount of data scanned during a query.
- Only relevant data is accessed, improving performance.
- Final answer: Let queries on a date range read only relevant data.
Why the other options are wrong
- A. Stronger encryption for older data is not the purpose of date partitioning.
- B. Partitioning by date does not give each row a unique primary key; that is a separate constraint.
- C. Partitioning does not make a table readable as plain text; it organises storage by date.
Tip: Use date partitioning to speed up time-filtered queries.
Question 2Easy
- Column by column, grouped into row groups
- Row by row as comma-separated text
- As images of each table page
- As one JSON document per line
Answer: A. Column by column, grouped into row groups
Explanation
Columnar layout lets queries read only the columns they need.
Step-by-step solution
- Parquet is a columnar format, so data is stored column by column.
- Columns are grouped into row groups for efficient storage and retrieval.
- This allows queries to read only needed columns, improving performance.
- Row groups help in managing large datasets effectively.
- The correct answer is A (Column by column, grouped into row groups).
Why the other options are wrong
- B. Row-by-row comma-separated text is CSV, not Parquet, which is a binary columnar format.
- C. Parquet is not stored as images of table pages; it is a binary columnar file format.
- D. One JSON document per line describes JSON Lines, not Parquet's columnar layout.
Tip: Remember Parquet stores data column-wise, not row-wise.
Question 3Easy
- Relational database engine
- Workflow scheduler for pipelines
- Columnar file format for analytics
- Message queue for event streams
Answer: C. Columnar file format for analytics
Explanation
ORC and Parquet are both columnar formats with statistics and compression.
Step-by-step solution
- ORC stands for Optimized Row Columnar format.
- Parquet is also a columnar file format.
- Both ORC and Parquet store data in columns.
- This allows efficient analytics operations.
- So, ORC, like Parquet, is a columnar file format for analytics.
Why the other options are wrong
- A. ORC is a file format, not a relational database engine.
- B. ORC is a file format, not a workflow scheduler; schedulers run pipeline tasks.
- D. ORC is a file format, not a message queue for event streams.
Tip: Remember: ORC and Parquet are columnar formats used in data lakes for efficient querying.
Question 4Easy
Which file format carries no schema or type information on its own?
- ORC
- Parquet
- CSV
- Avro
Answer: C. CSV
Explanation
CSV is plain text; types must be inferred or declared by the reader.
Step-by-step solution
- CSV is plain text.
- It has no types or schema.
- Parquet, ORC and Avro embed schemas.
Why the other options are wrong
- A. ORC has a schema.
- B. Parquet has a schema.
- D. Avro has a schema.
Tip: CSV = no schema.
Question 5Medium
Projection pushdown (column pruning) means:
- Columns are converted into rows before reading
- Only the columns the query uses are read from storage
- The query plan is pushed to the client to run
- Only the rows the query uses are kept in memory, and the rest discarded
Answer: B. Only the columns the query uses are read from storage
Explanation
With columnar formats, unused columns are never read from disk.
Step-by-step solution
- Projection pushdown, also called column pruning, means the engine reads only the columns the query uses.
- With columnar formats, unused columns are never read from storage.
- So the answer is option B.
Why the other options are wrong
- A. Turning columns into rows is not projection pushdown; columnar storage keeps each column together.
- C. The query plan is not pushed to the client to run.
- D. Keeping only the needed rows in memory is not projection pushdown; projection is about columns.
Tip: Select only the columns you need; columnar storage then skips the rest.
Question 6Medium
A query reads 3 of a table's 60 columns, all of similar size. Roughly what fraction of the data does a columnar format need to read?
- 0.5%
- 100%
- 50%
- 5%
Answer: D. 5%
Explanation
3 / 60 = 5%; a row format would read every column.
Step-by-step solution
- A columnar format reads only needed columns.
- 3 of 60 columns.
- 3/60 = 5%.
Why the other options are wrong
- A. 0.5% is 10x too small.
- B. 100% is row-based.
- C. 50% is wrong.
Tip: Fraction = columns needed / total.
Question 7Medium
Sorting or clustering data by a frequently filtered column before writing Parquet helps because:
- Min/max ranges per row group narrow, so more groups are skipped
- Engines refuse to read unsorted Parquet files
- Sorted files are always exactly half the size of the same data unsorted
- Sorted columns no longer need any compression
Answer: A. Min/max ranges per row group narrow, so more groups are skipped
Explanation
When values are clustered, each row group covers a small range and data skipping works better.
Step-by-step solution
- Sorted data reduces the range of values in each row group.
- Smaller ranges allow more row groups to be skipped during queries.
- This improves query performance by reducing data scanned.
- Min/max ranges per row group narrow, so more groups are skipped.
- Final answer: Min/max ranges per row group narrow, so more groups are skipped.
Why the other options are wrong
- B. Engines do not refuse unsorted Parquet files; sorting only helps performance by allowing more skipping.
- C. Sorted files are not always exactly half the size; the saving depends on the data.
- D. Sorted columns still benefit from compression; sorting does not remove the need for it.
Tip: Sort frequently filtered columns to improve query performance.
Question 8Medium
Why are compressed CSV (gzip) files awkward for distributed processing?
- Gzip files cannot be read by any Spark job
- Each gzip file must first be loaded into a relational database before use
- Gzip makes the data larger than plain CSV
- A single gzip file cannot be split, so one task must read it all
Answer: D. A single gzip file cannot be split, so one task must read it all
Explanation
Gzip is not splittable; splittable formats like Parquet allow parallel reads of one large file.
Step-by-step solution
- Spark gives each task one split of the input, and splits come from the file layout.
- Gzip is not a splittable codec, so a whole gzip file must be read by a single task.
- One large gzip file therefore cannot be read in parallel.
- The correct answer is option D: a single gzip file cannot be split.
Why the other options are wrong
- A. Spark does read gzip CSV files; the problem is parallelism, not support.
- B. Spark reads gzip files directly; they do not need a database load first.
- C. Gzip usually makes files smaller, and file size is not the issue here.
Tip: Use splittable formats such as Parquet, or split data into many files, for parallel reads.
Question 9Hard
Run-length encoding a sorted column [A, A, A, A, B, B, C, C, C] stores runs as (value, count). How many runs are stored?
- 3
- 6
- 1
- 9
Answer: A. 3
Explanation
The runs are (A, 4), (B, 2) and (C, 3).
Step-by-step solution
- Run-length encoding groups same values together.
- The column has four A's, two B's and three C's.
- Each group is one run: (A, 4), (B, 2), (C, 3).
- Total runs = 3.
Why the other options are wrong
- B. Six does not match the runs; equal neighbouring values form one run each, giving three runs for A, B and C.
- C. One run would need all values equal; this column has three different values, so there are three runs.
- D. Nine counts every value, but run-length encoding stores one entry per group, giving three runs.
Question 10Hard
Why is user_id (millions of distinct values) usually a poor partition column?
- It makes the table impossible to compress
- It creates a huge number of tiny partitions and files
- Partition columns must always be dates or small integers, never IDs
- Partition columns must be dates or numbers only
Answer: B. It creates a huge number of tiny partitions and files
Explanation
Very high cardinality explodes directory and file counts; low-to-moderate cardinality columns like date work better.
Step-by-step solution
- User_id has millions of distinct values.
- Partitioning by it creates a directory, and often files, for each value.
- That gives a huge number of tiny partitions and files, which slows listing and queries, so the answer is option B.
Why the other options are wrong
- A. Partitioning does not stop a table from being compressed.
- C. Partition columns are not limited to dates; the real problem is too many distinct values, so this rule is too strong.
- D. Partition columns are not limited to dates and numbers; the problem is the number of distinct values.
Tip: Partition by a column with low-to-moderate cardinality, such as a date; avoid high-cardinality IDs.
Practise all 21 questions free
The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.
Open this topic in the app →