Indexing

Question 1

Consider a relational table r with sufficient number of records, having attributes A1, A2,…, An and let 1≤p≤n. Two queries Q1 and Q2 are given below.

    Q1: πA1,...,Ap(σAp=c(r)) where c is a constant
    Q2: πA1,...,Ap(σc1≤Ap≤c2(r)) where c1 and c2 is a constants

The database can be configured to do ordered indexing on Ap or hashing on Ap. Which of the following statements is TRUE?

A
Ordered indexing will always outperform hashing for both queries
B
Hashing will always outperform ordered indexing for both queries
C
Hashing will outperform ordered indexing on Q1, but not on Q2
D
Hashing will outperform ordered indexing on Q2, but not on Q1.
Question 1 Explanation: 
Hashing works well on the "equal" queries, while ordered indexing works well better on range queries.
For example, consider B+ tree, once you have searched a key in B+; you can find range of values via the block pointers pointing to another block of values on the leaf node level.
Question 2

A clustering index is defined on the fields which are of type

A
non-key and ordering
B
non-key and non-ordering
C
key and ordering
D
key and non-ordering
Question 2 Explanation: 
Create index files, fields could be non-key attributes and which are in ordered form so as to form clusters easily.
Question 3

There are 5 records in a database.

There is an index file associated with this and it contain the values 1, 3, 2, 5 and 4. Which one of the fields is the index built form?

A
Age
B
Name
C
Occupation
D
Category
Question 3 Explanation: 
Indexing will be on occupation field because occupation field lexigraphically sorted will give the sequence 1, 3, 2, 5, 4.
There are 3 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access