CSC 8310 Java Quiz
Villanova University, Spring 2001
David Matuszek
     Section 1

      Name ____________________________________________

 

True or False questions -- 3 points each
Answer each question with T or F

  1. _____ Every Java application must have a public final void main(String args[]) method.

  2. _____ You may only have one (external) Java class per file.

  3. _____ A class inherits all the fields, methods, and constructors of its superclass.

  4. _____ All the functions defined by an interface declaration are public.

  5. _____ You must import java.io.*; in order to use System.out.println().

  6. _____ Java syntax requires class names to begin with a capital letter.

  7. _____ In Java, the length of an array is not part of its type.

  8. _____ An Exception is just another kind of object, with fields and methods.

  9. _____ You cannot subclass (extend) Event.

  10. _____ A try statement always has at least one catch clause.

  11. _____ An Applet is a kind of Panel.

  12. _____ The AWT uses the GUI components provided by the operating system, but Swing does not.

  13. _____ Each kind of Component sends its own unique kind of Event.

  14. _____ Every class, even an anonymous one, compiles to a separate .class file.

  15. _____ If Poodle is a subclass of Dog, you can assign a value of type Dog to a variable of type Poodle, but only if you cast it to type Poodle.

  16. _____ If you define a method with the same name as that of an inherited method, it overrides the inherited method.

  17. _____ The result of the expression  1 + 2 + "3"  is the String  "123".

  18. _____ You can use a static field of a class even if you don't have an object of that class.

  19. _____ If jack and john are objects of the same type, then (jack==john) tests whether jack and john have equal values in all fields.

  20. _____ You must supply a run() method for every Thread that you create.

 

 

Short answer questions -- 5 points each
Fill in the blanks.

  1. In a catch clause, you should print out debugging information. Even if you do nothing else, you should at least call the method named ____________________ .

  2. When writing an Applet, you should never call the paint method; call ____________________ instead.

  3. You don't need a browser in order to use an Applet; you can use the standalone program ____________________.

  4. To arrange Components in a GUI, you use a ____________________.

  5. MVC stands for ______________________________.

  6. A class used to create an object from a primitive, so that the primitive can be used where an object is required, is called a(n) ____________________ class.

  7. You can cause the current Thread to stop doing anything for five seconds by writing the statement ____________________.

  8. A class that implements an interface, but with empty method bodies, is called a(n) ____________________ class.