# YOU CAN DOWNLOAD 200+ SUBJECTS PDF BOOK FOR COMPETITIVE EXAMINATIONS

## Data Structure Questions and Answers-Hash Tables

Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |

What is a hash table?

A structure that maps values to keys | |

A structure that maps keys to values | |

A structure used for storage | |

A structure used to implement stack and queue |

Question 1 Explanation:

A hash table is used to implement associative arrays which has a key-value pair, so the has table maps keys to values.

Question 2 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |

If several elements are competing for the same bucket in the hash table, what is it called?

Diffusion | |

Replication | |

Collision | |

None of the mentioned |

Question 2 Explanation:

None.

Question 3 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |

What is direct addressing?

Distinct array position for every possible key | |

Fewer array positions than keys | |

Fewer keys than array positions | |

None of the mentioned |

Question 3 Explanation:

Direct addressing is possible only when we can afford to allocate an array that has one position for every possible key.

Question 4 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |

What is the search complexity in direct addressing?

O(n) | |

O(logn) | |

O(nlogn) | |

O(1) |

Question 4 Explanation:

Since every key has a unique array position, searching takes a constant time.

Question 5 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |

What is a hash function?

A function has allocated memory to keys | |

A function that computes the location of the key in the array | |

A function that creates an array | |

None of the mentioned |

Question 5 Explanation:

In a hash table, there are fewer array positions than the keys, so the position of the key in the array has to be computed, this is done using the hash function.

There are 5 questions to complete.