Monday 19 March 2012

Internet, Web Programming and Java MCQ 09


  1. Inheritance allows code___________

    1. Reusability
    2. Reliability
    3. Usefulness
    4. Correctness

  1. The class that is inherited by the other class is called__________

    1. Superclass
    2. Subclass
    3. Childclass
    4. None of these

  1. A java subclass can be defined by using the __________ keyword:

    1. Public
    2. Private
    3. Extends
    4. None of these

  1. which inheritance java does not support:

    1. single
    2. multiple
    3. multilevel
    4. none of these

  1. In which of the following inheritance a Superclass is inherited by more than one subclass

    1. Single inheritance
    2. Multiple inheritance
    3. Hierarchical inheritance
    4. Multilevel inheritance        

  1. A member declared as _____can be accessed only within the class :

    1. Public
    2. Private
    3. Protected
    4. None of these

  1. The super class constructor can be called within the subclass constructor by using ______ keyword

    1. super
    2. sub
    3. both a & b
    4. none of these


  1. Which keyword prevents a method in superclass from being overridden by its subclass :

    1. Final
    2. Method
    3. Class
    4. None of these

  1. Which of the following class cannot be inherited:

    1. Abstract class A
{  
:
}
    1. class B
{
:
}
    1. final class C
{
:
}
    1. none of these

  1. The syntax to define a subclass is:

    1. Class sub-class extends super_class
    2. Class subclass extends Superclass
    3. Class sub_class extends Superclass
    4. None of these


  1. Inheritance can be divided into ________ types

    1.  3
    2. 4
    3. 5
    4. none of these

    1.  
  1. Inheritance saves time as well as increase the ______

    1. Robustness
    2. Reliability
    3. Usefulness
    4. None of these

  1.  The name of the superclass is specified in the________ definition:

    1. subclass
    2. Parentclass
    3. baseclass
    4. none of these

  1. Variable declared as ________ cannot be modified

    1. Private
    2. Public
    3. Final
    4. None of these

    1.  
  1. Visibility controls also known as :

    1. Access
    2. Modifier
    3. Access modifier
    4. None of these

  1. Superclass in also known as:

    1. parent class
    2. base class
    3. both a & b
    4. none of these

  1. Subclass is also known as

    1. Child class
    2. Derived class
    3. Both a& b
    4. None of these

  1. How many types of visibility controls in java:

    1. 2
    2. 3
    3. 4
    4. 6

  1. Name of the visibility controls:

    1. public
    2. private
    3. protected
    4. All of these

  1. One class is inherited from other class which in inherited from  some other class:

    1. Multilevel
    2. Multiple
    3. Single
    4. None of these

    1.  
  1. A class inherits properties from more than one Superclass is called_________

    1. Multiple
    2. Multilevel
    3. Single
    4. Hierarchical

  1. Which keyword allow overridden in the subclass

    1. Abstract
    2. Final
    3. Class
    4. None of these

  1. _______ is the process of creating the logical relationship b\w two or more class:

    1. Single inheritance
    2. Inheritance
    3. Multiple inheritance
    4. None of these


  1. Abstract methods must end with semicolon because they _______

    1. Do not have any functionality
    2. Have any functionality
    3. Do not have any methods
    4. None of these

  1. Constructors or static methods__________ be declared as abstract:

    1. cannot
    2. can
    3. either be
    4. none of these

  1. The syntax for declaring an abstract method is:
    1. Abstract data _type method_name();
    2. Abstract data type method_name();
    3. Abstract data_type method_name():
    4. Abstract data_type method name();
  2. A class which cannot be further inherited or cannot have any subclass is known as____________

    1. Final method
    2. Final class
    3. Final variables
    4. None of these

  1. The super class provided a_________ structure of the method;

    1. generalized
    2. logical
    3. both a& b
    4. none of these

  1. To make abstract class which keyword is used

    1. Final
    2. Visibility
    3. Abstract
    4. None of these

  1. Which method is used in abstract class:

    1. defined
    2. undefined
    3. both a& b
    4. none of these

  1. If a class is declared as final all of its method are automatically declared as__________:

    1. Final
    2. Method
    3. Class
    4. None of these


  1. The syntax for declaring a final class is:
    1. Final class class_name
{
 :
 }
    1. final class class name
      {
       :
       }
c.    Final class class name
      {
       ;
       }
d.    Final class class_name
{
 ;
 }
  1. _________ is define in the subclass with the name and same signature as in the Superclass:

    1. Final class
    2. Final method
    3. Final variable
    4. None of these 

    1.  
  1. Final variable is a __________:

    1. Zero
    2. Constant
    3. One
    4. None of these

  1. Super keyword should be the first statement to be executed_______ the subclass constructor:

    1. Outside
    2. Inside
    3. Both a & b
    4. None of these

  1. The syntax for declaring a final method is:
    1. Final data _type method_name()
{   :    }
                  b   final data type method name()
                       {    :    }
                  c   Final data _type method name ()
                       {    :     }
                 d    Final data type method name()
                        {   :     }
  1. The syntax  for declaring a final variable:
    1. Final data _type variable_name=constant_value;
    2. Final data type variable_name=constant_value;
    3. Final data _type variable_name=constant value;
    4. Final data _type variable name=constant_value;
  2. The syntax for using super keyword is:

    1. Super (parameter_ list);
    2. Super (parameter list);
    3. Super (“parameter_ list”);
    4. Super (‘parameter_ list’);

  1. Visible only in the subclass irrespective of packages use__________:

    1. Public, Protected
    2. Public, private
    3. Private, Protected
    4. None of these

  1. Visible everywhere in the program use _______ visibility control:

    1. Protected
    2. Public
    3. Private
    4. None of these

  1. Invisible everywhere except within the same class use ________ visibility control:

    1. Private
    2. Public
    3. Protected
    4. None of these

  1. Visible everywhere in the same package and subclass in other package use
    _________ visibility control:

    1. Private
    2. Public
    3. Protected
    4. None of these

  1. Default which is not a ________:

    1. Public
    2. Private
    3. Protected
    4. All of these

  1. In java it is not possible is to implement ­­­­­­­­­­­­­­­­­­­­­­­­­­_________ inheritance directly:

    1. Single
    2. Multiple
    3. Multilevel
    4. Hierarchical


  1.  Multilevel inheritance comprises ________ level

    1. One
    2.  Two
    3. Two or more
    4. None of these

  1. The subclass has all the properties of its direct super class as well as its indirect super class known as the
    1. Transitive nature of single inheritance
    2. Transitive nature of multiple inheritance
    3. Transitive nature of multilevel inheritance
    4. Transitive nature of hierarchical inheritance
  2. The syntax to implement multilevel inheritance is
    1. Class class1
{
 :
 }
class class2 extends class1
{
 :
 }
class class3 extends class2
{
:
}
    1.   Class class1
{
 :
 }
class class2 extends class1
{
 :
 }
class class3 extends class1
{
:
}
c.    Class class1
{
 :
 }
class class2 extends class1
{
 :
 }
class class3 extends class2
{
;
}

                  d.   None of these
  1. ____________ is the name of subclass that inherits  the super class

    1. Subclass
    2. Super class
    3. Inheritance
    4. None of these

No comments :

Post a Comment