Open In App

GATE | GATE CS 2008 | Question 70

Like Article
Like
Save
Share
Report

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.
(A) 8 and 0
(B) 128 and 6
(C) 256 and 4
(D) 512 and 5


Answer: (C)

Explanation: Indexing mechanisms are used to optimize certain accesses to data (records) managed in files. For example, the author catalog in a library is a type of index. An Index File consists of records (called index entries) of the form

-----------------------------------
| Search-Key  |  Pointer to Block |
----------------------------------- 

If even outer index is too large to fit in main memory, yet another level of index can be created, and so on.

multilevelindex

Number of records in file = 16384

Record size = 32 bytes
Key Size = 6 bytes
Block Size on file system = 1024 bytes
Size of Block Pointer = 10 bytes

Size of a record or index Entry = 10 + 6 = 16 

Number of blocks in first level = (Number of records in file)/
                                   (Disk Block Size)
                                = (16384 * 16)/(1024)
                                = 16 * 16
                                = 256

In second level, there will be 256 * 16 entries.
Number of blocks in second level = (Number of entries) / 
                                   (Block Size)
                                 = (256 * 16) / 1024
                                 = 4


Quiz of this Question


Last Updated : 14 Feb, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads