Sample exam.
It will cover chapters 1, 2 (sec 2.1-2.15) and section 3.3.3 on the for loop in the Liang text. Also, sec 1 - 8 excluding the part on control characters in sec 7 of my "preliminary notes" that's posted on the web


1. (25 points.) Write a program that reads digits from the keyboard using JOptionPane.showInputDialog. Thus you should read the digits as characters. Convert each digit to the letter of the alphabet whose position is given by the digit, where 0 corresponds to the letter 'a'. Thus if the length is 3, and the input is 024, the output will be ace.

2. (25 points.) Write a program that gives you the character for a given ASCII code read as input. Thus an input of 48 would give you '0'.

3. (10 points) In the following, state the type and value of each of the following expressions. If the expression contains an error, write invalid as the type and omit the value.

     EXPRESSION                    TYPE           VALUE

200 / 60                          __________     __________

2 * 1 * 3 % 5 / 2 - 5 % 3        __________     __________

(5 + 4.0) / 3 * 2 + 5 / 5        __________     __________

4. (5 points) Given
		int silly;

Which of the following causes a number to be placed in silly. (circle one)
a) System.out.println ( silly	) ;
b)  silly = JOptionPane.showInputDialog("Type your number") ;
c) System.out.println ( "silly"	) ;
d)  "silly" = JOptionPane.showInputDialog("Type your number") ;
e) silly = Integer.parseInt("123");


5. (5 points) Given:
_______answer1, answer2;

 ________ = JOptionPane.showInputDialog("Type your first number") ;
 ________ = JOptionPane.showInputDialog("Type your second number") ;



Fill in the blanks so that no errors occur.
6. (15 points) How many times would the for loops beginning with the following statements be executed? If there is a compilation error, type INVALID
          _____   a.  for(int j = 6; j > 51; j--)
          _____   b.  for(int j = 10; j > 7; j--)
          _____   c.  for(int j = 10; j > 7; j--)
          _____   d.  for(char ch = '1'; ch < 7; j++)
          _____   e.  for(int j = -3; j <= 1; j++)