CIT 591 Second Quiz
Fall 2001, Dave Matuszek
Name __________________________________________
  1. Assume that i is an int variable and d is a double variable. Answer each of the following eight questions with YES or NO.
      Is this a syntax error? Could this cause a runtime error?
    i = 3.5 * d;    
    d = 3.5 * i;    
    i = (int) (3.5 * d);    
    d = (double)(3.5 * i);    

  2. For each of the following numbers, tell whether it is octal, decimal, or hex.
    0x77 0

  3. Consider the following program:
    class Test {   
        public static void main(String args[]) {
            int foo = 5;
        static void foo(int bar) {
    1. What is the name of the actual parameter to method foo?

    2. What is the name of the formal parameter to method foo?

    3. In main, what kind of variable is foo? (Besides int!)

    4. What two values does this print? (Write them in the correct order.)

    5. What would happen in the above program if method foo were not declared static?

    6. Both the method and the variable can be named foo because these names are kept in different _____________________.
  4. Short answer:
    1. What is a glyph?

    2. System.out.print will print any object, but the result may not be useful. What method must you define in order to control how an object is printed?