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
What is the process of binding a method call to a specific object called?
-
Encapsulation
-
Inheritance
-
Polymorphism
-
Dynamic binding
D
Correct answer
Explanation
Dynamic binding is the process of binding a method call to a specific object at runtime.
Which of the following is NOT a type of inheritance in OOP?
-
Single inheritance
-
Multiple inheritance
-
Hierarchical inheritance
-
Interface inheritance
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.
What is the ability of a class to inherit the properties and methods of another class called?
-
Encapsulation
-
Inheritance
-
Polymorphism
-
Abstraction
B
Correct answer
Explanation
Inheritance is the ability of a class to inherit the properties and methods of another class.
Which of the following is NOT a benefit of using OOP?
-
Reusability
-
Maintainability
-
Extensibility
-
Complexity
D
Correct answer
Explanation
Complexity is not a benefit of using OOP. The benefits of using OOP include reusability, maintainability, and extensibility.
What is the process of hiding the implementation details of an object from the user called?
-
Encapsulation
-
Inheritance
-
Polymorphism
-
Abstraction
A
Correct answer
Explanation
Encapsulation is the process of hiding the implementation details of an object from the user.
Which of the following is NOT a type of polymorphism in OOP?
-
Method overloading
-
Method overriding
-
Operator overloading
-
Covariance
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.
What is the ability of an object to take on different forms called?
-
Encapsulation
-
Inheritance
-
Polymorphism
-
Abstraction
C
Correct answer
Explanation
Polymorphism is the ability of an object to take on different forms.
Which of the following is NOT a type of abstraction in OOP?
-
Data abstraction
-
Procedural abstraction
-
Control abstraction
-
Information hiding
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.
What is the process of creating a new object from an existing object called?
-
Encapsulation
-
Inheritance
-
Polymorphism
-
Instantiation
D
Correct answer
Explanation
Instantiation is the process of creating a new object from an existing object.
Which of the following is NOT a type of relationship between objects in OOP?
-
Aggregation
-
Composition
-
Inheritance
-
Association
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.
What is the process of grouping related data and methods into a single unit called?
-
Encapsulation
-
Inheritance
-
Polymorphism
-
Abstraction
A
Correct answer
Explanation
Encapsulation is the process of grouping related data and methods into a single unit.
Which of the following is NOT a type of class in OOP?
-
Abstract class
-
Concrete class
-
Interface
-
Singleton class
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.
What is the process of creating a class from an existing class called?
-
Encapsulation
-
Inheritance
-
Polymorphism
-
Instantiation
B
Correct answer
Explanation
Inheritance is the process of creating a class from an existing class.
Which of the following is NOT a type of method in OOP?
-
Instance method
-
Static method
-
Constructor
-
Destructor
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.
What is the process of bundling data and methods that operate on that data together into a single unit called an object?
-
Encapsulation
-
Inheritance
-
Polymorphism
-
Abstraction
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.