CIT 591 Fifth Quiz
Fall 2001, Dave Matuszek
Name __________________________________
  1. The connection between your program and a source of data is called a ________________ .

  2. Before you use a file, you must ______________ it; when you are done, you must _______________ it.

  3. Forcing the contents of a buffer to be written to an output file immediately is called _______________ the buffer.

  4. If vec is a Vector containing only Strings, and str is a String,
    1. Write a statement to put str into the Vector:

    2. Write a statement to set str to the String at location 2 in the Vector:

  5. What is the immediate superclass of Exception?

  6. What subclass of Exception represents exceptions that do not need to be caught?

  7. Write the shortest possible statement that does the same thing as  s = new Integer(n).toString();

  8. To comment out a block of code,
    1. What kind of comments are recommended by the Style book?

    2. What kind of comments does the BlueJ Comment command use?

  9. The instructor covered three good uses for end-line comments; tell one of them.

  10. Under what circumstances will the test str.equals("XYZ") give a different result from "XYZ".equals(str) ?

  11. Why is p.add(okButton, BorderLayout.NORTH); better than p.add(okButton, "North"); ? (Both are legal.)

  12. In the test x instanceof y, what kind of operand would you use for y?

  13. Write a statement that puts the char ch into the Vector charVec.

  14. How do you prevent a method from being overridden in a subclass?

  15. If an exception occurs in your program, what method call can you put in a catch clause to print out where you were when the error occurred?

  16. Name two subclasses of TextComponent.