You are on page 1of 5

Varient 1

Q1) Which of the following schemes does quadratic probing come under? [1]
a) rehashing
b) open addressing
c) separate chaining
d)extended hashing

Q2) If we implement heap as maximum heap , adding a new node of value 15 . What
value will be at leaf nodes of the right subtree of the heap. [2]

a) 15 and 1
b) 25 and 1
c) 3 and 1
d) 2 and 3

Q3) In a min-heap, element with the smallest key is always in the which node? [1]

Q4) What is the running time of double hashing? [1]


a) Theta(m^2)
b) Theta(m)
c) Theta(m log k)
d) Theta(m^3)

Q5)Quadratic probing overcomes primary collision and secondary collision. [1]


a) True
b) false
Q6) Which of the following statement(s) is TRUE? [1]
1. A hash function takes a message of arbitrary length and generates a fixed length
code.
2. A hash function takes a message of fixed length and generates a code of variable
length.
3. A hash function always give different hash value for distinct messages.

Q7 ) What is the hash function used in Double Hashing for probing sequence ? [1]
a) (h1(k) – i*h2(k))mod m
b) h1(k) + h2(k)
c) (h1(k) + i*h2(k))mod m
d) (h1(k) + h2(k))mod m

Q8) A hash table of length 10 uses open addressing with hash function [2]
h(k)=k mod 10, and linear probing. After inserting 6 values into an empty hash table,
the table is as shown below.

Which one of the following choices gives a possible order in which the key values could
have been inserted in the table?

1. 46, 42, 34, 52, 23, 33


2. 34, 42, 23, 52, 33, 46
3. 46, 34, 42, 23, 52, 33
4. 42, 46, 33, 23, 34, 52
Q9) What is the complexity of adding an element to the heap. [1]
a) O(log n)
b) O(h)
c) O(log 1/2n)
d) O(n)

VARIENT 2
QUIZ 5
CS202

Name: Roll No.

Q1) A hash table of length 10 uses open addressing with hash function [2]
h(k)=k mod 10, and linear probing. After inserting 6 values into an empty hash table,
the table is as shown below.

Which one of the following choices gives a possible order in which the key values could
have been inserted in the table?

1. 46, 42, 34, 52, 23, 33


2. 34, 42, 23, 52, 33, 46
3. 46, 34, 42, 23, 52, 33
4. 42, 46, 33, 23, 34, 52
Q2) Which of the following statement(s) is TRUE? [1]
1. A hash function takes a message of arbitrary length and generates a fixed length
code.
2. A hash function takes a message of fixed length and generates a code of
variable length.
3. A hash function may give the same hash value for distinct messages.

Q3) Which of the following schemes does quadratic probing come under? [1]
a) rehashing
b) extended hashing
c) separate chaining
d) open addressing

Q4)Quadratic probing overcomes primary collision and secondary collision. [1]


a) True
b) False

Q5) What is the complexity of adding an element to the heap. [1]


a) O(log 1/2n)
b) O(h)
c) O(log n)
d) O(n)

Q6) If we implement heap as min-heap, deleting root node (value 1)from the heap.
What would be the value of root node after second iteration if leaf node (value 100) is
chosen to replace the root at start. [2]

a) 2
b) 100
c) 17
d) 3

Q7 ) What is the hash function used in Double Hashing for probing sequence ? [1]
a) (h1(k) – i*h2(k))mod m
b) h1(k) + h2(k)
c) (h1(k) + i*h2(k))mod m
d) (h1(k) + h2(k))mod m

Q8)What is the running time of double hashing? [1]


a) Theta(m)
b) Theta(m2)
c) Theta(m log k)
d) Theta(m3)

Q9) In a max-heap, element with the greatest key is always in the which node? [1]

You might also like