logo

AQA A-Level Computer Science practice

What is the main purpose of a hash function in a hash table?

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

At a glance

MCQ

Type

practice

Style

Topic

Data structures and abstract data types

Exam-style question

Try this first

What is the main purpose of a hash function in a hash table?.

  1. A.To calculate a location from a key
  2. B.To arrange values into a hierarchy
  3. C.To remove the oldest item first
  4. D.To make a stack dynamic

Answer and explanation

Concise answer

To calculate a location from a key

Why this is correct

A hash function converts a key into a value that can be used to identify a location in a hash table. If two keys produce the same location, the collision must be handled by the implementation.

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