Week 6 Solution
Week 6 Solution
Week 6 Solution
Total Marks : 20
Question 1
Consider the following table. If we create an index on CON ID column, which type of indexing
is preferred? Marks: 2 MCQ
CONTEST
CON ID PARTICIPANT CATEGORY
C51 AMAN DANCE
C02 RAJIB PAINTING
C76 KRISHNA DANCE
C32 MANAN MUSIC
a) Clustering index
b) Dense index
c) Secondary index
d) Sparse index
Answer: b)
Explanation: When the file is not sorted on the indexed field or when the index file is small,
compared to the size of the memory, it is preferable to use dense indexing. The above table
has only 4 records and CON ID field is not in sorted order.
Hence, option b) is correct.
1
Question 2
Consider the following B+ tree:
Which of the following statement(s) is/are not valid for the given tree? Marks: 2 MCQ
b) Non-leaf nodes other than root must have between 4 and 8 children
Answer: d)
Explanation: Based on the standard properties of the B+ tree, leaf nodes never be empty.
Hence, option d) is the answer.
2
Question 3
Consider the following 2-3-4 Tree:
How many comparisons are required to find 10 from the tree? Marks: 2 MCQ
a) 2
b) 3
c) 4
d) 5
Answer: c)
Explanation: Find 10 → 4 comparisons: First comparison with 61, second comparison with
53, third comparison with 9 and the last comparison with 25.
So, option c) is correct.
3
Question 4
Identify the correct hash function used in the following hash table:
Marks: 2 MCQ
a) (ID) %3
Answer: c)
Explanation: In every tuple, if the digits of ID are added and divided by 4, the remainder
indicates the bucket number into which the IDs are hashed.
Like in ID 37, 3+7=10%4=2. Hence tuple having ID 37 is mapped into bucket 2.
Hence, option c) is correct.
4
Question 5
A 2-3-4-tree, can store a maximum 4095 number of keys. What will be the minimum height
of the tree? The height of the root node is assumed to be zero.
Marks: 2 MCQ
a) 4
b) 5
c) 6
d) 10
Answer: b)
Explanation: A node of a 2-3-4-tree can store maximum 3 number of keys.
So, for the minimal height of a 2-3-4-tree, we will have three keys(maximum possible number)
per node.
keys at level 0 = 3*(40 ) = 3
keys at level 1 = 3*(41 ) = 3*(4)
keys at level 2 = 3*(42 ) and so on . . .
Hence, height = log4 (N + 1) − 1 = log4 (4095 + 1) − 1= log(4096)
log(4) -1= 6-1 = 5
5
Question 6
Consider the following right biased B + tree.
Inserting 85 into this tree will result in which of the following trees?
Marks: 2 MCQ
a)
b)
c)
d)
Answer: c)
Explanation: On inserting 85 the following changes will occur:
i) 85 will first try to fit in a leaf node depending on its value and the values of data items
already present in the leaf nodes as shown below:
ii) But the leaf node having the capacity to hold 3 values maximum, cannot accommodate
the newly arrived 85, and hence the node splits. The mid value(ceiling) which is 80 moves
upward in the immediate parent’s node. 73, 75 being less than 80 becomes its left child,
6
while 85 becomes its right child as shown below.
iii) But the parent node also has the capacity to hold 3 values maximum, hence it cannot
accommodate 4 values and splits as a result. Following the rule, 80 becomes the topmost
node and values less than 80 becomes its left children, whereas values more than 80 be-
comes its right children as shown in the picture below.
7
Question 7
Consider the extendable hashing on a file that contains records with the search-key values:
11, 21, 23, 31, 34, 35, 49, 53, 55, 59 Marks: 2 MCQ
d) In extendable hashing, performance will not degrade with the growth of the file.
Answer: a)
Explanation: Key 18 will be allocated in the same bucket of 34, no new bucket will be
required.
Hence, the statement given in option a) is incorrect.
8
Question 8
Suppose a database management system uses dense indexing. Suppose that 128 blocks are
required to store a database file and its index file. How many records does the database file
contain? Given that one memory block of the disk can store either 48 key pointers or 16 whole
records.
Marks: 2 MCQ
a) 1024
b) 1536
c) 2048
d) 4096
Answer: b)
Explanation: Suppose there are N number of records.
Number of blocks needed to store data file with N records = N/16
Number of blocks needed to store dense index file = N/48
Total blocks required = N/16 + N/48 = 4N/48 blocks = N/12 blocks =128
So, total number of records = 128 ∗ 12 = 1536 records
So, option b) is correct.
9
Question 9
Consider the following table:
Marks: 2 MCQ
Answer: d)
Explanation: Paper ‘Data Structure’ is present in 2nd and 3rd tuple and absent in 1st,
4th and 5th tuples. So the bitmap indices for ‘Data Structure’ is 01100. Similarly Type
‘Sessional’ is present in 3rd, and 4th tuples and is absent in 1st, 2nd and 5th tuples. So the
bitmap indices for ‘Sessional’ is 00110.
Hence, option d) is correct.
10
Question 10
Identify the correct SQL query to create Bitmap index on attribute Type on the following table
Course
Course
Code Paper Type
CS2322 C Programing Theory
IT1221 Data Stucture Theory
EC3242 Data Stucture Sessional
CS5850 Python Sessional
IT1972 C Programing Theory
Marks: 2 MCQ
Answer: a)
Explanation: The syntax is CREATE BITMAP INDEX<index-name> on <relation-
name> (<attribute-list>).
‘INDEX’ word is missing in c) & ‘BITMAP’ word is missing in d). So they are incorrect.
Option b) is also incorrect.
Option a) follows the actual syntax.
Hence, option a) is correct.
11