Engineering Questions with Answers - Multiple Choice Questions

Hash Tables Chaining using Doubly Linked Lists Multiple Choice MCQ

1 - Question

Which of the following is used in hash tables to determine the index of any input record?
a) hash function
b) hash linked list
c) hash tree
d) hash chaining

View Answer

Answer: a
Explanation: Hash table is an example of a data structure that is built for fast access of elements. Hash functions are used to determine the index of any input record in a hash table.




2 - Question

What is the advantage of a hash table as a data structure?
a) faster access of data
b) easy to implement
c) very efficient for less number of entries
d) exhibit good locality of reference

View Answer

Answer: a
Explanation: Hash table is a data structure that has an advantage that it allows fast access of elements. Hash functions are used to determine the index of any input record in a hash table.




3 - Question

What is the use of a hash function?
a) to calculate and return the index of corresponding data
b) to store data
c) to erase data
d) to change data

View Answer

Answer: a
Explanation: Hash function calculates and returns the index for corresponding data. This data is then mapped in a hash table.




4 - Question

What is the time complexity of insert function in a hash table using a doubly linked list?
a) O(1)
b) O(n)
c) O(log n)
d) O(n log n)

View Answer

Answer: a
Explanation: Time complexity of insert function in a hash table is O(1). Condition is that the number of collisions should be low.




5 - Question

What is the time complexity of search function in a hash table using a doubly linked list?
a) O(1)
b) O(n)
c) O(log n)
d) O(n log n)

View Answer

Answer: a
Explanation: Time complexity of search function in a hash table is O(1). Condition is that the number of collisions should be low.




6 - Question

What is the time complexity of delete function in the hash table using a doubly linked list?
a) O(1)
b) O(n)
c) O(log n)
d) O(n log n)

View Answer

Answer: a
Explanation: Time complexity of delete function in a hash table is O(1). Condition is that the hash function should be such that the number of collisions should be low.




7 - Question

Hashing can be used to encrypt and decrypt digital signatures.
a) true
b) false

View Answer

Answer: a
Explanation: Hashing is also used in encryption algorithms. It is used for encryption and decryption of digital signatures.




8 - Question

What is the advantage of using a doubly linked list for chaining over singly linked list?
a) it takes less memory
b) it is easy to implement
c) it makes the process of insertion and deletion faster
d) it causes less collisions

View Answer

Answer: c
Explanation: Using a doubly linked list reduces time complexity significantly. Though it uses more memory to store the extra pointer.




9 - Question

Which of the following technique stores data in the hash table itself in case of a collision?
a) Open addressing
b) Chaining using linked list
c) Chaining using doubly linked list
d) Chaining using binary tree

View Answer

Answer: a
Explanation: Open addressing is used to store data in the table itself in case of a collision. Whereas chaining stores data in a separate entity.




10 - Question

Which of the following technique stores data in a separate entity in case of a collision?
a) Open addressing
b) Chaining using doubly linked list
c) Linear probing
d) Double hashing

View Answer

Answer: b
Explanation: Chaining using doubly linked list is used to store data in a separate entity (doubly linked list in this case) in case of a collision. Whereas open addressing stores it in the table itself.




11 - Question

Collision is caused due to the presence of two keys having the same value.
a) True
b) False

View Answer

Answer: a
Explanation: A collision is caused due to the presence of two keys having the same value. It is handled by using any one of the two methods namely:- Chaining and Open addressing.

Get weekly updates about new MCQs and other posts by joining 18000+ community of active learners