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.
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
Try the following exercises but stop if you get lost or confused.
It is perfectly OK to do some or all of the following exercises in class.
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.
- Attempt the remaining problems. You do NOT need to complete the entire exercise before class. As noted above
if you get lost or confused, stop and bring the printout to class and we'll continue working on it in class during Session 12.
- Study Materials Solutions for these problems may now be found here:
SOLUTION.
Turn in your solution in Session 12's class.