DBMS Assignment 6
DBMS Assignment 6
Total Marks : 20
Question 1
Consider a file of 50000 records. Each record is 40 bytes long and its key field is of size 4 bytes.
Size of the memory is 512 KB. The disk block size is 512 bytes, and the size of a block address
is 8 bytes. If we want to order the file on key field, which indexing technique gives better result
for accessing a record? Marks: 2 MCQ
a) Primary indexing
b) Secondary indexing
c) Multilevel indexing
d) Clustering indexing
Answer: c)
Explanation: In this problem, (Key + block address) =12 bytes.
So, one block can store only = 512 / 12 = 42 (Key + block address) pair.
Size of all pairs (Key + block address) = 12 * 50000 = 600 KB
Hence, primary index does not fit in memory, and access becomes expensive.
As we want to order on key field only, secondary index is expensive and clustering indexing is
not applicable.
Hence, Multilevel indexing is the best choice for this problem.
Refer to slide 26.
1
Question 2
Consider the following B+ tree of order 5: Marks: 2 MCQ
a)
b)
c)
d)
Answer: a)
Explanation: It will go to 3rd leaf node after 53. As B+ tree is a balanced tree and that
leaf node is already full, we cannot insert the record there directly.
The new leaf node should have values (48, 53, 56, 61, 69) and its current root value is 48. We
need to split the leaf node from the middle. So, we have to group (48, 53) and (56, 61, 69) in
2 leaf nodes. If these two has to be leaf nodes, the intermediary node cannot branch from 48.
It should have 56 added to it and then we can have pointers to the new leaf node. And the
final tree will be:
2
Question 3
There are five records in a database table. Marks: 2 MCQ
Name Age Department Gender
Rama 21 CSE M
Abdul 22 IT M
Jennifer 18 CSE F
Maya 22 IT F
Dev 21 IEE M
Which column is represented by the following bitmap index?
1 0 1 0 0
0 1 0 1 0
0 0 0 0 1
a) Name
b) Age
c) Gender
d) Department
Answer: d)
1 0 1 0 0
0 1 0 1 0
0 0 0 0 1
3
Question 4
There are five records in a Student table. Marks: 2 MCQ
Name Age Department Gender
Rama 21 CSE M
Abdul 22 IT M
Jennifer 18 CSE F
Maya 22 IT F
Dev 21 IEE M
Identify the correct SQL query to create composite index on Age and Gender?
Answer: d)
4
Question 5
Suppose, a system uses B+ tree indexing for storing its records. The order of a leaf node
(maximum possible number of data value with record pointer pairs) is 64. what will be the
minimum size of one block, if the size of one data value is 8 bytes, data record pointer is 4
bytes, and one block pointer is 12 bytes long? Marks: 2 MCQ
a) 524 bytes
b) 780 bytes
c) 1036 bytes
d) 2050 bytes
Answer: b)
Explanation: In B+ tree indexing one block can hold minimum one leaf node.
Order of leaf node, n = 64
Data Record Pointer size, r = 4 bytes
Data value size, V = 8 bytes
Disk Block ptr, p = 12 bytes
A leaf node in B+ tree contains at most n values, at most n record pointers and one block
pointer.
So, one block size = n*V + n*r + p = 64*8 + 64*4 + 12 bytes
= 780 bytes
5
Question 6
Which of the splitting rule is wrong in respect of 2-3-4 Trees? Marks: 2 MCQ
a)
b)
c)
d)
Answer: d)
Explanation: Refer to slide 27. Splittings corresponding to options (a), (b) and (c) are
correct.
The labels “b”, “c”, “d”, “e” are labels for links to nodes. In option(d), links are inserted as
values. So, (d) is incorrect.
6
Question 7
In a B + tree, size of a node is generally the same as that of a disk block. Suppose that the
size of a block is 4 kilobytes. One index entry is 40 bytes long. What will be the height of the
tree of a file with 1 million search key values? Marks: 2 MCQ
a) 3
b) 4
c) 5
d) 6
Answer: b)
Explanation: The height of the tree = dlogdn/2e (K)e
n = 4KB / 40 bytes = 102
K = 1000000
The height of the tree = dlogd51e (1000000)e = 4
7
Question 8
Consider a hash table with 8 slots. The hash function is h(X) = X mod 8. The collisions are
resolved by chaining. The following 10 keys are inserted in the table: 3, 18, 29, 25, 30, 43, 52,
67, 70. What will be the maximum, minimum, and average chain lengths in the hash table?
Marks: 2 MCQ
a) 3, 1, and 2
b) 3, 0, and 1
c) 4, 0, and 1
d) 4, 0, and 2
Answer: b)
Explanation: After inserting the keys, the hash table looks like the following.
8
Question 9
Ordering of data records of a file is the same as that of data entries in some index. What is
such an index called?
Marks: 2 MCQ
a) Sparse
b) Dense
c) Unclustered
d) Clustered
Answer: d)
Explanation: As per the organization of clustered indexing.
9
Question 10
What is the load factor of any hash table? Marks: 2 MCQ
Number of Bucket
a) Number of different key values
Number of key values stored in the hash table
b) Capacity of the hash table
Number of key values stored in the hash table
c) Number of different key values
Capacity of the Table
d) Total number of key values
Answer: b)
10