CS FundamentalsHardGATE CS (PYQ pattern)

A table is stored sorted on key K in 5000 pages (100 records each). Searching for one key with binary search over pages costs ceil(log2 5000) page reads. With a sparse primary index (one entry per data page, 200 entries per index page), what is the number of page reads for a single-key search using binary search on the index plus the data page?

  1. A. 6
  2. B. 13
  3. C. 7
  4. D. 5

Correct answer: A. 6

Index entries = 5000, index pages = 25; binary search on 25 pages: ceil(log2 25) = 5 reads, plus 1 data page = 6. Binary search directly on the data would need ceil(log2 5000) = 13.

More DBMS and SQL questions

Exams that ask this topic