CIT 591 Fourth Quiz
Fall 2001, Dave Matuszek
Name __________________________________________
  1. Arrays:
    1. Declare, but do not define, an array of 15 integers.
                int[ ] myArray;     or     int myArray[ ];

    2. Define the array you declared in the previous part.
                myArray = new int[15];

    3. Write a single for loop to fill each location in the above array with its index; that is, put 0 in array location 0, put 1 in array location 1, put 2 in array location 2, and so on.
                for (int i = 0; i < 15; i++)
                     myArray[i] = i;


    4. Declare and define, in a single statement, an array of 100 Strings.
                String[ ] myStrings = new String[100];     or     String myStrings[ ] = new String[100];

  2. Name (don't describe) the two kinds of inner classes that your instructor considers useful.
              Member classes, anonymous classes

  3. What does Java put in a sandbox?     Applets

  4. For what audience should javadoc comments be written? (Circle one)
         a. Someone who needs to maintain your code
         b. Someone who needs to use your code in her own program
         c. Someone who wants to use a program that was built with your code
         d. Someone who decides whether to purchase a program that was built with your code

  5. What are the three symbols you can't you use in a Javadoc comment?
              <     >     &

  6. Where would you write a summary description for a method?
              As the first sentence of a javadoc comment for that method.

  7. What Applet method is it that you might override but you should never call?
              public void paint(Graphics g)

  8. When you change the Components in a GUI, what method must you call to tell Java that the GUI must be redrawn?
              public void validate( )
  9. If max is an int, and s is a String, write a Java statement that assigns the String representation of max to s.
              s = max + "";          s = Integer.toString(max);          s = new Integer(n).toString();
              s = "" + max;          s = String.valueOf(max);

  10. What are the two main parts of an HTML page?
              head, body

  11. Using the algorithm in the current assignment,
    draw a 3 by 3 magic square.
     8   1   6 
     3   5   7 
     4   9   2