GateAI
File Organization and Indexing

GATE CSE 2020 · Q54

NAT2 marksMedium

Time

Consider a database implemented using B+ tree for file indexing and installed on a disk drive with block size of 4 KB. The size of search key is 12 bytes and the size of tree/disk pointer is 8 bytes. Assume that the database has one million records. Also assume that no node of the B+ tree and no records are present initially in main memory. Consider that each record fits into one disk block. The minimum number of disk accesses required to retrieve any record in the database is ________.

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 4

File Organization and Indexing

To find the minimum number of disk accesses, the B+ tree must have the minimum height (i.e., maximum node capacity/fan-out at each level).

Given:

  • Block size, B=4 KB=4096 bytesB = 4\text{ KB} = 4096\text{ bytes}

  • Search key size, K=12 bytesK = 12\text{ bytes}

  • Pointer size, P=8 bytesP = 8\text{ bytes}

  • Number of records, N=1,000,000N = 1,000,000

1. Internal Node Order (pp): An internal node containing pp block pointers and p−1p - 1 search keys must satisfy:

p⋅P+(p−1)⋅K≤Bp \cdot P + (p - 1) \cdot K \le B
8p+12(p−1)≤40968p + 12(p - 1) \le 4096
20p−12≤4096  ⟹  20p≤4108  ⟹  p=⌊205.4⌋=20520p - 12 \le 4096 \implies 20p \le 4108 \implies p = \lfloor 205.4 \rfloor = 205

2. Leaf Node Capacity (nn): Each leaf node entry has a search key and a data/record pointer (and optionally 1 pointer to next leaf node):

n⋅(K+P)+P≤B  ⟹  20n+8≤4096  ⟹  20n≤4088  ⟹  n=⌊204.4⌋=204n \cdot (K + P) + P \le B \implies 20n + 8 \le 4096 \implies 20n \le 4088 \implies n = \lfloor 204.4 \rfloor = 204

3. Minimum Height of the B+ Tree:

  • Number of leaf nodes needed for 10610^6 records:

    ⌈106204⌉=4902 leaf nodes\left\lceil \frac{10^6}{204} \right\rceil = 4902 \text{ leaf nodes}
  • Level 1 above leaves:

    ⌈4902205⌉=24 nodes\left\lceil \frac{4902}{205} \right\rceil = 24 \text{ nodes}
  • Level 2 above leaves (Root):

    ⌈24205⌉=1 node (Root)\left\lceil \frac{24}{205} \right\rceil = 1 \text{ node (Root)}

Thus, the B+ tree has 33 levels:

  • Level 1: Root

  • Level 2: Intermediate level

  • Level 3: Leaf level

4. Total Disk Accesses to Retrieve a Record:

  • Number of disk accesses for index tree traversal =3= 3 (Root →\to Internal Node →\to Leaf Node)

  • Number of disk accesses to fetch the actual data record from disk =1= 1

Total Minimum Disk Accesses=3+1=4\text{Total Minimum Disk Accesses} = 3 + 1 = 4

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 Q54 of the GATE CSE 2020 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. 5 of them are 2-mark NAT questions like this one, and it is the only one in GATE CSE 2020.

How GATE tests File Organization and Indexing

More from GATE CSE 2020

Share this solution

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

GateAI solution cardGATE CSE 2020 · Q54 · NAT

Consider a database implemented using B+ tree for file indexing and installed on a disk drive with block size of 4 KB. The size of search key is 12 bytes and the size of tree/disk pointer is 8 bytes. Assume that the database has one million records. Also assume that no node of the B+ tree and no records are present initially in main memory. Consider that each record fits into one disk block. The minimum number of disk accesses required to retrieve any record in the database 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.