ITPEC FE Morning April 2018 Question 17

Source exam: ITPEC FE Morning April 2018Topic: Databases

ITPEC FE Morning April 2018 — Question 17 of 80

Hash Table — Linear Probing — find which key lands at address 1 after collisions.

Hash function: address = key mod 5 + 1, addresses 1–6, linear probing with wrap-around.

Insert keys in order: 3, 4, 8, 13, 14, 18:

  • 3: 3 mod 5 + 1 = 4 → addr 4
  • 4: 4 mod 5 + 1 = 5 → addr 5
  • 8: 8 mod 5 + 1 = 4 → collision → 5 → 6 → addr 6
  • 13: 13 mod 5 + 1 = 4 → collision → 5 → 6 → 1 → addr 1
  • 14: 14 mod 5 + 1 = 5 → collision → 6 → 1 → addr 2
  • 18: 18 mod 5 + 1 = 4 → collision → 5 → 6 → 1 → 2 → addr 3

Final table:

Address123456
Key131418348

Answer: b) 13

Why not others:
- (a) 8 — landed at address 6 after two collisions

- (c) 14 — landed at address 2 after wrap-around

- (d) 18 — landed at address 3, last to fill the table

Key rule: In linear probing, when a collision occurs, check the next address sequentially; after the last address, wrap around to address 1.

AI-generated — may contain errors

The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.