CS FundamentalsVery hardGATE CS · DBMS

A file of 5000 blocks is sorted by external merge sort with M = 21 buffer blocks (sorted runs of M blocks are created in pass 0, then (M − 1)-way merges). How many passes in total are needed, and how many block transfers if each pass reads and writes every block once?

  1. A. 3 passes, 15,000 transfers
  2. B. 4 passes, 40,000 transfers
  3. C. 2 passes, 20,000 transfers
  4. D. 3 passes, 30,000 transfers

Correct answer: D. 3 passes, 30,000 transfers

Pass 0 makes ⌈5000/21⌉ = 239 runs; each merge pass divides the run count by 20, needing 2 merge pass(es). Total 3 passes × 2 × 5000 = 30,000 transfers.

More DBMS and SQL questions

Exams that ask this topic