GATE / CS ARCHIVE

GATE CSE 2021 SET 2 / QUESTION 21

GATE CSE 2021 Set 2 Q21

Database Management Systems · Indexing, Storage & Query Processing · Full GATE CSE 2021 Set 2 paper

GATE 2021 Set 2, Q21 1 mark · NAT
Report issue

Indexing, Storage & Query Processing

Question 21, GATE 2021: 150000 student records sorted by primary key RollNo. Secondary candidate key ANum uses 12 bytes; record pointers 7 bytes. Index records contain ANum and corresponding record pointer. Blocks are 4096 bytes and records cannot straddle blocks. Find index block count.
Tap to enlarge
Answer & solution

Official answer: 698

The secondary candidate-key index is dense, with one entry per student. Each entry needs 12+7=19 bytes. With no split entries, each 4096-byte block holds floor(4096/19)=215 entries. Thus ceil(150000/215)=698 blocks.

ANum is not the ordering key of the data file, so a sparse primary index with one entry per data block is not applicable. Packing permits 215 complete 19-byte entries per block because 216 require 4104 bytes. There are 697 full blocks holding 149855 entries and 145 entries in a final block.

Original paper, page 65 · Answer key