Hashing Function MCQ
11. What is direct addressing?
Explanation: Direct addressing is possible only when we can afford to allocate an array that has one position for every possible key.
12. What is the search complexity in direct addressing?
Explanation: Since every key has a unique array position, searching takes a constant time.
13. What is a hash function?
Explanation: In a hash table, there are fewer array positions than the keys, so the position of the key in the array has to be computed, this is done using the hash function.
14. What can be the techniques to avoid collision?
Explanation: Making the hash function random is not really a good choice, although it is considered one of the techniques to avoid collisions along with chaining and simple uniform hashing.
15. What is simple uniform hashing?
Explanation: In simple uniform hashing, any given element is equally likely to hash into any of the slots available in the array.
16. In simple uniform hashing, what is the search complexity?
Explanation: There are two cases, once when the search is successful and when it is unsuccessful, but in both the cases, the complexity is O(1+alpha) where 1 is to compute the hash function and alpha is the load factor.
17. In simple chaining, what data structure is appropriate?
Explanation: Deletion becomes easier with doubly linked list, hence it is appropriate.
18.Which of these are core interfaces in the collection framework. Select the one correct answer.
19. Given the following input (4322, 1334, 1471, 9679, 1989, 6171, 6173, 4199) and the hash function x mod 10, which of the following statements are true?
Hash function given is mod(10).
9679, 1989 and 4199 all these give same hash value i.e 9
1471 and 6171 give hash value 1
Also Check :