CIS2168 TEN MINUTE TEST # 8 November 2, 2010 (3) 1. In the Java event model a listener is registered to: (a) the event source (b) the event object (c) the JVM (d) the main loop (3) 2. In Java, in order to be an ActionListener, a class must (a) Be inherited from a java.awt or javax.swing class (b) Implement the class "ActionListener" (c) Be registered to a source that is able to fire an ActionEvent (4) 3. Suppose 'myMethod' is an abstract method of the abstract class A. AE is an abstract class that extends A. (a) AE must implement 'myMethod' (b) AE must not implement 'myMethod' since AE is abstract (c) AE might or might not implement 'myMethod', it does not matter (5) 4. Which is correct (a) Abstract classes may not contain non-abstract methods (b) Abstract classes may not contain constructors (c) An abstract class may implement an interface (d) An interface may contain constructors (10) 5. Write the recursive method public static int sumOdd(int n) which, given an odd positive number n, returns 1+3+5+7+ .. + n (10) 5. We are given a perfect tree of height n (a) How many nodes will be in this tree? (b) How many leaves will be in this tree?