What is a collision in hash tables?
A) When two keys hash to the same index
B) When a key is not found in the table
C) When the hash table is full
D) When the hash function fails
Answer: A) When two keys hash to the same index
Which collision resolution technique involves storing multiple entries at the same index?
A) Open addressing
B) Chaining
C) Linear probing
D) Double hashing
Answer: B) Chaining
What is the primary advantage of chaining over open addressing?
A) Simplicity of implementation
B) Better handling of load factors
C) Faster lookup times
D) Reduced memory usage
Answer: B) Better handling of load factors
In open addressing, what happens when a collision occurs?
A) The new entry is discarded
B) The existing entry is removed
C) The algorithm searches for the next available slot
D) The hash function is recalculated
Answer: C) The algorithm searches for the next available slot
Which of the following is NOT a method of open addressing?
A) Linear probing
B) Quadratic probing
C) Chaining
D) Double hashing
Answer: C) Chaining
What happens in chaining when a bucket exceeds its limit?
A) The bucket is resized
B) The entries are sorted
C) New entries are added to a linked list
D) The old entries are deleted
Answer: C) New entries are added to a linked list
Which collision resolution technique can lead to primary clustering?
A) Chaining
B) Linear probing
C) Quadratic probing
D) Double hashing
Answer: B) Linear probing
What is a common use of linked lists in the chaining method?
A) To store entries in sorted order
B) To handle collisions at a hash table index
C) To improve search speed
D) To reduce memory consumption
Answer: B) To handle collisions at a hash table index
In quadratic probing, how is the next slot calculated?
A) By linearly increasing the index
B) By using a quadratic function of the number of collisions
C) By randomly selecting an index
D) By doubling the index
Answer: B) By using a quadratic function of the number of collisions
What is the disadvantage of chaining?
A) Requires extra memory for pointers
B) Slower than open addressing
C) Complexity in implementation
D) No significant disadvantages
Answer: A) Requires extra memory for pointers
In which scenario is open addressing generally preferred?
A) When memory overhead is a concern
B) When dealing with a high load factor
C) When frequent deletions occur
D) When the hash function is complex
Answer: A) When memory overhead is a concern
What is the main goal of collision resolution techniques?
A) To sort the entries
B) To ensure unique keys
C) To minimize retrieval time
D) To handle situations where multiple keys hash to the same index
Answer: D) To handle situations where multiple keys hash to the same index
Which technique allows for easier iteration over all elements in a hash table?
A) Open addressing
B) Chaining
C) Linear probing
D) Quadratic probing
Answer: B) Chaining
How does double hashing improve on linear probing?
A) It reduces collisions by using a secondary hash function
B) It requires less memory
C) It guarantees faster access times
D) It uses linked lists
Answer: A) It reduces collisions by using a secondary hash function
What does the term “load factor” refer to in hash tables?
A) The ratio of used slots to total slots
B) The number of collisions encountered
C) The size of the hash table
D) The complexity of the hash function
Answer: A) The ratio of used slots to total slots
Which of the following statements about open addressing is true?
A) It cannot handle deletions effectively
B) It uses additional memory for linked lists
C) It can lead to clustering issues
D) It is always faster than chaining
Answer: C) It can lead to clustering issues
What happens during a linear probing collision resolution?
A) The next index is checked sequentially
B) The bucket is resized
C) A new hash function is applied
D) The entry is deleted
Answer: A) The next index is checked sequentially
What is the main benefit of using quadratic probing?
A) It guarantees no collisions
B) It minimizes clustering compared to linear probing
C) It is easier to implement
D) It requires less memory
Answer: B) It minimizes clustering compared to linear probing
In chaining, what is the structure commonly used to store multiple entries?
A) Array
B) Linked list
C) Stack
D) Queue
Answer: B) Linked list
What happens to the performance of open addressing as the load factor increases?
A) It improves
B) It remains constant
C) It degrades
D) It becomes unpredictable
Answer: C) It degrades
Which collision resolution technique is considered more space-efficient?
A) Chaining
B) Open addressing
C) Linear probing
D) Quadratic probing
Answer: B) Open addressing
What is the key advantage of chaining in terms of performance?
A) Faster search times
B) Simplicity of implementation
C) Less sensitive to load factor
D) Lower memory requirements
Answer: C) Less sensitive to load factor
What happens in open addressing when the hash table is full?
A) The table is resized
B) The program crashes
C) New entries cannot be added
D) Collisions are ignored
Answer: C) New entries cannot be added
What is the primary disadvantage of open addressing?
A) Complexity of implementation
B) Memory overhead
C) Performance degradation at high load factors
D) Inefficient memory usage
Answer: C) Performance degradation at high load factors
In which collision resolution method is each index potentially a linked list?
A) Open addressing
B) Quadratic probing
C) Chaining
D) Linear probing
Answer: C) Chaining
What is the best-case scenario for retrieval time in a hash table using chaining?
A) O(1)
B) O(n)
C) O(log n)
D) O(n^2)
Answer: A) O(1)
Which of the following is a disadvantage of chaining?
A) Potential for long linked lists
B) More complex implementation than open addressing
C) Greater memory overhead
D) All of the above
Answer: D) All of the above
In which method do entries occupy contiguous memory locations?
A) Chaining
B) Open addressing
C) Both A and B
D) None of the above
Answer: B) Open addressing
Which probing method adjusts the index based on a quadratic function?
A) Linear probing
B) Chaining
C) Quadratic probing
D) Double hashing
Answer: C) Quadratic probing
What is a disadvantage of linear probing?
A) It cannot handle deletions
B) It can lead to clustering
C) It uses more memory
D) It is always slower than chaining
Answer: B) It can lead to clustering
What is the primary purpose of a secondary hash function in double hashing?
A) To calculate the initial index
B) To determine the next available index after a collision
C) To reduce the memory overhead
D) To encrypt the keys
Answer: B) To determine the next available index after a collision
In which scenario is chaining particularly effective?
A) When the load factor is low
B) When there are many collisions
C) When memory is constrained
D) When deletions are frequent
Answer: B) When there are many collisions
What is the typical time complexity for search operations in open addressing?
A) O(1)
B) O(n)
C) O(log n)
D) O(n^2)
Answer: B) O(n)
Which of the following is an effective strategy to manage collisions in hash tables?
A) Ignoring collisions
B) Increasing the size of the table
C) Using a chaining method
D) Using multiple hash functions
Answer: C) Using a chaining method
What factor can significantly affect the performance of collision resolution techniques?
A) The choice of programming language
B) The efficiency of the hash function
C) The data types used
D) The order of insertion
Answer: B) The efficiency of the hash function
Basic Concepts
Non-Linear Data Structures MCQs
Sorting and Searching Algorithms MCQs
- Data Structures MCQs 1
- Data Structures MCQs 2
- Data Structures MCQs 3
- Data Structures MCQs 4
- Data Structures MCQs 5
- Stacks Solved MCQs
- Queues MCQs
- pointer mcqs
- Array MCQs