Question: 1. In order to be a valid key for a dictionary, the key must be a. Hashable b. An integer c. A string d. A
1. In order to be a valid key for a dictionary, the key must be
a. Hashable
b. An integer
c. A string
d. A non-negative integer
2. In python, dictionaries are implemented as
a. A hash table
b. A linked list
c. A tuple
d. A list
3. Dictionary entries are ordered by position
True
False
4. If our has function is:
def h(x):
return (x + 1) % 12
Then What value will 24 hash to?
a. 0
b. 1
c. 25
d. 12
5. A dictionary can serve as another dictionary key
True
False
6. A company will store all employees in a hash table. Each employee item consists of a name, department, salary, and employee ID number. Which is the most appropriate key?
a. Name
b. Employee ID
c. Salary
d. Department
7. A dictionary entry is accessed by placing a key in curly braces { }.
True
False
8. Executing the following statements produces a KeyError:
prices = {'apples': 1.99, 'oranges': 1.49, 'kiwi': 0.79}
del prices['limes']
True
False
9. In an open hashing scheme, the data at each location within the hashtable is
a. A hash function
b. A tuple
c. A linked list
d. A list
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
