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

What is the process of binding a method call to a specific object called?

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Dynamic binding

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

Dynamic binding is the process of binding a method call to a specific object at runtime.

Multiple choice

Which of the following is NOT a type of inheritance in OOP?

  1. Single inheritance

  2. Multiple inheritance

  3. Hierarchical inheritance

  4. Interface inheritance

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

Interface inheritance is not a type of inheritance in OOP. The types of inheritance in OOP are single inheritance, multiple inheritance, and hierarchical inheritance.

Multiple choice

What is the ability of a class to inherit the properties and methods of another class called?

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

Inheritance is the ability of a class to inherit the properties and methods of another class.

Multiple choice

Which of the following is NOT a benefit of using OOP?

  1. Reusability

  2. Maintainability

  3. Extensibility

  4. Complexity

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

Complexity is not a benefit of using OOP. The benefits of using OOP include reusability, maintainability, and extensibility.

Multiple choice

What is the process of hiding the implementation details of an object from the user called?

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

Encapsulation is the process of hiding the implementation details of an object from the user.

Multiple choice

Which of the following is NOT a type of polymorphism in OOP?

  1. Method overloading

  2. Method overriding

  3. Operator overloading

  4. Covariance

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

Covariance is not a type of polymorphism in OOP. The types of polymorphism in OOP are method overloading, method overriding, and operator overloading.

Multiple choice

What is the ability of an object to take on different forms called?

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

Polymorphism is the ability of an object to take on different forms.

Multiple choice

Which of the following is NOT a type of abstraction in OOP?

  1. Data abstraction

  2. Procedural abstraction

  3. Control abstraction

  4. Information hiding

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

Information hiding is not a type of abstraction in OOP. The types of abstraction in OOP are data abstraction, procedural abstraction, and control abstraction.

Multiple choice

What is the process of creating a new object from an existing object called?

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Instantiation

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

Instantiation is the process of creating a new object from an existing object.

Multiple choice

Which of the following is NOT a type of relationship between objects in OOP?

  1. Aggregation

  2. Composition

  3. Inheritance

  4. Association

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

Inheritance is not a type of relationship between objects in OOP. The types of relationships between objects in OOP are aggregation, composition, and association.

Multiple choice

What is the process of grouping related data and methods into a single unit called?

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

Encapsulation is the process of grouping related data and methods into a single unit.

Multiple choice

Which of the following is NOT a type of class in OOP?

  1. Abstract class

  2. Concrete class

  3. Interface

  4. Singleton class

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

Singleton class is not a type of class in OOP. The types of classes in OOP are abstract class, concrete class, and interface.

Multiple choice

What is the process of creating a class from an existing class called?

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Instantiation

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

Inheritance is the process of creating a class from an existing class.

Multiple choice

Which of the following is NOT a type of method in OOP?

  1. Instance method

  2. Static method

  3. Constructor

  4. Destructor

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

Destructor is not a type of method in OOP. The types of methods in OOP are instance method, static method, and constructor.

Multiple choice

What is the process of bundling data and methods that operate on that data together into a single unit called an object?

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

Encapsulation is the process of bundling data and methods that operate on that data together into a single unit called an object.