OOP Interview Questions


Q#1. What is OOPS?

Ans. OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.


Q#2. Why OOP?

Ans. The main advantage of OOP is better manageable code that covers following. 1) The overall understanding of the software is increased as the distance between the language spoken by developers and that spoken by users. 2) Object orientation eases maintenance by the use of encapsulation. One can easily change the underlying representation by keeping the methods same. OOP paradigm is mainly useful for relatively big software.


Q#3. What is a class?

Ans. A class is simply a representation of a type of object. It is the blueprint/plan/template that describes the details of an object.


Q#4. What is an Object?

Ans. An object is an instance of a class. It has its own state, behavior, and identity.


Q#5. What is encapsulation?

Ans. Encapsulation is an attribute of an object, and it contains all data which is hidden. That hidden data can be restricted to the members of that class.


Q#6. What is Abstraction?

Ans. Abstraction is an OOPS concept to construct the structure of the real world objects. During this construction only the general states and behaviors are taken and more specific states and behaviors are left aside for the implementers.


Q#7. What is Polymorphism?

Ans. Polymorphism is the occurrence of something in various forms. Java supports various forms of polymorphism like polymorphic reference variables, polymorphic method, polymorphic return types and polymorphic argument types.


Q#8. What is Inheritance?

Ans. Inheritance is a concept where one class shares the structure and behavior defined in another class. If Inheritance applied to one class is called Single Inheritance, and if it depends on multiple classes, then it is called multiple Inheritance.


Q#9. What is multiple inheritance?

Ans. A child class inheriting states and behaviors from multiple parent classes is known as multiple inheritance.


Q#10. What are manipulators?

Ans. Manipulators are the functions which can be used in conjunction with the insertion (<<) and extraction (>>) operators on an object. Examples are endl and set