GateAI
File Organization and Indexing

GATE CSE 2021 Set 2 · Q21

NAT1 markMedium

Time

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 ________.

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 698

File Organization and Indexing
  1. Type of Index: The data file is ordered by RollNo, so creating an index on a non-ordering key ANum requires a secondary index, which must be dense (one entry per record in the data file).

  2. Total Index Entries:

    n=150,000n = 150,000
  3. Size of an Index Record (RiR_i):

    Ri=Size of ANum+Size of Record Pointer=12+7=19 bytesR_i = \text{Size of ANum} + \text{Size of Record Pointer} = 12 + 7 = 19\text{ bytes}
  4. Blocking Factor of Index (BfriBfr_i): Since records cannot span across block boundaries:

    Bfri=⌊Block SizeRi⌋=⌊409619⌋=215 records/blockBfr_i = \left\lfloor \frac{\text{Block Size}}{R_i} \right\rfloor = \left\lfloor \frac{4096}{19} \right\rfloor = 215\text{ records/block}
  5. Total Blocks for Index File:

    Number of blocks=⌈150,000215⌉=⌈697.674⌉=698 blocks\text{Number of blocks} = \left\lceil \frac{150,000}{215} \right\rceil = \left\lceil 697.674 \right\rceil = 698\text{ blocks}

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This File Organization and Indexing previous year question is Q21 of the GATE CSE 2021 Set 2 paper. Find more GATE CSE PYQs on File Organization and Indexing in Databases, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related File Organization and Indexing PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

File Organization and Indexing in GATE CSE

File Organization and Indexing has 17 GATE CSE PYQs across 17 papers from 2011 to 2026. 2 of them are 1-mark NAT questions like this one, and it is the only one in GATE CSE 2021 Set 2.

How GATE tests File Organization and Indexing

More from GATE CSE 2021 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2021 Set 2 · Q21 · NAT

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 …

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.