Hashing data structure multiple choice questions with answers

 

  1. What is a hashing data structure? a) A data structure that uses a hash function to map keys to indices in an array - Answer b) A data structure that uses a linked list to store data c) A data structure that uses a tree to store data d) A data structure that uses a graph to store data

  2. What is the time complexity of searching for an element in a hash table with perfect hashing? a) O(1) - Answer b) O(n) c) O(log n) d) O(n log n)

  3. What is collision in a hash table? a) When two or more keys are mapped to the same index - Answer b) When two or more keys are mapped to different indices c) When the hash function returns an index outside the size of the array d) When the hash function returns the same index for different keys

  4. What is the purpose of a hash function in a hash table? a) To map keys to indices in an array - Answer b) To map keys to linked list nodes c) To map keys to tree nodes d) To map keys to graph nodes

  5. What is the difference between a hash table and an array? a) A hash table uses a hash function to map keys to indices, while an array uses a numerical index - Answer b) A hash table uses a linked list to store data, while an array uses a numerical index c) A hash table uses a tree to store data, while an array uses a numerical index d) A hash table uses a graph to store data, while an array uses a numerical index

Comments

Popular posts from this blog

How to study Data Structure for Campus Placement?

How to learn Python programming?

Queue data structure multiple choice questions with answers