IT 117: Intermediate Scripting
Answers to Class 7 Ungraded Quiz


  1. Can you use lists as keys in a dictionary?
    no. you can only use things that are immutable, that cannot be changed
  2. Can the value in a dictionary entry be a list?
    yes. values do not have to be immutable
  3. What does the clear method of a dictionary object do?
    removes all the key-value pairs from a dictionary
  4. What does the get method of a dictionary object do?
    it retrieves a value from a dictionary, but does not
         raise an exception if the key given as an argument 
         does not exist in the dictionary
  5. What does the pop method of a dictionary object do?
    it retrieves a value from a dictionary and removes 
         the entry from the dictionary. it does not raise 
         an exception if the key given as an argument does not exist
  6. What does the popitem method of a dictionary object do?
    it returns a randomly chosen value from the dictionary 
         and removes the entry
  7. What does the items method of a dictionary object do?
    returns all key-value pairs in a dictionary
  8. What does the keys method of a dictionary object do?
    returns all the keys in a dictionary
  9. What does the values method of a dictionary object do?
    returns all the values in a dictionary
  10. What property must an object have to be used as a key in a dictionary?
    it must be immutable