Object-oriented programming (OOP) is a programming paradigm that represents the concept of "objects" that have data fields (attributes that describe the object) and associated procedures known as methods.

Top 20 OOPs Interview Questions and Answers for freshers and experienced are below are below :

1. What is OOPS?
Object-oriented programming (OOP) is a programming language model organized around objects rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data.

2. basic Concepts of OOPs?

3. What is a class?
A set or category of things having some property or attribute in common and differentiated from others by kind, type, or quality.

4. What is an object?
Objects are created from Classes, in C#, is an instance of a class that is created dynamically. Object is also a keyword that is an alias for the predefined type System.

5. What is Encapsulation?
Encapsulation is the packing of data and functions into a single component. The features of encapsulation are supported using classes in most object-oriented programming languages, although other alternatives also exist.

It allows selective hiding of properties and methods in an object by building an impenetrable wall to protect the code from accidental corruption.

6. What is Polymorphism?
In programming languages and type theory, polymorphism is the provision of a single interface to entities of different types.
A polymorphic type is a type whose operations can also be applied to values of some other type, or types.

7. What is Inheritance?
inheritance is when an object or class is based on another object or class, using the same implementation (inheriting from a class) specifying implementation to maintain the same behavior (realizing an interface; inheriting behavior).

It is a mechanism for code reuse and to allow independent extensions of the original software via public classes and interfaces.

8. What is Constructor?
A is special method of the class that will be automatically invoked when an instance of the class is created is called as constructor.

Constructors are mainly used to initialize private fields of the class while creating an instance for the class.

When you are not creating a constructor in the class, then compiler will automatically create a default constructor in the class that initializes all numeric fields in the class to zero and all string and object fields to null.

[Access Modifier] ClassName([Parameters])

9. Types of Constructors
Basically constructors are 5 types those are
Default Constructor
Parameterized Constructor
Copy Constructor
Static Constructor
Private Constructor

10. Define Destructor?
A destructor is a method which is automatically invoked when the object is destroyed.

Its main purpose is to free the resources (memory allocations, open files or sockets, database connections, resource locks, etc.)

11. What is Inline function?
In the C and C++ programming languages, an inline function is one qualified with the keyword inline; this serves two purposes.
Firstly, it serves as a compiler directive, which suggests (but does not require) that the compiler substitute the body of the function inline by performing inline expansion,
The second purpose of inline is to change linkage behavior; the details of this are complicated.

12. What is operator overloading?
In programming, operator overloading—less commonly known as operator ad hoc polymorphism—is a specific case of polymorphism, where different operators have different implementations depending on their arguments. Operator overloading is generally defined by the language, the programmer, or both.

13. Different between method overriding and  method overloading?
In Overriding methods it will create two or more methods with same name and same parameter in different classes.

while Overloading it will create more then one method with same name but different parameter in same class.

14. What is this keywords?
Every instance method in every object in Java receives a reference named this when the method is invoked.  The reference named this is a reference to the object on which the method was invoked.  It can be used for any purpose for which such a reference is needed.

15. What is super keyword?
The super keyword is a reference variable that is used to refer immediate parent class object.

Whenever you create the instance of subclass, an instance of parent class is created implicitly i.e. referred by super reference variable.

16. What is an abstract class?An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.

17. What is final keywords?
The final keyword in java is used to restrict the user. The java final keyword can be used in many context.
Final can be: variable, method, class.

The final keyword can be applied with the variables, a final variable that have no value it is called blank final variable or uninitialized final variable. It can be initialized in the constructor only. The blank final variable can be static also which will be initialized in the static block only.

More question coming soon.. we are updating our list of ques and answer... :)
keep wait and watch for few days.

Post a Comment

  1. Nice Interview question, this will help in taking Interivew.

    1. Thank you, Abhishek for visit itechaleart.com.

  2. Nice collection of OOPs interview questions. You have covered almost all the areas of Object Oriented Programming. Thanks for the share!! :)

    1. Thank you, Chaitanya Singh 4 visit itechaleart.com.

  3. good interveiw Qustion :-d

  4. Please review the answer for question number 48 :

    What is the default access specifier in a class definition?
    Private access specifier is used in a class definition.

  5. It's very good post for interview.
    Thank you for all of this.

  6. Awesome :)
    Fully knowledgeable Questions and Answer regarding OOPS.
    Good Job (y)

  7. for question 16, I think an abstract class can contain nonabstract methods

    1. Thank you, Xuke fang to printout our mistake.

      Yes u right, abstract class can be contain members, methods and also abstract methods but we can not create instance of that class.

    2. abstract class must have at least one abstract method then an then it will be a abstract class.

    3. Hi, you can create abstract class without abstract method.

      "A class that is declared with abstract keyword, is known as abstract class in java. It can have abstract and non-abstract methods (method with body)."

      There are two ways to achieve abstraction in java
      Abstract class (0 to 100%)
      Interface (100%)

  8. its a superb pattern n its help a lot...thanks. :)

  9. m little confused about Polymorphism :O