Introduction to Programming Using Python, Y. Daniel Liang

This quiz is for students to practice. A large number of additional quiz is available for instructors from the Instructor's Resource Website.

Chapter 21 Hashing

Section 21.2 What Is Hashing?
21.1  A hashing function __________.
A. stores an element in the hash table
B. maps a key to an index in the hash table

21.2  If each key is mapped to a different index in the hash table, it is called _______.
A. normal hashing
B. perfect hashing

21.3  A collision occurs _____________.
A. when two or more keys are mapped to the same hash value.
B. when two elements have the same key value.
C. when two elements are mapped to the same key.

21.4  True or False? Two objects have the same hashCodes if they are equal.
A. True
B. False

21.5  True or False? If two strigns are equal, the two strings have the same hashCodes.
A. True
B. False

Sections 21.4-21.5
21.6  _____________ is to find an open location in the hash table in the event of collision.
A. Open addressing
B. Separate chaining

21.7  When a collision occurs during the insertion of an entry to a hash table, ______ finds the next available location sequentially.
A. linear probing
B. quadratic probing
C. double hashing.

21.8  The __________ places all entries with the same hash index into the same location, rather than finding new locations.
A. Open addressing scheme
B. separate chaining scheme

21.9  _______ measures how full the hash table is.
A. Load factor
B. Threshold