Topical Information

This set of questions should help you firm up your knowledge of the Java array-like containers.

Questions

  1. Do Review Exercise R7.1.
  2. Do Review Exercise R7.2.
  3. Do Review Exercise R7.3.
  4. Do Review Exercise R7.4.
  5. Do Review Exercise R7.5.
  6. Do Review Exercise R7.6.
  7. Do Review Exercise R7.7.
  8. Do Review Exercise R7.8. (You can stop after the first sentence. I believe this is an example of editorial leavage. (Although it is not listed on the errata page. *shrug*))
  9. Do Review Exercise R7.9.
  10. Do Review Exercise R7.10. (Even if you didn't have a debugger, you could simply print the elements in question to the screen to see their initial contents. However, you have access to the Data Display Debuggerddd — on mars.) (My apologies to The University of Wisconsin Madison's CS department for the theft of this fine link...)
  11. Do Review Exercise R7.11.
  12. Do Review Exercise R7.12.
  13. Do Review Exercise R7.13.
  14. Do Review Exercise R7.14.
  15. Do Review Exercise R7.15.
  16. Do Review Exercise R7.16.
  17. Do Review Exercise R7.17. (I wouldn't call them poor programming, just not necessarily as enlightened. They are still useful in languages where cla... Oops! I almost gave it away. *whew*)
  18. Do Review Exercise R7.18.
  19. This space reserved to add more questions...maybe...

This question set is worth (Level 6).

Optional Questions

Do any of the following for an additional (Level 1) each.

  1. Do Review Exercise R7.19 as a small (1-2 page) paper.
  2. Do Review Exercise R7.20 as a small (1-2 page) paper.
  3. A method that has an array list as a parameter can change the contents in two ways. It can change the contents of individual array elements or it can rearrange the elements. Describe two useful methods with ArrayList<BankAccount> parameters that change an array list of BankAccount objects in each of the two ways just described. (That is, one method modifies the individual elements and the other rearranges the elements.)
  4. Give an example of:
    1. A useful method that has an array of integers as a parameter that is not modified.
    2. A useful method that has an array of integers as a parameter that is modified.
    3. A useful method that has an array of integers as a return value.
    Describe each method; don't implement the methods.
  5. How do you perform the following tasks with arrays in Java?
    1. Test that two arrays contain the same elements in the same order.
    2. Copy one array to another.
    3. Fill an array with zeroes, overwriting all elements in it.
    4. Remove all elements from an array list.
  6. True or false?
    1. A method cannot return a two-dimensional array.
    2. A method can change the length of an array parameter.
    3. A method can change the length of an array list that is passed as a parameter.
    4. An array list can hold values of any type.