1. : What is hashing?
(A) A method of data encryption
(B) A process of converting data into a fixed-size value
(C) A way to sort data
(D) None of the above
2. : Which of the following is a common use of hashing?
(A) Searching data
(B) Storing passwords
(C) Data retrieval
(D) All of the above
3. : What is a hash table?
(A) A collection of key-value pairs
(B) A type of array
(C) A type of linked list
(D) None of the above
4. : What is the main advantage of using a hash table?
(A) Sequential access
(B) Fast data retrieval
(C) Low memory usage
(D) Simplicity
5. : What is a collision in hashing?
(A) When two keys map to the same hash value
(B) When a key is not found
(C) When data is corrupted
(D) None of the above
6. : Which of the following techniques is used to resolve collisions?
(A) Chaining
(B) Open addressing
(C) Both A and B
(D) None of the above
7. : In a hash table, what is the load factor?
(A) Ratio of the number of entries to the size of the table
(B) Number of collisions
(C) Size of the data
(D) None of the above
8. : What happens when the load factor exceeds a certain threshold in a hash table?
(A) The table is resized
(B) Collisions increase
(C) Data is lost
(D) None of the above
9. : What is the purpose of a hash function?
(A) To encrypt data
(B) To create a unique index for a given key
(C) To sort data
(D) None of the above
10. : Which of the following is NOT a characteristic of a good hash function?
(A) Uniform distribution
(B) Fast computation
(C) Easy to invert
(D) Minimizes collisions
11. : What is open addressing in hashing?
(A) Storing multiple values in the same index
(B) Finding the next open slot for a key
(C) Storing data in sorted order
(D) None of the above
12. : Which of the following is a common open addressing technique?
(A) Linear probing
(B) Quadratic probing
(C) Double hashing
(D) All of the above
13. : What is the primary disadvantage of chaining for collision resolution?
(A) Increased memory usage
(B) Slow retrieval times
(C) Complexity
(D) None of the above
14. : In a hash table, if the size of the table is 10 and there are 5 entries, what is the load factor?
(A) 0.5
(B) 1
(C) 2
(D) 0.1
15. : What is the time complexity of searching for an element in an ideal hash table?
(A) O(n)
(B) O(log n)
(C) O(1)
(D) O(n log n)
16. : Which of the following hash functions is considered to be simple but not very effective?
(A) Division method
(B) Multiplication method
(C) Universal hashing
(D) None of the above
17. : In hashing, what is the main problem caused by a high load factor?
(A) Increased retrieval time
(B) Increased storage
(C) Data loss
(D) None of the above
18. : What is the main purpose of a hash code?
(A) To encrypt data
(B) To create a unique identifier for data
(C) To sort data
(D) None of the above
19. : What is the expected time complexity for insertion in a well-designed hash table?
(A) O(n)
(B) O(log n)
(C) O(1)
(D) O(n log n)
20. : Which of the following is an example of a non-cryptographic hash function?
(A) SHA-256
(B) MD5
(C) MurmurHash
(D) HMAC
21. : What is the main use of cryptographic hash functions?
(A) Data storage
(B) Data retrieval
(C) Data integrity and security
(D) None of the above
22. : Which of the following statements is true regarding hashing?
(A) It guarantees unique keys for every value
(B) It can lead to collisions
(C) It uses more memory than other data structures
(D) None of the above
23. : What is the effect of a poor hash function?
(A) Faster retrieval
(B) Increased collisions
(C) Reduced memory usage
(D) None of the above
24. : What is the primary benefit of using a hash table for data storage?
(A) Easy to implement
(B) Fast data access
(C) Requires less memory
(D) None of the above
25. : Which method is used to compute a hash value from a key?
(A) Hash algorithm
(B) Hash table
(C) Hash function
(D) None of the above
26. : What is a hash collision resolution strategy that uses linked lists?
(A) Linear probing
(B) Quadratic probing
(C) Chaining
(D) Double hashing
27. : Which of the following scenarios can lead to poor performance in hash tables?
(A) High load factor
(B) Poor hash function
(C) Excessive collisions
(D) All of the above
28. : What is double hashing?
(A) A technique that uses two hash functions to resolve collisions
(B) A method of storing data twice for redundancy
(C) A method of increasing the size of a hash table
(D) None of the above
29. : Which of the following describes the chaining technique for collision resolution?
(A) All elements are stored in a single list
(B) Each index in the hash table points to a linked list of entries
(C) The first collision is resolved by linear probing
(D) None of the above
30. : What is the time complexity for deleting an element from a hash table?
(A) O(n)
(B) O(log n)
(C) O(1)
(D) O(n log n)
31. : Which hashing technique is best suited for a dynamic dataset?
(A) Static hashing
(B) Dynamic hashing
(C) Open addressing
(D) None of the above
32. : What is the main disadvantage of open addressing?
(A) Increased memory usage
(B) Complexity of implementation
(C) Performance degradation with high load factors
(D) None of the above
33. : What is a universal hashing?
(A) A hash function that is used for all types of data
(B) A technique that minimizes collisions for any input
(C) A hashing method based on randomization
(D) None of the above
34. : Which hash function method is commonly used in databases?
(A) Division method
(B) Multiplication method
(C) Cryptographic hash functions
(D) None of the above
35. : What is the purpose of rehashing?
(A) To improve data security
(B) To reduce the number of collisions
(C) To increase the size of the hash table
(D) None of the above
36. : Which of the following best describes a hash function?
(A) It maps data of arbitrary size to fixed-size values
(B) It only works with numeric data
(C) It is always one-to-one
(D) None of the above
37. : In a hash table with a capacity of 10, if the load factor is 0.8, how many entries are there?
(A) 8
(B) 10
(C) 12
(D) 6
38. : What is the impact of using a good hash function?
(A) Reduced collisions
(B) Faster access times
(C) Efficient memory usage
(D) All of the above