Chapter 1

True/False

  1. False
  2. True
  3. False
  4. True
  5. False
  6. True
  7. False
  8. True
  9. False
  10. True

Multiple Choice

  1. b
  2. d
  3. d
  4. a
  5. b
  6. b
  7. c
  8. d
  9. a
  10. d

Discussion

  1. Actual answers will vary and should include more detail. Here are the outlines of some answers.
    1.  Hardware is the physical components while software is the programs.
    2. Both may be thought of as a sequence of steps to solve a problem. A program is a specific implementation of some algorithm that can be executed by a computer.
    3.  Programming languages used to write instuctions for computers are precise. Natural languages used for human communication are ambiguous.
    4. High-level languages are intended to be easier for humans and must be translated into the machine language that the hardware of a particular computer understands.
    5. A compiler provides a one-shot translation, while an interpreter simulates a machine that understands a high-level language.
    6. Syntax is form and semantics is meaning.
  2. See discussion of Figure 1.1 in the text (Pages 5 and 6).
  3.  Students will have varying degrees of success with this problem. Strictly speaking it is not really well specified, as we don't have an agreed upon vocabulary for expressing the steps of an algorithm. This question can be used to illustrate some of the difficulties of using natural language to describe processes in detail.
  4. If a float is used to represent a quantity in a chaotic function, then a very small rounding error can lead to results that are utlimately quite inaccurate and therefore not useful.
  5.  This can be checked by running the program:

    0.49725
    0.97497050625
    0.0951717709512
    0.335845009364
    0.869907242293
    0.441357665188
    0.961588198614
    0.14405170611
    0.4808731671
    0.973573240627

Programming Exercises

  1. Students should do these interactively
    1. Hello, world!
    2. Hello world!
    3. 3
    4. 3.0
    5. 5
    6. 5.0
    7. 23
    8. 2 + 3 = 5
    9. 6
    10. 8
    11. 0
    12.  0.66666666666666663
  2. This is an activity.
  3. The modified program will print a sequence of values converging to 0.5 regardless of what value is input. It is no longer chaotic.
  4. The loop changes to:
    for i in range(20):
    x = 3.9 * x * (1 - x)
    print x
  5. c01ex5.py
  6. c01ex6.py