1. An interface can best be described as A) a superclass B) a description of methods that must be implemented in order to be considered an implementation of the interface C) a description of variables that must be implemented in order to be considered an implementation D) something that is beyond all human description E) none of the above

  2. What keyword must be included on a class definition in order to specify that a class is an implementation of a specific interface A) extends B) interfaced C) double D) implements E) none of the above

  3. What operator in Java returns a boolean value specifying if an object happens to be an instance of a particular class? A) typeof B) == C) instanceof D) sizeof E) none of the above

  4. What are allowed in an interface declaration A) method implementations B) any variables and variable declarations C) constants D) A and C E) none of the listed

  5. An abstract class A) is indistinguishable from an interface in all cases B) requires all methods include the keyword abstract in their declarations C) is a class that can have both methods defined, and methods demanded of subclasses D) is much like a Picasso painting (you know, abstract) E) none of the above even remotely is true

  6. The wrapper class for doubles is called A) wrapDouble B) Double C) numeric D) Integer E) none of the above

  7. If a class is directly extending an abstract class A) it cannot include any method implementations B) it cannot declare any variables C) it must implement any methods declared abstract in the class that it is extending D) it must not implement any methods declared abstract in the abstract class it is extending E) none of the above


For the following questions write on your answer sheet T if the statement is true, F otherwise


  1. The wrapper class for an int is called Int

  2. One cannot actually create objects that are of type Comparable (or any other interface), though one can create objects that implement the Comparable interface

  3. The Comparable interface requires classes that implement it provide a method named compareTo

  4. If you wish to have some methods implemented in a superclass, but require subclasses to implement other methods, according to Java's specifications you must declare the class as confusing in the class declaration.

  5. In order to get an int value out of an Integer object one can use the intValue method built into the Integer class.

  6. The String class implements Comparable

  7. You can cast an object that implements an interface to a reference of the type of that interface.

  8. You can include a few complete (ie: written up as code) methods inside of an interface.

  9. Facts are meaningless. You could use facts to prove anything that's even remotely true!“

  10. Define an interface called Math that requires all classes that implement it to define a void method called setx that takes a parameter and sets an internal instance int variable called x, a void sety method that takes a parameter and sets an internal instance int variable called y.  It should also require a method called sum that returns an int. Obviously it should also include instance variable declarations for x and y. Worth 2.5 points

  11. Implement the interface from problem 17. In the case of sum, the result should be x and y summed together. Worth 2.5 points