Computer Knowledge

Object-Oriented Programming

2,686 Questions

Object-oriented programming questions test core computer science concepts like classes, inheritance, polymorphism, and encapsulation. The focus includes Java program structures, method overloading, and memory allocation for objects. This topic is essential for technical sections in various recruitment tests.

Java class definitionsMethod overriding rulesPolymorphism conceptsGeneric type parametersMemory allocation in objects

Object-Oriented Programming Questions

Multiple choice
  1. Standard Library(SL)

  2. Standard Template Library(STL)

  3. Standard Class Library(SCL)

  4. Standard Class and template Library(SCTL)

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In C++, Standard Template Library(STL) contains the collection of templatised classes and functions. 

Multiple choice
  1. process to derive a class from Base class

  2. a way in which entity behaves in several forms

  3. process to hide complexity of a program

  4. none of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Polymorphism means 'many forms'. In OOP, it allows objects of different classes to be treated as objects of a common superclass, with each class implementing the same method differently. This is achieved through virtual functions, function overloading, and operator overloading in C++.

Multiple choice
  1. functions

  2. variables

  3. classes

  4. overloading

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Object-oriented programming is based on the concept of 'objects' which encapsulate data and behavior. Classes are the blueprints/templates for creating objects. While functions and variables exist in procedural programming, and overloading is a feature, classes are the essential foundation that defines a language as object-oriented.

Multiple choice
  1. For data hiding

  2. For declaring classes

  3. For memory management

  4. For binding the data with functions

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Abstraction hides complex implementation details while exposing only necessary interfaces. This allows developers to work with high-level concepts without understanding underlying complexities, reducing code coupling.

Multiple choice
  1. It adds graphics to the computer.

  2. It binds data and functions.

  3. It helps to secure the data.

  4. It leads to the code reusability.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Inheritance allows new classes to acquire properties and methods from existing classes, promoting code reuse. This hierarchical relationship reduces redundancy and enables polymorphic behavior through shared interfaces.

Multiple choice
  1. run time entity

  2. instance of a class

  3. combination of data and functions

  4. all of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Objects embody three fundamental characteristics: they exist at runtime (not compile time), are instantiations of class blueprints, and encapsulate both state (data) and behavior (methods) into a single unit.

Multiple choice
  1. hiding of data

  2. binding of data with its methods

  3. using the features of one class in other classes

  4. using a function in different ways

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Polymorphism allows a single interface to represent different underlying forms. A function can behave differently based on the object type it operates on, enabling flexible and extensible code through method overriding and overloading.