Top 30 OOPS Interview Questions

OOPS

#1.

What are the main pillars of OOPS?

#2.

What is Encapsulation? Explain with an example.

#3.

What is Abstraction? Explain with an example.

#4.

Difference between Encapsulation & Abstraction?

#5.

What is Inheritance?

#6.

Why multiple inheritance is not supported in C#?

#7.

How would you implement multiple inheritance in C#?

#8.

What is Polymorphism?

#9.

Explain types of Polymorphism.

#10.

What is Method Overloading/Compile Time Polymorphism?

#11.

What would be the output of the below problem if we call new Student().Add(1,1); ?

public class Student
{
    public int Add(int num1, int num2)
    {
        return (num1 + num2);
    }
    public string Add(int num1, int num2)
    {
        return (num1 + num2).ToString();
    }
}

#12.

What method would be invoked when we call new Student().GetData(1); ?

public class Student
{
    public int GetData(int id) { ... }

public int GetData(object id) { ...}

}

#13.

What is Method Overriding/Run Time Polymorphism?

#14.

What is Method Hiding or Method Overshadowing? Explain with some real use case.

#15.

What are SOLID principles?

#16.

Explain Sigle Responsibility Principle?

#17.

Explain Open Closed Principle?

#18.

Explain Liskov Substitution Principle?

#19.

Explain Interface Segregation Principle?

#20.

Explain Dependency Inversion Principle?