logo

AQA A-Level Computer Science practice

A hash table uses the hash function h(key) = key modulo 7. The keys 10 and 17 are inserted. Explain what happens and describe how rehashing could be used to handle the result.

Try the question first, then check the answer and practise the same topic again.

At a glance

Question

Type

practice

Style

Topic

Hash tables

Exam-style question

Try this first

A hash table uses the hash function h(key) = key modulo 7. The keys 10 and 17 are inserted. Explain what happens and describe how rehashing could be used to handle the result.

Answer and explanation

Concise answer

The key 10 produces 3 because 10 modulo 7 is 3.

Why this is correct

The answer identifies the equal hash values, defines the collision correctly and shows that rehashing must be checked because a second calculation can itself produce a collision.

Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions