• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

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

  • (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)

Class Q subclass of P
    void f(int 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

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.
  • Neither I nor II is correct.
  • Both I and II are correct.
  • Only II is correct.
  • Only I 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.
  • Both the statements (a) and (b) are correct.
  • Neither of the statements (a) and (b) are correct
  • Statement (a) is correct and (b) is incorrect
  • Statement (a) is incorrect and (b) 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:
  • (a), (b) and (c)
  • (b), (c) and (d)
  • (a), (d) and (e)
  • (c), (d) and (e)

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.

Last Updated :
Take a part in the ongoing discussion