Skip to content
Official PYQ · 1993

GATE CS 1993 Q14 — File Organization and Indexing (B and B+ Trees)

Explain with AI
An ISAM\text{ISAM} (indexed sequential) file consists of records of size 6464 bytes each, including key field of size 1414 bytes. An address of a disk block takes 22 bytes. If the disk block size is 512512 bytes and there are 16K16K records, compute the size of the data and index areas in terms of number blocks. How many levels of tree\text{tree} do you have for the index?
View worked solution

Answer: 3

To find the size of the data and index areas and the number of index levels, we perform the calculations step-by-step:

1. Data Area Calculation

  • Record size (RR): 6464 bytes
  • Block size (BB): 512512 bytes
  • Number of records (NN): 16K=16×1024=16,38416\text{K} = 16 \times 1024 = 16,384

The blocking factor for data blocks (BfrdBfr_d) is:

Bfrd=⌊Block SizeRecord Size⌋=⌊51264⌋=8 records/blockBfr_d = \left\lfloor \frac{\text{Block Size}}{\text{Record Size}} \right\rfloor = \left\lfloor \frac{512}{64} \right\rfloor = 8 \text{ records/block}

The number of data blocks (DD) required is:

D=⌈NBfrd⌉=⌈16,3848⌉=2048 blocksD = \left\lceil \frac{N}{Bfr_d} \right\rceil = \left\lceil \frac{16,384}{8} \right\rceil = 2048 \text{ blocks} ---

2. Index Area Calculation

In an ISAM (indexed sequential) file, a sparse index is used where each entry points to a data block.

  • Key size (KK): 1414 bytes
  • Block pointer size (PP): 22 bytes
  • Index entry size (RiR_i): K+P=14+2=16K + P = 14 + 2 = 16 bytes

The blocking factor for index blocks (BfriBfr_i) is:

Bfri=⌊Block SizeIndex Entry Size⌋=⌊51216⌋=32 entries/blockBfr_i = \left\lfloor \frac{\text{Block Size}}{\text{Index Entry Size}} \right\rfloor = \left\lfloor \frac{512}{16} \right\rfloor = 32 \text{ entries/block} ---

3. Multi-level Index Construction

We construct the index levels bottom-up until we reach a single root block:

  • Level 1: Points to the 20482048 data blocks. Number of blocks at Level 1 (I1)=⌈204832⌉=64 blocks\text{Number of blocks at Level 1 } (I_1) = \left\lceil \frac{2048}{32} \right\rceil = 64 \text{ blocks}
  • Level 2: Points to the 6464 blocks of Level 1. Number of blocks at Level 2 (I2)=⌈6432⌉=2 blocks\text{Number of blocks at Level 2 } (I_2) = \left\lceil \frac{64}{32} \right\rceil = 2 \text{ blocks}
  • Level 3 (Root): Points to the 22 blocks of Level 2. Number of blocks at Level 3 (I3)=⌈232⌉=1 block\text{Number of blocks at Level 3 } (I_3) = \left\lceil \frac{2}{32} \right\rceil = 1 \text{ block}

Since Level 3 contains exactly 11 block, it represents the root of the index tree.

---

Summary of Results

  • Data Area: 20482048 blocks
  • Index Area: 64+2+1=6764 + 2 + 1 = 67 blocks
  • Number of index levels: 33

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore File Organization and Indexing (B and B+ Trees) questions