CS FundamentalsVery hardGATE CS · Product placement

A file has 120,000 records of 150 bytes, stored unspanned in 4096-byte blocks and ordered on key K. A primary (sparse) index on K has one entry per data block, each entry being a 16-byte key plus a 8-byte block pointer. How many block accesses does a binary search on the INDEX plus one data-block read need, in the worst case?

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

Correct answer: A. 6

bfr = ⌊4096/150⌋ = 27, so 4,445 data blocks. Index bfr = ⌊4096/24⌋ = 170, so ⌈4445/170⌉ = 27 index blocks; binary search takes ⌈log₂ 27⌉ = 5 accesses, +1 for the data block = 6.

More DBMS and SQL questions

Exams that ask this topic