Skip to content
Official PYQ · 1998

GATE CS 1998 Q1.35 — File Organization and Indexing (B and B+ Trees)

Explain with AI

There are five records in a database.
NameAgeOccupationCategory Rama27CONAAbdul22ENGAJennifer28DOCBMaya32SERDDev24MUSC\begin{array}{|c|c|c|c|} \hline \textbf{Name} & \textbf{Age} & \textbf{Occupation} & \textbf{Category } \\ \hline \text{Rama} & \text{27} & \text{CON} & \text{A} \\ \hline \text{Abdul} & \text{22} & \text{ENG} & \text{A} \\ \hline \text{Jennifer} & \text{28} & \text{DOC} & \text{B} \\ \hline \text{Maya} & \text{32} & \text{SER} & \text{D} \\ \hline \text{Dev} & \text{24} & \text{MUS} & \text{C} \\ \hline \end{array}

There is an index file associated with this and it contains the values 1,3,2,51, 3, 2, 5 and 44. Which one of the fields is the index built from?

Choose one option
View worked solution

Answer: C

To determine which field the index is built from, we first number the records from 11 to 55 based on their original order in the table:

Record No. Name Age Occupation Category
1Rama27CONA
2Abdul22ENGA
3Jennifer28DOCB
4Maya32SERD
5Dev24MUSC

An index file stores pointers (or record numbers) in the sorted order of the indexed key. We are given the index sequence: 1,3,2,5,41, 3, 2, 5, 4.

Let's analyze the sorted order of each field to see which one produces this sequence:

  • Age: Sorting in ascending order gives 22,24,27,28,3222, 24, 27, 28, 32, which corresponds to record sequence: 2,5,1,3,42, 5, 1, 3, 4.
  • Name: Sorting alphabetically gives Abdul, Dev, Jennifer, Maya, Rama, which corresponds to record sequence: 2,5,3,4,12, 5, 3, 4, 1.
  • Occupation: Sorting alphabetically gives:
    • CON (Record 1)
    • DOC (Record 3)
    • ENG (Record 2)
    • MUS (Record 5)
    • SER (Record 4)
    This corresponds exactly to the record sequence: 1,3,2,5,41, 3, 2, 5, 4.
  • Category: Sorting alphabetically gives A, A, B, C, D, which corresponds to record sequence: 1,2,3,5,41, 2, 3, 5, 4 (or 2,1,3,5,42, 1, 3, 5, 4).

Thus, the index is built on the Occupation field.

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