CS 1401, Quiz #3, version a

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

1. Declare a variable million of type long integer and assign it a value 1,000,000.






2. Declare a constant named MILLION of type double and assign, to this constant, a value 1,000,000 (use scientific notation).




3. What are the values of the following expressions:

(a) 8.0%3.2

(b) (-8.0)%(-3.2)

(c) 8.0%(-3.2)

4. Write down a code sequence that swaps the values of two long integer variables million and billion. Suppose that the initial value of million was 1,000,000,000, and the initial value of billion was 1,000,000. 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.