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 mechanism that allows a class to inherit the properties and methods of another class?

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

Inheritance is the mechanism that allows a class to inherit the properties and methods of another class.

Multiple choice

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

  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

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

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

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

Multiple choice

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

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

What is the ability of an object to respond to different messages in different ways?

  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 respond to different messages in different ways.

Multiple choice

What is the process of creating a class that is a specialized version of another class?

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

Inheritance is the process of creating a class that is a specialized version of another class.

Multiple choice

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

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

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

Multiple choice

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

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

What is the ability of an object to respond to different messages in different ways?

  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 respond to different messages in different ways.

Multiple choice

What is the process of creating a class that is a specialized version of another class?

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

Inheritance is the process of creating a class that is a specialized version of another class.

Multiple choice

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

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

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

Multiple choice

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

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

What is the ability of an object to respond to different messages in different ways?

  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 respond to different messages in different ways.

Multiple choice

What is the process of creating a class that is a specialized version of another class?

  1. Encapsulation

  2. Inheritance

  3. Polymorphism

  4. Abstraction

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

Inheritance is the process of creating a class that is a specialized version of another class.

Multiple choice

How is IoU calculated for object detection with multiple classes?

  1. IoU is calculated separately for each class.

  2. IoU is calculated for all classes together.

  3. IoU is not calculated for object detection with multiple classes.

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

IoU is calculated separately for each class in object detection with multiple classes. This is because the IoU score for a particular class is only affected by the overlap between the predicted and ground truth bounding boxes for that class.