Tuesday, January 26, 2010

III. Each Question Carries 4 Mark.
1) i) An anonymous inner class does not have constructors because the name of the constructor must be the same as the
name of class, and class has no name.
ii) The construction parameters are given to the super class constructor.
iii) You should use only inner, anonymous classes where event handler is there.
a) Only i b) only ii, iii c) i, ii, iii d) None





2) i) Multiple inheritance makes compilers either very complex or very inefficient
ii) With multiple inheritances there are name clashes in the base classes.
iii) Interfaces avoid this kind of multiple inheritance problems.
a) Only i b) Only ii, iii c) i, ii, iii d) None

3) i) Interface is nothing but abstract method definitions; you then have to implement those in methods in your own classes.
ii) Using the same method signatures in derived class from the base.
iii) A class can legally can implement an interface
a) Only i b) Only ii, iii c) i, ii, iii d) None

4) i) interfaces are saying “ you need to plug some code in here for this thing to work fully”
ii) The interface specifies the exact signatures of the methods that must be provided
iii) we can use interface type as parameter
a) Only i b) Only ii, iii c) i, ii, iii d) None

5) i) An abstract class is an incomplete class that requires further specialization
ii)An interface is just a specification or prescription for behavior.
iii)an interface does not have any overtones of specialization that are present with inheritance.
a) Only i b) Only ii, iii c) i, ii, iii d) None

6) I) A class can implement several interfaces at once, where a class cans extent only one parent class
ii) interfaces can be used to support call backs.
iii) It essentially provides a pointer to functions
a) Only i b) Only ii, iii c) i, ii, iii d) None

7) i) Use interface when you just want say, “ I need to be able to call methods with these signatures
ii) Interfaces can also import other interfaces and classes from other packages.
iii) The interface hierarchy has no equivalent of the Object class.
a) Only i b) Only ii, iii c) i, ii, iii d) None

8) i) inner class result from the combination of block structure with class based programming.
ii) You would typically uses a nested top-level class when you have a significant data structure strongly.
iii) Nested top level class provides a package like organization for a logically related to group of secondary top-level class.
a) Only i b) Only ii, iii c) i, ii, iii d) None

9) i).Inner class can reference any member in its parent
ii). The parent must be declare an instance of an inner class
iii) The this key words corresponds to inner class data & methods
a) Only i b) Only ii, iii c) i, ii, iii d) None

10) i) “this “ it refers current class variables
ii) “this$0” referees outer class variables
iii) An anonymous class is refinement of inner class.
a) Only i b) Only ii, iii c) i, ii, iii d) None


III. Answer – 4 Mark.


1.C 2.C 3.C 4.C 5.C 6.C 7.C
8.C 9. C 10. C