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 (R): 64 bytes
- Block size (B): 512 bytes
- Number of records (N): 16K=16×1024=16,384
The blocking factor for data blocks (Bfrd) is:
Bfrd=⌊Record SizeBlock Size⌋=⌊64512⌋=8 records/block
The number of data blocks (D) required is:
D=⌈BfrdN⌉=⌈816,384⌉=2048 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 (K): 14 bytes
- Block pointer size (P): 2 bytes
- Index entry size (Ri): K+P=14+2=16 bytes
The blocking factor for index blocks (Bfri) is:
Bfri=⌊Index Entry SizeBlock Size⌋=⌊16512⌋=32 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 2048 data blocks.
Number of blocks at Level 1 (I1)=⌈322048⌉=64 blocks
-
Level 2: Points to the 64 blocks of Level 1.
Number of blocks at Level 2 (I2)=⌈3264⌉=2 blocks
-
Level 3 (Root): Points to the 2 blocks of Level 2.
Number of blocks at Level 3 (I3)=⌈322⌉=1 block
Since Level 3 contains exactly 1 block, it represents the root of the index tree.
---
Summary of Results
- Data Area: 2048 blocks
- Index Area: 64+2+1=67 blocks
- Number of index levels: 3