CS 1401, Quiz #3

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

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

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

3. What are the values of the following expressions:

(a) 10.0%3.3

(b) (-10.0)%(-3.3)

(c) 10.0%(-3.3)

4. Write down a code sequence that swaps the values of two integer variables this_year and last_year. Suppose that the initial value of this_year was 2,004, and the initial value of last_year was 2,005. 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.