Columnar Formats & Partitioning Questions with Answers

21 practice questions on Columnar Formats & Partitioning (Data Engineering) with answers and step-by-step solutions. Try 10 samples below, then practise all 21 free in the AptiNest app.

Sample questions

Question 1Easy

The main reason to partition a large table by date is to:

  1. Encrypt older data with a stronger key
  2. Guarantee that every row in the table has a unique primary key
  3. Make the table readable as plain text
  4. 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

  1. Date partitioning splits data by time periods.
  2. Queries often filter data within specific dates.
  3. This reduces the amount of data scanned during a query.
  4. Only relevant data is accessed, improving performance.
  5. 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

Parquet stores data:

  1. Column by column, grouped into row groups
  2. Row by row as comma-separated text
  3. As images of each table page
  4. 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

  1. Parquet is a columnar format, so data is stored column by column.
  2. Columns are grouped into row groups for efficient storage and retrieval.
  3. This allows queries to read only needed columns, improving performance.
  4. Row groups help in managing large datasets effectively.
  5. 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

ORC, like Parquet, is a:

  1. Relational database engine
  2. Workflow scheduler for pipelines
  3. Columnar file format for analytics
  4. 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

  1. ORC stands for Optimized Row Columnar format.
  2. Parquet is also a columnar file format.
  3. Both ORC and Parquet store data in columns.
  4. This allows efficient analytics operations.
  5. 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?

  1. ORC
  2. Parquet
  3. CSV
  4. Avro

Answer: C. CSV

Explanation

CSV is plain text; types must be inferred or declared by the reader.

Step-by-step solution

  1. CSV is plain text.
  2. It has no types or schema.
  3. 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:

  1. Columns are converted into rows before reading
  2. Only the columns the query uses are read from storage
  3. The query plan is pushed to the client to run
  4. 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

  1. Projection pushdown, also called column pruning, means the engine reads only the columns the query uses.
  2. With columnar formats, unused columns are never read from storage.
  3. 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?

  1. 0.5%
  2. 100%
  3. 50%
  4. 5%

Answer: D. 5%

Explanation

3 / 60 = 5%; a row format would read every column.

Step-by-step solution

  1. A columnar format reads only needed columns.
  2. 3 of 60 columns.
  3. 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:

  1. Min/max ranges per row group narrow, so more groups are skipped
  2. Engines refuse to read unsorted Parquet files
  3. Sorted files are always exactly half the size of the same data unsorted
  4. 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

  1. Sorted data reduces the range of values in each row group.
  2. Smaller ranges allow more row groups to be skipped during queries.
  3. This improves query performance by reducing data scanned.
  4. Min/max ranges per row group narrow, so more groups are skipped.
  5. 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?

  1. Gzip files cannot be read by any Spark job
  2. Each gzip file must first be loaded into a relational database before use
  3. Gzip makes the data larger than plain CSV
  4. 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

  1. Spark gives each task one split of the input, and splits come from the file layout.
  2. Gzip is not a splittable codec, so a whole gzip file must be read by a single task.
  3. One large gzip file therefore cannot be read in parallel.
  4. 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?

  1. 3
  2. 6
  3. 1
  4. 9

Answer: A. 3

Explanation

The runs are (A, 4), (B, 2) and (C, 3).

Step-by-step solution

  1. Run-length encoding groups same values together.
  2. The column has four A's, two B's and three C's.
  3. Each group is one run: (A, 4), (B, 2), (C, 3).
  4. 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?

  1. It makes the table impossible to compress
  2. It creates a huge number of tiny partitions and files
  3. Partition columns must always be dates or small integers, never IDs
  4. 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

  1. User_id has millions of distinct values.
  2. Partitioning by it creates a directory, and often files, for each value.
  3. 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 →

Related topics

See all Data Engineering topics · All topics