Session 8 Preparation — Videos, Reading and Quizzes
Quizzes:
Do this Quiz on Session 8
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 8 (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 8 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).
- The Wait Until Event Pattern and WHILE Loops
- Video:
-
Video (embedded in a web page) [7:34 minutes]
-
Video (as an mp4 that you can download if you want)
- Optional
textbook reading:
Section 4.1 — The WHILE Loop
(pages 156-162, 7 pages) and
Section 4.3 — Application: Processing Sentinel Values
(pages 166 - 169, 4 pages)
The above video and reading cover much the same material,
but with two very different presentations.
Choose what works best for you. In the reading, focus your attention on:
- The concept of looping until a condition is false,
per the nice example in Figure 2 on page 158.
- The notation for WHILE statements, per Syntax 4.1 on page 157.
- The distinction between count-controlled loops (sometimes called definite loops)
and event-controlled loops (sometimes called indefinite loops).
- Count-controlled loops are typically implemented by using FOR loops,
as we have been doing since Session 3.
- Event-controlled loops are loops per the wait-until-event pattern described in the video.
These are typically implemented by using WHILE loops.
- The concept of a sentinel — an input that signals the end of input
(and is not itself real data).
Aside: There are two basic approaches to event-controlled loops when
it is wrong to check the condition as the first act in the loop.
The video presents one style, the textbook another; either is fine.
Special Topic 4.1 acknowledges the video's style, in its discussion of using a break
statement to implement a loop and an half.
- Hand-Tracing
Textbook reading: Section 4.2 — Problem Solving: Hand-Tracing
(pages 163 - 165, 3 pages).
You will do hand-tracing on your first test;
this section is a nice example of the “how-to's” for doing so.