GATE CS 2009 · File Organization & Data Types

MCQ · 2 marks · Problem DBMS-INDX-0055

The keys 12, 18, 13, 2, 3, 23, 5 and 15 are inserted into an initially empty hash table of length 10 using open addressing with hash function \(h(k) = k \bmod 10\) and linear probing. What is the resultant hash table? (Each option lists the occupied slots as slot: key.)
  1. A
    2: 2, 3: 23, 5: 15, 8: 18 (all other slots empty)
  2. B
    2: 12, 3: 13, 5: 5, 8: 18 (all other slots empty)
  3. C
    2: 12, 3: 13, 4: 2, 5: 3, 6: 23, 7: 5, 8: 18, 9: 15 (slots 0 and 1 empty)
  4. D
    2: 12, 2; 3: 13, 3, 23; 5: 5, 15; 8: 18 (each slot holding a chain)

Solve it on GATE DA practice →More Storage & Indexing problems

Show the worked solution\[\boxed{\text{linear probing: try } h(k), h(k)+1, \dots \pmod{10}}\]\(12 \to 2\), \(18 \to 8\), \(13 \to 3\), \(2 \to 4\) (2, 3 full), \(3 \to 5\) (3, 4 full), \(23 \to 6\) (3, 4, 5 full), \(5 \to 7\) (5, 6 full), \(15 \to 9\) (5, 6, 7, 8 full).(A) keeps only the last key per home slot (overwriting), (B) only the first, and (D) is chaining, not open addressing.Answer: C

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com