CS 1401, Quiz #4

Date: Tuesday, February 8, 2005
Name (please type legibly, ideally in block letters): ______________________________________________________________________

1. Declare a variable year of type long integer and assign it a value 2,005.

2. Declare a constant named EL_PASO of type double and assign, to this constant, a value 700 thousand (use scientific notation).

3. What are the values of the following expressions:

(a) 8.4%2.2

(b) (-20)%(-8)

(c) 8.4%(-2.2)

4. Write down a code sequence that swaps the values of two integer variables a and b. Suppose that the initial value of a was 56, and the initial value of b was 65. Show, step by step, how the contents of these variables (and of all the necessary auxiliary variables) changes after each step of the swap sequences; draw boxes corresponding to the variables and show how their contents change.