Chapter Review Questions

  1. Which is true for a Dictionary: is it mutable or immutable?

  2. Though for some collections, like arrays and lists, you can fairly easily replace a foreach loop with a for loop, that is not the case if you want to iterate through a Dictionary. How do you go through all the keys in a Dictionary?

  3. What syntax is there for a Dictionary that matches that for a List?

  4. How is a Dictionary like an array? How is it different?

  5. Dictionary values are of arbitrary type. What is the restriction on key types?

  6. How is a HashSet different than a List?

  7. What syntax is shared between a List and a HashSet?

  8. Which is more efficient in general: searching for an element of a list or finding the value given a key in a dictionary?