Session 12 Preparation — Videos, Reading and Quizzes
Quizzes:
Do this Quiz on Session 12
as you watch the videos and do the reading (as listed below).
This document is a Microsoft Word document;
here is the same Quiz on Session 12 (pdf) as a PDF.
You can either:
- Download it and fill it in electronically, or
- Print it, fill it in by hand, and scan the result.
In either case, turn it in via the Session 12 Dropbox on our Moodle site.
Videos and Reading (online and textbook):
All of the following are required except the items labeled Optional are, well, optional
(i.e., things that may be interesting but do not directly pertain to your success in this course).
- Box-and-Pointer Diagrams and Mutable Objects
- Lists are Mutable
- Textbook reading: Read (or re-read, if you have already read it) Section 6.1.4 — List References (bottom of page 281, 1 page).
Focus your attention on:
- List variables, like all variables, refer to their (list) objects.
- Since a list object is a mutable container, it's “insides” can be changed
as shown in the right-hand-side of Figure 2 on page 281.
- The right-hand-side of Figure 2 on page 281 shows how an assignment of an element of a list
does NOT change what the list variable itself refers (points) to.
Rather, it MUTATES the list, i.e., changes the insides of the list.
- Box-and-Pointer Diagrams and Mutable Objects — Exercise
Apply the ideas in the above explanation of
Box-and-Pointer Diagrams and Mutable Objects to do the following, in the order listed:
- Read AND DO problems 1 through 3 (NOT the entire exercise, but just problems 1 through 3) of this
exercise on Box-and-Pointer Diagrams and Mutable Objects.
- CHECK your answers to problems 1 through 3 (that you just did) by using this
Answer Key to Problems 1 through 3 of the exercise on Box-and-Pointer Diagrams and Mutable Objects above.
- Repeat the previous two steps, but now:
- Read AND DO problems 4 and 5.
- CHECK your answers to problems 4 and 5 (that you just did) by using this
Answer Key to Problems 4 and 5 of the exercise on Box-and-Pointer Diagrams and Mutable Objects above.
- Repeat the previous two steps, but now:
- Read AND DO problem 6.
- CHECK your answers to problem 6 (that you just did) by using this
Answer Key to Problem 6 of the exercise on Box-and-Pointer Diagrams and Mutable Objects above.
- Repeat the previous two steps, but now:
- Read AND DO problem 7.
- CHECK your answers to problem 7 (that you just did) by using this
Answer Key to Problem 7 of the exercise on Box-and-Pointer Diagrams and Mutable Objects above.
- Repeat the previous two steps, but now:
- Read AND DO problem 8.
- CHECK your answers to problem 8 (that you just did) by using this
Answer Key to Problem 8 of the exercise on Box-and-Pointer Diagrams and Mutable Objects above.
- Repeat the previous two steps, but now:
- Read AND DO problem 9.
- CHECK your answers to problem 9 (that you just did) by using this
Answer Key to Problem 9 of the exercise on Box-and-Pointer Diagrams and Mutable Objects above.
Turn in your final solution (after checking your answers, correcting them as needed) in the Session 12 Dropbox for Box and Pointer Exercise on our Moodle site.