CS 3304 Fall 2000 Homework Assignment 6

50 Points
Due: Monday, November 6, at 5:00PM

The point value of each problem is shown in square brackets [ ]. Your solutions must be prepared with LaTeX or other word processing system and submitted as a stapled printout to a box outside the instructor's office (McBryde 638). This homework is due at 5:00PM on November 6, 2000. No late homework will be accepted. Complete each of the following problems and turn in your work:

  1. [6] Sebesta Chapter 3, Problem 12, part a (page 152). The Pascal repeat looks like this:
    repeat statement until boolean
    

  2. [12] Sebesta Chapter 3, Problem 13, parts c and d (page 153).

  3. [12] Derive a loop invariant and the weakest precondition for the following loop and the given postcondition:
    while  x <> y
        do x := x + 5
           y := y * 2
    {(x > 17) and (y < 129)}
    
    Assume that x and y are integer variables. Also argue that execution of the loop always terminates.

  4. [8] Sebesta Chapter 4, Problem 9 (page 191).

  5. [12] Sebesta Chapter 4, Problem 12 (page 192).

     

copyright © 2000 Virginia Tech, ALL RIGHTS RESERVED
Last modified: November 1, 2000, 08:53:02 EST, by Lenwood S. Heath <heath@cs.vt.edu>