OOP Concepts

Question 1

Which one of the following are essential features of an object-oriented programming language? (GATE CS 2005) (i) Abstraction and encapsulation (ii) Strictly-typedness (iii) Type-safe property coupled with sub-type rule (iv) Polymorphism in the presence of inheritance

Cross

(i) and (ii) only

Tick

(i) and (iv) only

Cross

(i), (ii) and (iv) only

Cross

(i), (iii) and (iv) only



Question 1-Explanation: 

Abstraction, Encapsulation, Polymorphism and Inheritance are the essential features of a OOP Language.

Question 2

Which of the following language supports polymorphism but not the classes?

Cross

Java

Cross

C++

Tick

Ada

Cross

C#



Question 2-Explanation: 

Java, C++ and C# supports classes.

Question 3
Consider the following class definitions in a hypothetical Object Oriented language that supports inheritance and uses dynamic binding. The language should not be assumed to be either Java or C++, though the syntax is similar.
Class P
{
    void f(int i)
    {
        print(i);
    }
}

Class Q subclass of P
{
    void f(int i)
    {
        print(2*i);
    }
}
Now consider the following program fragment:
P x = new Q();
Q y = new Q();
P z = new Q();
x.f(1); ((P)y).f(1); z.f(1); 
Here ((P)y) denotes a typecast of y to P. The output produced by executing the above program fragment will be
Cross
1 2 1
Cross
2 1 1
Cross
2 1 2
Tick
2 2 2


Question 3-Explanation: 
Since the question itself tells us that the language uses dynamic binding therefore all the function calls should be considered only on the basic of type of object stored.
Question 4

Which feature of OOP indicates code reusability?

Cross

Abstraction

Cross

Polymorphism
 

Cross

Encapsulation
 

Tick

Inheritance



Question 4-Explanation: 

Inheritance indicates the code reusability. Encapsulation and abstraction are meant to hide/group data into one element. Polymorphism is to indicate different tasks performed by a single entity.

Question 5

Which one of the following are essential features of object oriented language? A. Abstraction and encapsulation B. Strictly-typed C. Type-safe property coupled with sub-type rule D. Polymorphism in the presence of inheritance

Cross

A and B only

Cross

A, D and B only

Tick

A and D only

Cross

A, C and D only



Question 5-Explanation: 

Option (C) is correct.

Question 6
Which of the following is associated with objects?
Cross
State
Cross
Behaviour
Cross
Identity
Tick
All of the above


Question 7
Abstraction and encapsulation are fundamental principles that underlie the object oriented approach to software development. What can you say about the following two statements ? I. Abstraction allows us to focus on what something does without considering the complexities of how it works. II. Encapsulation allows us to consider complex ideas while ignoring irrelevant detail that would confuse us.
Tick
Neither I nor II is correct.
Cross
Both I and II are correct.
Cross
Only II is correct.
Cross
Only I is correct.


Question 7-Explanation: 
Encapsulation allows us to focus on what something does without considering the complexities of how it works. Abstraction allows us to consider complex ideas while ignoring irrelevant detail that would confuse us. So, option (A) is correct.
Question 8
Consider the following two statements: (a)A publicly derived class is a subtype of its base class. (b)Inheritance provides for code reuse.
Tick
Both the statements (a) and (b) are correct.
Cross
Neither of the statements (a) and (b) are correct
Cross
Statement (a) is correct and (b) is incorrect
Cross
Statement (a) is incorrect and (b) is correct.


Question 8-Explanation: 
  • A publicly derived class is a subtype of its base class.
  • Inheritance provides for code reuse.
So, option (A) is correct.
Question 9
Which of the following statements regarding the features of the object-oriented approach to databases are true? (a)The ability to develop more realistic models of the real world. (b)The ability to represent the world in a non-geometric way. (c)The ability to develop databases using natural language approaches. (d)The need to split objects into their component parts. (e)The ability to develop database models based on location rather than state and behaviour. Codes:
Tick
(a), (b) and (c)
Cross
(b), (c) and (d)
Cross
(a), (d) and (e)
Cross
(c), (d) and (e)


Question 9-Explanation: 
Features of the object-oriented approach to databases: The ability to develop more realistic models of the real world. The ability to represent the world in a non-geometric way. The ability to develop databases using natural language approaches. So, option (A) is correct.
Question 10
The feature in object-oriented programming that allows the same operation to be carried out differently, depending on the object, is:
Cross
Inheritance
Tick
Polymorphism
Cross
Overfunctioning
Cross
Overriding


There are 12 questions to complete.

  • Last Updated : 11 Sep, 2014

Share your thoughts in the comments
Similar Reads