CS21: Quiz 4 Study Guide

In addition to the concepts below, you should also know the concepts from Quiz 1, Quiz 2, and Quiz 3. Many of the earlier concepts -- especially functions -- are fundamental to what we've been studying recently.

You should be able to define the following terms:

You should understand and be able to use the following Python concepts:

Practice problems:

  1. Write a while loop that prints out all even numbers from 2 to 20.
  2. Write a program that reads in the following data from a file and computes the average value:
    98
    100
    91
    82
    88
    86
    77
    
  3. Given any specific definite (for) loop, write an indefinite (while) loop that performs the same computation.
  4. Discussion question 3 on page 261
  5. True/False 1-4 from Chapter 13 (pgs. 460-461)
  6. Multiple choice problems 1,2 on page 460 (Chapter 13)
  7. Discussion question 1 on page 462 (Chapter 13)
  8. What is the minimum and maximum possible number of items linear search will inspect to find a value in a list of n=64 items? What are the min and max possible number of items to inspect for a binary search with n=64?
  9. Show the low, high, and mid values for each step of a binary search for the value 7 in this list: [ -3, 4, 5, 10, 14, 18, 22, 31, 44, 66, 70]