Database Indexing MCQs: 12 Solved Questions on Index Types
Solve 12 published indexing MCQs, then use one eight-record file to understand why each answer is correct. The set covers index classification and access-path choice.
KnowledgeGate Team
Exam prep & CS education

Indexing questions reuse familiar words across two different classification axes. Primary, clustering and secondary describe how the search field relates to physical file order. Dense and sparse describe how many search-key values receive entries. Mixing these axes makes several options appear correct.
These 12 questions test indexing purpose, ISAM, index classification and access-path choice. Attempt each first, writing two notes: Is the data file ordered on this field? and Does the index contain every search-key value? For broader practice, continue with DBMS MCQs.
Fix the indexing vocabulary with one eight-record file
Use EMPLOYEE(emp_id, dept, salary), physically ordered by the unique key emp_id:
B1 = {(101,CSE,60000),(104,ECE,55000),(109,CSE,60000)}B2 = {(115,CSE,70000),(118,ME,55000),(125,ECE,65000)}B3 = {(131,ME,70000),(140,CSE,80000)}
Its sparse primary index is {101 -> B1, 115 -> B2, 131 -> B3}. Its dense secondary salary index is 55000 -> {104,118}, 60000 -> {101,109}, 65000 -> {125}, 70000 -> {115,131}, and 80000 -> {140}.
For a clustering-index view, physically regroup the same rows by non-key dept. Store all CSE rows together, then ECE, then ME, and keep CSE -> first CSE block, ECE -> first ECE block, and ME -> first ME block.
These are three views of the same records. The primary view uses the unique ordering key emp_id. The clustering view changes physical order to the repeating field dept. The salary view leaves the emp_id order untouched, so salary remains a non-ordering secondary field even though its own index entries are sorted.
The rule is simple. Primary, clustering or secondary identifies which field controls file order. Dense or sparse identifies entry coverage. If you need insertion, splitting and leaf-link mechanics, study B+ Trees and Database Indexing: A Worked Guide. Index classification and access choice determine the appropriate access path.
Questions 1-2: indexing purpose and ISAM
Question 1
Previous-year question source: TPSC Computer Science, Programmer, 2025.
Which of the following is true about “indexing” in databases ?
A.
Indexing improves the speed of data retrieval.B.
Indexing reduces the storage requirements of a database.C.
Indexing increases the complexity of queries.D.
Indexing prevents SQL injection attacks.
Answer: A.
For emp_id = 125, the sparse index selects B2 instead of scanning all three blocks. Indexes cost storage and maintenance; they neither complicate SQL nor prevent injection.
Question 2
Previous-year question source: DSSSB Computer Science, TGT Shift 2, 2021.
What is the full form of ISAM in file organisation?
A.
Indirect Sequential Access MethodB.
Indexed Sequential Access MethodC.
Indirect Serial Access MethodD.
Index Serial Access Method
Answer: B.
Expand it as I = Indexed, S = Sequential, A = Access, M = Method. Values 101, 104, 109 stay sequential in B1; 101 -> B1 provides indexed access.
Questions 3-5: primary, dense and sparse indexes
Question 3
Previous-year question source: DSSSB Computer Science, TGT, 2024.
A _____ index is an ordered file whose records are of fixed length with two fields primary key and a pointer to a disk block.
A.
SecondaryB.
MultilevelC.
PrimaryD.
Clustering
Answer: C.
In (115, B2), 115 is the primary key starting the second ordered block and B2 is its pointer. Multilevel describes stacked index levels, not this relationship.
Question 4
Previous-year question source: DSSSB Computer Science, TGT Shift 2, 2021.
Primary index in sequential order file organisation is also known as ______.
A.
dense indexB.
clustering indexC.
non-clustering indexD.
sparse index
Answer: D.
Eight records need only three entries, one per block. For 118, choose the greatest index key not exceeding it, 115, read B2, then scan within it.
Question 5
The topic practice hub holds this item without a stable question-specific URL.
Which of the following statements is/are true?
S1) Sparse index has index entries for only some of the search values.
S2) Dense index has index entries for every search key value (which may or may not correspond to every record depending on uniqueness) .
A.
Only S1B.
Only S2C.
Both S1 and S2D.
Neither S1 nor S2
Answer: C.
The sparse index has only 101, 115, 131. The dense salary index represents all five distinct salaries; repeated salaries share an entry, so every search-key value does not mean every record.
Questions 6-8: clustered, clustering and secondary indexes
Question 6
Previous-year question sources: GATE Computer Science, Set 1, 2015; TPSC Computer Science, Senior Informatics Officer, 2025.
A file is organized so that the ordering of data records is the same as or close to the ordering of data entries in some index. Then that index is called
A.
DenseB.
SparseC.
ClusteredD.
Unclustered
Answer: C.
Store four CSE rows together, then two ECE and two ME rows. An index ordered CSE, ECE, ME follows that physical grouping; density remains a separate property.
Question 7
Previous-year question sources: ISRO Computer Science, 2016; UGC NET Computer Science, 2018; GATE Computer Science, 2008.
A clustering index is defined on the fields which are of type
A.
non-key and orderingB.
non-key and non-orderingC.
key and orderingD.
key and non-ordering
Answer: A.
dept is non-key because CSE repeats for 101, 109, 115, 140. After regrouping, it orders the file because CSE rows precede ECE and ME.
Question 8
Previous-year question source: RPSC Computer Science, Programmer P1, 2024.
Indices whose search key specifies an order different from the sequential order of the file are called:
A.
Primary IndicesB.
Random IndicesC.
Sequential IndicesD.
Secondary Indices
Answer: D.
File order is 101, 104, 109, 115, 118, 125, 131, 140; salary order is 55000, 60000, 65000, 70000, 80000. Different orders make salary secondary. Random Indices is not standard.
Questions 9-10: composite, ordered and hash access paths
Question 9
Previous-year question source: ISRO Computer Science, 2025.
Consider a table users(userid, country, city, street) with 50 million users. DBA creates the following index for the table
CREATE INDEX myindex ON users(country, city, street)For which of the following queries will this index be least useful?
A.
SELECT userid FROM users WHERE country='IN'B.
SELECT userid FROM users WHERE street='MG Road'C.
SELECT userid FROM users WHERE country='IN' AND city='Pune' AND street='MG Road'D.
SELECT userid FROM users WHERE country='IN' AND city='Pune'
Answer: B.
The order ('IN','Delhi','Ring Road'), ('IN','Pune','FC Road'), ('IN','Pune','MG Road'), ('US','Boston','Main Street') supports leftmost prefixes. A street-only predicate skips country and city, so it cannot isolate one contiguous range.
Question 10
Previous-year question source: GATE Computer Science, 2011.
Consider a relational table with sufficient number of records, having attributes and let . Two queries and are given below.
where is a constant
\(Q2: \pi_{A_1, \dots ,A_p} \left(\sigma_{c_1 \leq A_p \leq c_2}\left(r\right)\) where and are constants.
The database can be configured to do ordered indexing on or hashing on . Which of the following statements is TRUE?
A.
Ordered indexing will always outperform hashing for both queriesB.
Hashing will always outperform ordered indexing for both queriesC.
Hashing will outperform ordered indexing on, but not onD.
Hashing will outperform ordered indexing on, but not on
Answer: C.
With {101, 205, 240, 275, 310}, hashing targets 205 for Q1. For Q2 from 200 to 300, an ordered index seeks to 205 and scans 205, 240, 275; hashing preserves no range order.
Questions 11-12: bitmap choice and dense-index block arithmetic
Question 11
Previous-year question source: ISRO Computer Science, December 2017.
Consider a table that describes the customers :
Customers(custid, name, gender, rating)The rating value is an integer in the range 1 to 5 and only two values (male and female) are recorded for gender. Consider the query “how many male customers have a rating of 5”? The best indexing mechanism appropriate for the query is
A.
Linear hashingB.
Extendible hashingC.
B+ TreeD.
Bit-mapped hashing
Answer: D.
The option calls this bit-mapped hashing; the underlying mechanism is bitmap indexing. A bitwise AND of the male bitmap 10110101 and the rating-5 bitmap 00100101 gives 00100101. Its three 1-bits identify three male customers rated 5, so the low-cardinality gender and rating fields suit this bitmap approach.
Question 12
Previous-year question source: ISRO Computer Science, 2015.
Given a block can hold either 3 records or 10 key pointers. A database contains n records, then how many blocks do we need to hold the data file and the dense index
A.
13n/30B.
n/3C.
n/10D.
n/30
Answer: A.
Each full data block holds 3 records, and each dense-index block holds 10 entries. The options treat n as divisible by 30, giving n/3 data blocks and n/10 index blocks. Thus n/3 + n/10 = 10n/30 + 3n/30 = 13n/30. At n = 300, 100 + 30 = 130, and 13(300)/30 = 130. For other values, use ceil(n/3) + ceil(n/10) to include partially filled final blocks.
Diagnose the traps, score the set and choose the next step
Mistaken shortcut | Correct rule |
|---|---|
Primary means one entry per record | A primary index is usually sparse, with one entry per data block. |
Dense means unique | Dense means every search-key value is represented. |
Clustered means candidate key | Clustered means physical record order follows index order. |
A clustering field must be unique | It is a non-key ordering field. |
Secondary means unordered index | The index is ordered, but its key order differs from file order. |
Hash is best for every predicate | Hashing suits equality; ordered indexes also support ranges. |
Every composite-index column works equally | Leftmost-prefix columns control useful seeks. |
These are study thresholds, not official cutoffs. At 10-12, redo Questions 9 and 12 unaided. At 7-9, redraw the three index views and label both axes. At 0-6, revise the opening example, attempt Questions 3-8, then return to the later items.
For a structured semester-oriented CS route, use ZERO TO HERO. For placement-focused DBMS revision, continue with Computer Science Fundamentals for Placements by Sanchit Sir. You can also browse the wider CS Fundamentals collection.
Identify the physical ordering field, count search-key values, then match the structure to equality, range or low-cardinality filtering. Annotate each item with ordering field, key or non-key, dense or sparse, and best access pattern.
Keep learning

SQL Library Functions MCQs: 12 Solved Math, Aggregate, String and Date Questions
Practise 12 solved SQL library function MCQs with inside-out calculations, exact intermediate values and clear explanations of the common traps.

SQL Introduction, Components & Structure MCQs: 12 Solved Questions
Test your SQL foundations with 12 explained MCQs covering terminology, query behaviour, metadata, dynamic SQL, database models and QBE.

GROUP BY Clause MCQs: 10 Solved SQL Questions with Explanations
Solve ten published GROUP BY questions, then check each answer with row-level and group-level reasoning. Two full traces make the common SQL traps visible.

Third Normal Form (3NF) MCQs: 12 Solved Questions with Explanations
Solve 12 real 3NF exam MCQs with clear explanations, candidate-key closures, a raw-row decomposition, and the prime-attribute exception that separates 3NF from BCNF.