CS 1401, Quiz #2

Date: Monday, January 28, 2008
Name:  _______________________________

Class section: MWF 8:30 a.m.

1. For each of the following strings, write "yes" or "no" depending on whether the string is a legal names of a Java variable.; if your answer is "no", briefly explain why.

cashCow$

purple_Cow

2cows

cows2

brown cow28

2. Translate the following sequence of Java statements into English; show, step by step, what will happen after each of these statements.

double galOfMilk;



galOfMilk = 100.0;



galOfMilk = galOfMilk / 2.0;



3. What is the result of the following Java operations:

7 / 5

7.0 / 5.0

7 % 5

7.0 % 5.0

7 % -5