File System · Databases
24 questions · asked in 16 of 27 years (2000–2026)
MCQ 17 · MSQ 2 · NAT 51-mark 18 · 2-mark 6
2000Questions per year2026
Questions 16–20 of 24
In a database file structure, the search key field is 9 bytes long, the block size is 512 bytes, a record pointer is 7 bytes and a block pointer is 6 bytes. The largest possible order of a non-leaf node in a B+ tree implementing this file structure is
Answer: (C)
A non-leaf node of order holds block (tree) pointers and search keys. It holds no record pointers.
Block size bytes, block pointer bytes, search key bytes.
So the largest whole is 34. The 7-byte record pointer is used only in leaf nodes, so it does not enter this calculation.
Answer: (C)
Block size bytes, block pointer bytes, search key bytes.
So the largest whole is 34. The 7-byte record pointer is used only in leaf nodes, so it does not enter this calculation.
Answer: (C)
In a computer system, four files of size 11050 bytes, 4990 bytes, 5170 bytes and 12640 bytes need to be stored. For storing these files on disk, we can use either 100 byte disk blocks or 200 byte disk blocks (but can't mix block sizes). For each block used to store a file, 4 bytes of bookkeeping information also needs to be stored on the disk. Thus, the total space used to store a file is the sum of the space taken to store the file and the space taken to store the book keeping information for the blocks allocated for storing the file. A disk block can store either bookkeeping information for a file or data from a file, but not both. What is the total space required for storing the files using 100 byte disk blocks and 200 byte disk blocks respectively?
Answer: (C)
For each file, count the data blocks (rounded up), then the blocks needed for the 4-byte bookkeeping entries (one per data block, rounded up). Bookkeeping blocks are separate from data blocks.
100-byte blocks (each block holds 25 bookkeeping entries):
- 11050 bytes: 111 data blocks, 444 bytes of bookkeeping gives 5 blocks, total 116
- 4990 bytes: 50 data blocks, 200 bytes gives 2 blocks, total 52
- 5170 bytes: 52 data blocks, 208 bytes gives 3 blocks, total 55
- 12640 bytes: 127 data blocks, 508 bytes gives 6 blocks, total 133
Blocks = 116 + 52 + 55 + 133 = 356, so space = 356 100 = 35600 bytes.
200-byte blocks (each block holds 50 bookkeeping entries):
- 11050 bytes: 56 data blocks, 224 bytes gives 2 blocks, total 58
- 4990 bytes: 25 data blocks, 100 bytes gives 1 block, total 26
- 5170 bytes: 26 data blocks, 104 bytes gives 1 block, total 27
- 12640 bytes: 64 data blocks, 256 bytes gives 2 blocks, total 66
Blocks = 58 + 26 + 27 + 66 = 177, so space = 177 200 = 35400 bytes.
Answer: (C)
100-byte blocks (each block holds 25 bookkeeping entries):
- 11050 bytes: 111 data blocks, 444 bytes of bookkeeping gives 5 blocks, total 116
- 4990 bytes: 50 data blocks, 200 bytes gives 2 blocks, total 52
- 5170 bytes: 52 data blocks, 208 bytes gives 3 blocks, total 55
- 12640 bytes: 127 data blocks, 508 bytes gives 6 blocks, total 133
Blocks = 116 + 52 + 55 + 133 = 356, so space = 356 100 = 35600 bytes.
200-byte blocks (each block holds 50 bookkeeping entries):
- 11050 bytes: 56 data blocks, 224 bytes gives 2 blocks, total 58
- 4990 bytes: 25 data blocks, 100 bytes gives 1 block, total 26
- 5170 bytes: 26 data blocks, 104 bytes gives 1 block, total 27
- 12640 bytes: 64 data blocks, 256 bytes gives 2 blocks, total 66
Blocks = 58 + 26 + 27 + 66 = 177, so space = 177 200 = 35400 bytes.
Answer: (C)
A B-Tree used as an index for a large database table has four levels including the root node. If a new key is inserted in this index, then the maximum number of nodes that could be newly created in the process are
Answer: (A)
Worst case: the new key splits the leaf and every node above it on the path to the root. With 4 levels, the splits make 4 new nodes. The root also splits, so one more new root is made. Total is 5.
Answer: 5
Answer: 5
Which one of the following is a key factor for preferring - trees to binary search trees for indexing database relations?
Answer: (D)
A disk is read and written in blocks, and one disk access is very slow compared with memory. A B+ tree node is made as big as one disk block, so it holds hundreds of keys and has a very high fanout. The tree is then very shallow, and a search needs only a few block reads. A binary search tree has two children per node, so it is much deeper and would need many block reads. So the key factor is (D).
(A) A large number of records matters only because the data sits on disk, so it is not the deciding reason. (B) Sorting on the primary key does not separate the two: a binary search tree is also ordered by key. (C) A B+ tree does not need less memory; it also stores keys in internal nodes and its nodes are often not full.
Answer: (D)
(A) A large number of records matters only because the data sits on disk, so it is not the deciding reason. (B) Sorting on the primary key does not separate the two: a binary search tree is also ordered by key. (C) A B+ tree does not need less memory; it also stores keys in internal nodes and its nodes are often not full.
Answer: (D)
Consider a table T in a relational database with a key field K. A B-tree of order p is used as an access structure on K, where p denotes the maximum number of tree pointers in a B-tree index node. Assume that K is 10 bytes long; disk block size is 512 bytes; each data pointer is 8 bytes long and each block pointer is 5 bytes long. In order for each B-tree node to fit in a single disk block, the maximum value of p is
Answer: (C)
A B-tree node of order p has p block pointers (5 bytes each), and p-1 keys (10 bytes each) with p-1 data pointers (8 bytes each). It must fit in a 512-byte block:
The largest whole value is .
Answer: (C)
The largest whole value is .
Answer: (C)
Keep practising