Question 1
EasyWhat is the main purpose of an index?
- A.
To speed up searching for rows
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
DBMS
What is the main purpose of an index?
To speed up searching for rows
To encrypt data
To reduce the number of tables
To store backups
Answer: A
Like a book's index, a database index lets the DBMS find rows without scanning the whole table.
What is a cost of adding an index?
Less storage use
Slower inserts, updates and deletes, and extra storage
No cost at all
Faster writes
Answer: B
Every change to the table must also update its indexes.
How many clustered indexes can a table have?
None
Two
Any number
One
Answer: D
A clustered index fixes the physical order of the rows, so there can be only one.
Which data structure do most relational databases use for indexes?
Stack
B+ tree
Linked list
Queue
Answer: B
B+ trees stay balanced, have high fan-out and support both point lookups and range scans.
Which kind of index is most efficient for exact-match lookups but useless for range queries?
A bitmap index
A B+ tree index
A clustered index
A hash index
Answer: D
Hashing scatters keys, so neighbouring values aren't stored together.
Which column is usually indexed automatically?
No column
Every text column
Every NULL column
The primary key
Answer: D
Most DBMSs create a unique index to enforce the primary key.
What is a composite index?
An index on two or more columns
A hash index
An index on one column
An index stored in two files
Answer: A
For example, an index on (last_name, first_name).
A database index is most like which of these?
The book's cover
The book's publisher
The book's price
The index at the back of a book
Answer: D
Both let you jump to the right place without reading everything.
What is a primary index?
An index stored in RAM only
An index on a random column
The first index ever created
An index on the field by which the data file is sorted
Answer: D
A primary (ordering) index uses the same key that orders the file.
What is a secondary index?
An index with only two entries
An index on a field other than the one the file is sorted on
A backup of the primary index
An index that is never used
Answer: B
A table can have many secondary indexes.