Java Programming OOP Questions and Answers Set 7

Java Programming OOPs

Questions 61 to 70



61.
A process that involves recognizing and focusing on the important characteristics of a situation or object is known as:
(a)   Encapsulation                                            (b)  Polymorphism
(c)   Abstraction                                                (d)  Inheritance
(e)   Object persistence.
62.
Which statement is true regarding an object?
(a)   An object is what classes instantiated are from
(b)   An object is an instance of a class
(c)   An object is a variable
(d)   An object is a reference to an attribute
(e)   An  object is not an instance of a class.
63.
In object oriented programming, composition relates to
(a)   The use of consistent coding conventions
(b)   The organization of components interacting to achieve a coherent, common behavior
(c)   The use of inheritance to achieve polymorphic behavior
(d)   The organization of components interacting not to achieve a coherent common behavior
(e)   The use of data hiding to achieve polymorphic behavior.
64.
In object oriented programming new classes can be defined by extending existing classes.    This is an example of:
(a)   Encapsulation                                 (b)  Interface
(c)   Composition                                   (d)  Inheritance            (e)  Aggregation.
65.
Which of the following does not belong: If a class inherits from some other  class, it should

(a)   Make use of the parent class's capabilities
(b)   Over-ride or add the minimum to accomplish the derived class' purpose
(c)   Over-ride all the methods of its parent class
(d)   Make sure the result "IS-A-KIND-OF" its base class
(e)   Make sure the result “contains” its base class.
66.
Object oriented inheritance models the
(a)   "is a kind of" relationship
(b)   "has a" relationship
(c)   "want to be" relationship
(d)   inheritance does not describe any kind of relationship between classes
(e)   “contains” of relationship.
67.
The wrapping up of data and functions into a single unit is called
(a)   Encapsulation                                 (b)  Abstraction
(c)   Data Hiding                                     (d)  Polymorphism                        (e) Message passing.
68.
Polymorphism
(a)   Is not supported by Java
(b)   Refers to the ability of two or more objects belonging to different classes to respond to exactly the same message in different class-specific ways
(c)   Simplifies code maintenance
(d)   Not simplifies code manintenance
(e)   Refers to the ability of two or more objects belonging to different classes to respond to exactly the same message in different class –specific ways and simplifies code maintenance.
69.
In object oriented programming new classes can be defined by extending existing classes.     This is an example of:
(a)   Encapsulation                                 (b) Interface             (c) Composition
(d)   Inheritance                                      (e) Aggregation.
70.
Given a class named student, which of the following is a valid constructor declaration for the class?
(a)   Student (student s)  {  }                    (b) Student student ( ) {  }
(c)   Private final student ( ) {  }                (d) Void student (  )  {   }
(e)   Static void student(){ }.


Answers


61.
Answer : (c)
Reason : The insulation of data from direct access by the program is called as the data abstraction.Data abstraction also called as data hiding, is the mechanism where by the code and the data it manipulates are wrapped into a single unit.
62.
Answer : (b)
Reason : An object is an instance of a class. Objects are created from class definitions that implement abstractions.
63.
Answer : (b)
Reason : Composition is about an object that is made up of other objects, referred as "containment. Composition implies that the life cycles are more strongly linked, that means Whole is responsible for the life time of Part.
64.
Answer : (d)
Reason : Inheritance is a mechanism that enables one class to inherit all of the behaviour (methods ) and attributes (instance variables) of another class. A class that inherits from another class is called a subclass and the class that gives the inheritance is called a superclass.
65.
Answer : (c)
Reason : In a class hierarchy, when a method in a subclass has the same method signature as that of the superclass, then the method in the subclass is said to “override” the method in superclass. When an overridden method exists in the subclass, the subclass objects always refer its own. The subclass overridden method hides ( or blocks ) that of the superclass method.
66.
Answer : (a)
Reason : As it models generalization relationship it takes “is a kind of “keyword.
67.
Answer : (a)
Reason : Data encapsulation is the method of wrapping up of data and functions into a single unit.
68.
Answer : (e)
Reason : As Polymorphism refers to the ability of two or more objects belonging to different classes to respond to exactly the same message in different class-specific ways. It also simplifies code manintenance.
69.
Answer : (d)
Reason : As inheritance is nothing but extending existing classes whereas the others are  for different purpose.
70.
Answer : (a)
Reason : A constructor cannot specify any return type, not even void. A  constructor cannot be final, static or abstract.


<< Prev   1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22  

 23   24   25   26   27   28   29   30  Next >>


No comments :

What you think about these Questions and Answers ? Let me know in comments.

Post a Comment