β Introduction
At the intermediate level, interviewers expect more than definitions.
They test your ability to:
- Explain why a concept is used
- Compare similar OOPS concepts
- Apply OOPS in real-world scenarios
- Understand design decisions
This article covers commonly asked intermediate-level OOPS interview questions with practical, interview-ready answers.
πΉ 1. Difference between Encapsulation and Abstraction
| Encapsulation | Abstraction |
|---|---|
| Data hiding | Implementation hiding |
| Focuses on how data is accessed | Focuses on what functionality is exposed |
| Uses private fields + properties | Uses abstract classes / interfaces |
π Short answer:
Encapsulation protects data, abstraction hides complexity.
πΉ 2. Can we achieve abstraction without encapsulation?
β No
Abstraction depends on encapsulation.
If data is not protected (encapsulation), abstraction cannot be enforced safely.
πΉ 3. Why does C# not support multiple inheritance using classes?
Because multiple inheritance causes ambiguity (Diamond Problem).
Example:
Class A β Method X()
Class B β Method X()
Class C : A, B β Which X()?
β C# solves this using interfaces.
πΉ 4. What is the Diamond Problem?
When a class inherits from two classes that have a common base class, method ambiguity occurs.
C# avoids this by:
β Allowing multiple inheritance via interfaces only
πΉ 5. Difference between Method Overloading and Method Overriding
| Overloading | Overriding |
|---|---|
| Compile-time polymorphism | Runtime polymorphism |
| Same class | Parentβchild classes |
| Different parameters | Same parameters |
| Faster | Slightly slower |
πΉ 6. Why are fields usually private in OOPS?
Because:
β It enforces encapsulation
β Prevents invalid data
β Allows validation
β Improves maintainability
π Best practice:
Fields β private
Access β public properties
πΉ 7. Can constructors be overridden?
β No
Constructors are not inherited, so they cannot be overridden.
β They can be overloaded.
πΉ 8. Can static methods be overridden?
β No
Static methods belong to the class, not the object.
They can only be hidden, not overridden.
πΉ 9. Difference between new and override keywords
| new | override |
|---|---|
| Hides base method | Replaces base method |
| No polymorphism | Supports polymorphism |
| Compile-time decision | Runtime decision |
πΉ 10. What is Polymorphism and why is it important?
Polymorphism allows:
Same method call β different behavior
It enables:
β Flexible design
β Extensible systems
β Framework development
β Clean APIs
Example:Pay() β UPI / Card / NetBanking
πΉ 11. What is the difference between abstract class and interface?
| Abstract Class | Interface |
|---|---|
| Can have method bodies | No method bodies (pre-C# 8) |
| Single inheritance | Multiple inheritance |
| Can have fields | No fields |
| Strong relationship | Loose coupling |
πΉ 12. When should you use an interface instead of an abstract class?
Use interface when:
β Multiple inheritance is required
β Classes are unrelated
β You want loose coupling
β You are designing APIs
πΉ 13. What is a virtual method?
A method marked with virtual allows derived classes to override it.
public virtual void Print() { }
πΉ 14. What happens if we donβt use virtual but use override?
β Compilation error
The base method must be marked virtual.
πΉ 15. What is method hiding?
Method hiding occurs when:
- Child method uses
new - Parent method is hidden, not overridden
It does not support runtime polymorphism.
πΉ 16. What is a sealed class and why is it used?
A sealed class:
β Cannot be inherited
β Protects logic
β Improves performance
β Prevents misuse
Used when a class design is final.
πΉ 17. Can a sealed class implement interfaces?
β Yes
Sealed blocks inheritance, not interface implementation.
πΉ 18. What is the difference between static and instance members?
| Static | Instance |
|---|---|
| Belongs to class | Belongs to object |
| Single copy | Multiple copies |
| Accessed via class | Accessed via object |
πΉ 19. Why can static methods not access instance members?
Because static methods:
β Do not belong to any object
β Cannot access object-specific data
πΉ 20. What is constructor chaining?
Calling one constructor from another using:
this()β same classbase()β parent class
It reduces duplication.
πΉ 21. What is tight coupling vs loose coupling?
| Tight Coupling | Loose Coupling |
|---|---|
| Classes depend directly | Depend via interfaces |
| Hard to modify | Easy to extend |
| Poor testability | Better testing |
πΉ 22. How does OOPS help in real projects?
β Modularity
β Reusability
β Maintainability
β Scalability
β Team collaboration
πΉ 23. Can we create an object of an abstract class?
β No
But we can create a reference of abstract class pointing to a derived object.
πΉ 24. What is the default access modifier in C#?
- Class β
internal - Class members β
private
πΉ 25. Difference between IS-A and HAS-A relationship
- IS-A β Inheritance
- Car IS-A Vehicle
- HAS-A β Composition
- Car HAS-A Engine
π§ Interview Tip
For intermediate interviews:
β Explain with example
β Use real-world analogy
β Compare similar concepts
β Mention why & when, not just what
π Conclusion
These intermediate OOPS questions test your depth of understanding, not memorization.
If you can confidently answer these, you are ready for senior-level and system design questions.