• Data Structure Reference

• Other Reference

# MCQ - Hashing Function in Data Structure

11. What is direct addressing?

A. Distinct array position for every possible key
B. Fewer array positions than keys
C. Fewer keys than array positions
D. None of the mentioned

12. What is the search complexity in direct addressing?

A. O(n)
B. O(logn)
C. O(nlogn)
D. O(1)

13. What is a hash function?

A. A function has allocated memory to keys
B. A function that computes the location of the key in the array
C. A function that creates an array
D. None of the mentioned

14. What can be the techniques to avoid collision?

A. Make the hash function appear random
B. Use the chaining method
C. Use uniform hashing
D. All of the mentioned

15. What is simple uniform hashing?

A. Every element has equal probability of hashing into any of the slots
B. A weighted probabilistic method is used to hash elements into the slots
C. All of the mentioned
D. None of the mentioned

16. In simple uniform hashing, what is the search complexity?

A. O(n)
B. O(logn)
C. O(nlogn)
D. O(1)

17. In simple chaining, what data structure is appropriate?

A. Singly linked list
B. Doubly linked list
C. Circular linked list
D. Binary trees

18.Which of these are core interfaces in the collection framework. Select the one correct answer.

A. Tree
B. Stack
C. Queue
D. Map

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?

i. 9679, 1989, 4199 hash to the same value
ii. 1471, 6171 hash to the same value
iii. All elements hash to the same value
iv. Each element hashes to a different value

A. i only
B. ii only
C. i and ii only
D. iii or iv