Hashing and Hash Tables

Download Q&A
Q. In a hash table, what is the purpose of the hash function?
  • A. To sort the data
  • B. To convert keys into hash codes
  • C. To store data in a binary tree
  • D. To manage memory allocation
Q. What happens when the load factor of a hash table exceeds a certain threshold?
  • A. The table is resized
  • B. The table is deleted
  • C. The table becomes immutable
  • D. The table's performance improves
Q. What is a common strategy for resizing a hash table?
  • A. Doubling the size
  • B. Halving the size
  • C. Increasing by a fixed amount
  • D. Randomly changing the size
Q. What is a potential drawback of using open addressing for collision resolution?
  • A. Increased memory usage
  • B. Higher time complexity for insertions
  • C. Requires a linked list
  • D. Cannot handle deletions
Q. What is the effect of a poor hash function on a hash table?
  • A. Increased speed of operations
  • B. More collisions and decreased performance
  • C. Better memory utilization
  • D. No effect on performance
Q. What is the result of a poor hash function?
  • A. Increased memory usage
  • B. Faster access times
  • C. More collisions
  • D. Better data organization
Q. What is the time complexity of searching for an element in a hash table on average?
  • A. O(n)
  • B. O(log n)
  • C. O(1)
  • D. O(n^2)
Q. What is the worst-case time complexity for searching in a hash table with chaining?
  • A. O(1)
  • B. O(log n)
  • C. O(n)
  • D. O(n log n)
Q. Which of the following is a common method for handling collisions in hash tables?
  • A. Chaining
  • B. Sorting
  • C. Binary Search
  • D. Recursion
Q. Which of the following is a disadvantage of using hash tables?
  • A. Fast access time
  • B. Dynamic resizing
  • C. Collision handling complexity
  • D. Easy implementation
Q. Which of the following is NOT a characteristic of a good hash function?
  • A. Deterministic
  • B. Uniform distribution
  • C. Fast computation
  • D. Produces a sorted output
Q. Which of the following scenarios would benefit most from using a hash table?
  • A. When data needs to be stored in a sorted order
  • B. When frequent insertions and deletions are required
  • C. When searching for elements by key is common
  • D. When data is accessed sequentially
Q. Which of the following scenarios would most likely benefit from using a hash table?
  • A. Storing a sorted list of numbers
  • B. Implementing a priority queue
  • C. Counting the frequency of words in a document
  • D. Performing a binary search
Q. Which of the following statements about open addressing is true?
  • A. It uses linked lists to handle collisions
  • B. It requires more memory than chaining
  • C. It probes for the next available slot in the table
  • D. It is slower than chaining
Showing 1 to 14 of 14 (1 Pages)
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely