The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+24 votes

There are five records in a database.
$$\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, 5$ and $4$. Which one of the fields is the index built from?

  1. Age
  2. Name
  3. Occupation
  4. Category
asked in Databases by Veteran (52k points)
edited by | 2.7k views
  • What if there was some field in the table given above, whose values were in-fact 1,3,2,5 and 4 ?
  •  In the question - "Index file associated with this and it contains the values 1,3,2,5 and 4." Are these "values" the record pointers ? (I am assuming as such).

1 Answer

+48 votes
Best answer
Indexing will be on Occupation field because Occupation field lexicographically sorted will give the sequence $1,3,2,5,4$.

Correct Answer: $C$
answered by Veteran (59.8k points)
edited by
The ordering of index records if Occupation attribute is choosed.

['CON' (1) , 'DOC' (2) , 'ENG'(3) , 'MUS' (4) , 'SER'(5)]

For other fields ,

Age is choosen,

22 gets index value 1, but from the given database 27 should get, hence not for Age Attribute.

Similar reason for Name attribute.

Category attribute is not as it contains duplicate values.

Hence correct answer is Occupation.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,535 questions
54,122 answers
71,039 users