Data Structures · Question 23 · Medium

Data Structures question 23

The keys 12, 22, 35, 42, 55, 7, 17 are inserted into a hash table of size 10 using h(k) = k mod 10, and collisions are resolved by separate chaining. How many keys are in the longest chain?

  1. 3
  2. 4
  3. 2
  4. 1
Answer and explanation

Answer: A. 3

Explanation: Slot 2 gets 12, 22 and 42; slot 5 gets 35 and 55; slot 7 gets 7 and 17. The longest chain is in slot 2 with 3 keys.

Previous: What is the prefix (Polish) form of the infix expression (A + B) * (C - D) ? · Next: An undirected simple graph has 6 vertices whose degrees are 3, 3, 2, 2, 2 and…

Practise data structures

Try a fresh set of data structures questions with an explanation after every answer, free and without signing up: Data Structures practice. Or sit a full placement mock test.

More data structures questions

More technical & programming practice

Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems · Computer Networks · Software Engineering · Cloud & DevOps

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge