There are five records in a database.
There is an index file associated with this and it contains the values and . Which one of the fields is the index built from?
View worked solution
Answer: C
To determine which field the index is built from, we first number the records from to based on their original order in the table:
| Record No. | Name | Age | Occupation | Category |
|---|---|---|---|---|
| 1 | Rama | 27 | CON | A |
| 2 | Abdul | 22 | ENG | A |
| 3 | Jennifer | 28 | DOC | B |
| 4 | Maya | 32 | SER | D |
| 5 | Dev | 24 | MUS | C |
An index file stores pointers (or record numbers) in the sorted order of the indexed key. We are given the index sequence: .
Let's analyze the sorted order of each field to see which one produces this sequence:
- Age: Sorting in ascending order gives , which corresponds to record sequence: .
- Name: Sorting alphabetically gives Abdul, Dev, Jennifer, Maya, Rama, which corresponds to record sequence: .
- Occupation: Sorting alphabetically gives:
CON(Record 1)DOC(Record 3)ENG(Record 2)MUS(Record 5)SER(Record 4)
- Category: Sorting alphabetically gives A, A, B, C, D, which corresponds to record sequence: (or ).
Thus, the index is built on the Occupation field.
Free practice · Your answers on this page are not saved.
