Indexing
Question 1 |
A clustering index is defined on the fields which are of type
non-key and ordering
| |
non-key and non-ordering
| |
key and ordering
| |
key and non-ordering
|
Question 1 Explanation:
Create index files, fields could be non-key attributes and which are in ordered form so as to form clusters easily.
Question 2 |
Consider a file of 16384 records. Each record is 32 bytes long and its key field is of size 6 bytes. The file is ordered on a non-key field, and the file organization is unspanned. The file is stored in a file system with block size 1024 bytes, and the size of a block pointer is 10 bytes. If the secondary index is built on the key field of the file, and a multi-level index scheme is used to store the secondary index, the number of first-level and second-level blocks in the multi-level index are respectively
8 and 0 | |
128 and 6 | |
256 and 4
| |
512 and 5 |
Question 2 Explanation:
Total no. of records in a file = 16384
Record size = 32 bytes
Key size = 6 bytes
Block pointer size = 10 bytes
Block size of file system = 1024 bytes
Record (or) index entry size = 10+6 = 16 bytes
In first level no. of blocks =No. of records in a file/Block size=16384 * 16/1024=256
In second level, it have = 256*16 entries
In second level, no. of blocks =No. of entries/Block size =256*16/1024=4
Record size = 32 bytes
Key size = 6 bytes
Block pointer size = 10 bytes
Block size of file system = 1024 bytes
Record (or) index entry size = 10+6 = 16 bytes
In first level no. of blocks =No. of records in a file/Block size=16384 * 16/1024=256
In second level, it have = 256*16 entries
In second level, no. of blocks =No. of entries/Block size =256*16/1024=4
Question 3 |
Age | |
Name | |
Occupation | |
Category |
Question 3 Explanation:
Indexing will be on occupation field because occupation field lexigraphically sorted will give the sequence 1, 3, 2, 5, 4.
Question 4 |
For secondary key processing which of the following file organizations is preferred? Give a one line justification:
Indexed sequential file organization. | |
Two-way linked list. | |
Inverted file organization. | |
Sequential file organization. |
Question 4 Explanation:
Inverted file organization, because of reasons are as follows:
→ An index for each secondary key.
→ An index entry for each distinct value of the secondary key.
→ Exhibits better enquiry performance.
→ An index for each secondary key.
→ An index entry for each distinct value of the secondary key.
→ Exhibits better enquiry performance.
There are 4 questions to complete.