CS 1401, Quiz #2

Date: Monday, September 10, 2007
Class section (9:30 am or 11:30 am): _______________________________

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.

September10

10September

September 10

September_10

priceInUS$

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

double priceInDollars;



priceInDollars = 3.0;



priceInDollars = priceInDollars * 0.5;



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

1 / 2

1.0 / 2.0

1 % 2

1.0 % 2.0

-1 % -2