engineering computer science MCQ #1261

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

engineering computer science MCQ #1261

  1. Question 1

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

    • A) To encrypt data
    • B) To compress data
    • C) To map keys to indices
    • D) To sort data

    Answer: To map keys to indices

    Explanation: A hash function maps keys to indices of a backing array, allowing for fast lookups, insertions, and deletions in a hash table.