Top 15 OOPS Interview Questions & Answers Asked by MNCs

OOPs Interview Questions & Answers


1. What is OOPs?

OOPs refer to Object-Oriented Programming system in which programs are treated as a collection of objects. Each object is nothing but an example of a class.

2. Difference between Procedural programming and OOPs?

Procedural Programming:

  • It is based on functions.
  • It reveals the data to the entire program.
  • It offers less scope of code reuse.
  • It follows a top-down programming paradigm.
  • It is complicated in nature, so it is hard to modify, extend and maintain.

Object-oriented programming:

  • It is based on real-world objects.
  • It encapsulates the data.
  • It provides more scope of code reuse
  • It follows a bottom-up programming paradigm.
  • It is less complicated in nature, so it is easier to modify, extend and maintain.

3. What are the basic concepts of OOPs?

The basic concepts of OOPs are:

  • Inheritance
  • Encapsulation
  • Polymorphism
  • Abstraction

4. What is Abstraction?

Abstraction is an OOPs approach to construct the structure of the real-world objects. During the construction, only the general states and behaviours are taken, and more specific states and actions are left aside for the implementers.

5. What is Encapsulation?

Encapsulation is an OOPs concept to create and define the restrictions and permissions of an object and its member variable and methods. It is very simple to explain the concept is to make the member variables of a class private and providing public getter and setter methods.

6. What is Polymorphism?

Polymorphism is an instance of something in various forms. Java supports multiple forms of polymorphism like polymorphic method, polymorphic reference variable, polymorphic return types and polymorphic argument types.

7.  What is inheritance and its types?

A subclass can inherit the behaviours and states of its superclass are known as inheritance. There are various types of inheritance:

  • Hybrid Inheritance
  • Multiple Inheritance
  • Single Inheritance
  • Multi-level Inheritance
  • Hierarchical Inheritance

8. What is an object, method and class?

  • Object: An object is an instance of a class. It has its own identity and behaviour.
  • Class:  Class is a user-defined data type that contains variables, properties and methods.  It determines the properties of an object.
  • Method:  It is a set of instructions, also called a procedure that is to be performed on the given data.

9. What is Static Binding and Dynamic Binding?

Static Binding is a binding in which name can be combined with the class during collection time, and it is also called as early binding.

Dynamic Binding is a binding in which name can be identified with the class during execution time, and it is also known as Late Binding

10. What are a constructor and its types?

A constructor is a special kind of method that has the same name as the class and is used to initialize objects of that class. Type of constructor differs from language to language:

  • Private Constructor
  • Default Constructor
  • Copy Constructor
  • Static Constructor
  • Parameterized Constructor

11. Define overloading and overriding in OOPs?

  • Overloading is static binding, whereas overriding is productive binding. Overloading is the same method with different arguments, and it may or may not return the equal value in the same class itself.
  • Overriding is the same method names with the same arguments and return types identified with the class and its child class.

12. What are the access modifiers?

Access modifiers define the scope of the method or variable that can be accessed from other various objects.

13. What is an abstract class?

An abstract class cannot be proved. Formation of an object is not possible with an abstract class, but it can be inherited. An abstract class can only contain an abstract method, and java allows only abstract method in abstract class while other languages allow non-abstract method as well.

14. What are all the operators that cannot be overloaded?

The operators that cannot be overloaded are:

  • Member Selection
  • Scope Resolution
  • Member selection through a pointer to a function

15. What does the keyword virtual represented in the method definition?

It represents that we can override the method.

So, above are some frequently asked interview questions along with answers. We hope this article will help you crack the interview. Best of luck!

0 0 vote
Article Rating

Do you want to hire us for your Project Work? Then Contact US.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x