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

      Name ____________________________________________

 

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

  1. _____ Only one class in a program may have a main method.

  2. _____ Every class, except Object, extends some other class.

  3. _____ An interface defines a list of functions to be implemented.

  4. _____ Every Applet must extend the Applet class defined in java.applet.*

  5. _____ To make a Java object printable, you must override public void toString().

  6. _____ Objects are created with the new keyword.

  7. _____ The try statement is used to deal with Exceptions.

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

  9. _____ You cannot subclass (extend) Exception.

  10. _____ In Java, primitives are passed by value, but objects are passed by reference.

  11. _____ An Applet is a kind of Container.

  12. _____ If you don't define a constructor for a class, Java will automatically provide one.

  13. _____ A class that partially implements an interface is an "abstract" class.

  14. _____ Declaring an object in Java automatically creates space for it.

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

  16. _____ To override an inherited method, you must define a new method with the same name, same number of arguments, same types of arguments, and same return type.

  17. _____ The test  ("ABCD"=="AB"+"CD") gives the boolean result false.

  18. _____ "cat".equals(word) is sometimes preferable to  word.equals("cat").

  19. _____ Every Thread has a start() method.

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

 

 

 

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

  1. In an Applet, the method responsible for drawing things on the screen is the ____________________ method.

  2. One method that is inherited by every object is the ____________________ method.

  3. To associate an action with a Component, you must attach a(n) ____________________ to the Component.

  4. You can add at most five Components to a(n) ____________________.

  5. CRC stands for ______________________________.

  6. If you are doing a lot of string manipulation, it is more efficient to use the class ____________________ than the class String.

  7. A method whose use is discouraged (because it has been replaced by a newer, better method) is called a ____________________ method.

  8. If you need another thread, but you don't want to extend the Thread class, you can instead implement the ____________________ interface.