Skip to content
GATEiit

GATE CSE 2021 Set 2 Q31: Number of blocks in a dense index on a candidate key

Question

A data file consisting of 1,50,000 student-records is stored on a hard disk with block size of 4096 bytes. The data file is sorted on the primary key RollNo. The size of a record pointer for this disk is 7 bytes. Each student-record has a candidate key attribute called ANum of size 12 bytes. Suppose an index file with records consisting of two fields, ANum value and the record pointer to the corresponding student record, is built and stored on the same disk. Assume that the records of data file and index file are not split across disk blocks. The number of blocks in the index file is ________.

Try it: numerical answer: type the value

Numerical answer. No negative marking.
Show answer and explanation

Answer: 698 (official GATE 2021 final answer key)

Concept used: The file is not sorted on ANum, so the index on ANum must be dense: one entry per record.

First step: Each index entry is 12+7=1912 + 7 = 19 bytes, so a block holds ⌊4096/19⌋=215\lfloor 4096/19 \rfloor = 215 entries; divide 150000 by that and round up.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2021 Set 2 CS question paper and final answer key, organised by IIT Bombay. Question paper · Answer key