CS FundamentalsVery hardProduct-company MCQ pattern

A file of 30,000 records (100 bytes each, unspanned) is sorted on key K and stored in 1,024-byte blocks. A primary (sparse) index on K uses 15-byte entries (9-byte key + 6-byte pointer), one per data block. How many block accesses are needed to find a record by binary search on the data file, and by binary search on the index plus one data access?

  1. A. 15 and 7
  2. B. 12 and 7
  3. C. 15 and 13
  4. D. 12 and 6

Correct answer: B. 12 and 7

Data: 1024/100 = 10 records per block, 3,000 blocks, ⌈log₂ 3000⌉ = 12 accesses. Index: 1024/15 = 68 entries per block; 3,000 entries need ⌈3000/68⌉ = 45 blocks; ⌈log₂ 45⌉ = 6, plus 1 data block = 7. 15 is ⌈log₂ 30000⌉, wrongly searching records instead of blocks.

More DBMS and SQL questions

Exams that ask this topic