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
(i) and (ii) only
(i) and (iv) only
(i), (ii) and (iv) only
(i), (iii) and (iv) only
Question 2
Which of the following language supports polymorphism but not the classes?
Java
C++
Ada
C#
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
1 2 1
2 1 1
2 1 2
2 2 2
Question 4
Which feature of OOP indicates code reusability?
Abstraction
Polymorphism
Encapsulation
Inheritance
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
A and B only
A, D and B only
A and D only
A, C and D only
Question 6
Which of the following is associated with objects?
State
Behaviour
Identity
All of the above
Question 7
Question 8
Question 9
Question 10
The feature in object-oriented programming that allows the same operation to be carried out differently, depending on the object, is:
Inheritance
Polymorphism
Overfunctioning
Overriding
There are 12 questions to complete.