This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Hash Tables Chaining using Doubly Linked Lists”.
1. 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
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. 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
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. 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
Explanation: Hash function calculates and returns the index for corresponding data. This data is then mapped in a hash table.
4. 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
Explanation: Time complexity of insert function in a hash table is O(1). Condition is that the number of collisions should be low.
5. 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
Explanation: Time complexity of search function in a hash table is O(1). Condition is that the number of collisions should be low.
6. 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
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. Hashing can be used to encrypt and decrypt digital signatures.
a) true
b) false
View Answer
Explanation: Hashing is also used in encryption algorithms. It is used for encryption and decryption of digital signatures.
8. 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
Explanation: Using a doubly linked list reduces time complexity significantly. Though it uses more memory to store the extra pointer.
9. 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
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. 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
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. Collision is caused due to the presence of two keys having the same value.
a) True
b) False
View Answer
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.
Sanfoundry Global Education & Learning Series – Data Structure.
To practice all areas of Data Structure, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check Programming Books
- Check Data Structure Books
- Practice Computer Science MCQs
- Practice Programming MCQs
- Check Computer Science Books