11.3. Chapter Review QuestionsΒΆ

  1. Distinguish the cases when you would want to use a list instead of an array, or the other way around.

  2. What syntax is consistent between arrays and lists? What are comparable features, but with different syntax?

  3. How is the type declaration for a generic type distinctive?

  4. Here is one way to put five particular elements into a list:

    var words = new List<string>();
    string[] temp = {"a", "an", "the", "on", "of"};
    foreach(string s in temp) {

    How can you do this all without a loop, and with only two statements? How about with a single statement, assuming you do not need temp again?

  5. If we continue on from above, with the line:

    var words2 = words;

    Then what would be the difference in effect between these two possible next lines?

    words = new List<string>();
  6. The constructors for collections like a List are all overloaded. What forms are allowed in general?

  7. If you delete an element from the middle of a list, what happens to the spot where you removed the element?