Page 479 - Computer science 868 Class 12
P. 479

ob.addangle();
                             ob.show();
                          }
                       }















                      Unsolved Questions



                 A.  Tick ( ) the correct option:
                    1.  What is a subclass in Java?
                       a.  A class that extends another class          b.  A class that is declared inside a class
                       c.  Abstract class                              d.  Base class
                    2.  If class B is a subclass of class A, then which of the following is the correct syntax?
                       a.  class B : A                                 b.  class B extends A
                       c.  class A extends  B                          d.  class B implements A
                    3.  Access modifier used to define inheritance is
                       a.  public                                      b.  private
                       c.  default                                     d.  protected
                    4.  Java inheritance is used
                       a.  for code re-usability                       b.  to achieve runtime polymorphism
                       c.  Both a and b                                d.  None of these
                    5.  Which of these is the correct way to call a constructor (having no parameters) of superclass A by subclass B?
                       a.  super( );                                   b.  super(void);
                       c.  super.A                                     d.  super.A(B);
                    6.  What type of variable can be defined in an interface?
                       a.  public static                               b.  private final
                       c.  public final                                d.  public static final
                    7.  By default, what type of methods an interface can contain?
                       a.  abstract                                    b.  static
                       c.  final                                       d.  private
                    8.  What will happen if we provide concrete implementation of method in an interface?
                       a.  Method produces correct output              b.  Runtime exception is thrown
                       c.  Compilation failure                         d.  Method not found exception is thrown
                    9.  What is the process of defining more than one method in a class differentiated by method signature?
                       a.  Function overriding                         b.  Function overloading
                       c.  Function doubling                           d.  None of these
                   10.  Which of the following keyword can be used in a subclass to call the constructor of superclass?
                       a.  super                                       b.  this
                       c.  extent                                      d.  extends


                 B.  Fil in the blanks:
                    1.  The ………………… keyword in Java indicates that the derived class inherits the properties of the base class.
                    2.  ………………… does not support multiple inheritance.



                                                                                                                       477
                                                                                  Inheritance, Interfaces and Polymorphism  477
   474   475   476   477   478   479   480   481   482   483   484