CS FundamentalsVery hardGATE CS · Product placement

A file has 30,000 records of 120 bytes, stored unspanned in 1024-byte blocks and ordered on key K. A primary (sparse) index on K has one entry per data block, each entry being a 9-byte key plus a 7-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. 12
  2. B. 7
  3. C. 10
  4. D. 6

Correct answer: B. 7

bfr = ⌊1024/120⌋ = 8, so 3,750 data blocks. Index bfr = ⌊1024/16⌋ = 64, so ⌈3750/64⌉ = 59 index blocks; binary search takes ⌈log₂ 59⌉ = 6 accesses, +1 for the data block = 7.

More DBMS and SQL questions

Exams that ask this topic