Computer Knowledge

Object-Oriented Programming

2,239 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

Which design pattern allows you to convert the interface of a class into another interface that clients expect?

  1. Factory Method

  2. Strategy

  3. Adapter

  4. Builder

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

The Adapter design pattern allows you to convert the interface of a class into another interface that clients expect, promoting compatibility and interoperability.

Multiple choice

Which design pattern allows you to create objects that can be composed into larger objects, providing a tree-like structure?

  1. Factory Method

  2. Strategy

  3. Composite

  4. Builder

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

The Composite design pattern allows you to create objects that can be composed into larger objects, providing a tree-like structure and promoting flexibility and code reusability.

Multiple choice

Which programming paradigm emphasizes the use of objects and classes to represent real-world entities?

  1. Procedural Programming

  2. Object-Oriented Programming

  3. Functional Programming

  4. Logic Programming

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

Object-Oriented Programming (OOP) emphasizes the use of objects and classes to represent real-world entities, allowing for modularity, encapsulation, and code reusability.

Multiple choice

What is the term for an individual object or instance that possesses a universal property?

  1. Particular

  2. Instance

  3. Example

  4. Token

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

Particulars are individual objects or instances that possess universal properties. For example, 'Socrates' is a particular human being.