Last active
October 30, 2024 13:59
-
-
Save spinningcat/96003c4ab9ded591428be9f2c589e372 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OOP Concepts in C# | |
Explain encapsulation, inheritance, and polymorphism with examples in C#. | |
What is method overloading and method overriding in C#? How are they different? | |
Explain the concept of SOLID principles and how each one applies in C# application design. | |
What are generics in C#? How do they improve code reusability? | |
How does C# handle exceptions? What are try, catch, finally, and throw used for? | |
Explain the Singleton pattern in C# and demonstrate how to implement it. | |
What is dependency injection (DI)? How is it implemented in .NET? | |
2. OOP Concepts in C# | |
What are the key differences between classes and structs in C#? | |
Describe encapsulation with examples. | |
How does inheritance work in C#? Give an example. | |
Explain polymorphism in C# and provide code to demonstrate it. | |
What is the difference between override and new keywords in C#? | |
How do interfaces and abstract classes differ? | |
Can you create multiple constructors in a C# class? How? | |
What is a sealed class, and when would you use it? | |
Explain the concept of composition vs inheritance. | |
How is operator overloading implemented in C#? | |
What is downcasting and upcasting in C#? | |
What is the difference between shallow copy and deep copy in C#? | |
How can you prevent inheritance in C#? | |
What is the IS-A vs HAS-A relationship in OOP? | |
What is a virtual method in C#, and why is it used? | |
How would you implement multiple interfaces in a C# class? | |
Describe the Factory design pattern in C#. | |
Explain the Observer pattern with a C# example. | |
How would you create a singleton class in C#? | |
What is the purpose of an interface, and how does it enhance flexibility? | |
Explain the Repository and Unit of Work patterns in C#. Why are they useful in data access? | |
How would you implement the Mediator pattern in C#? What problems does it solve? | |
What is the purpose of the Decorator pattern, and how would you implement it in C#? | |
Core OOP Principles | |
Explain the four main principles of OOP: Encapsulation, Inheritance, Polymorphism, and Abstraction. | |
What is encapsulation, and how does it help in protecting data within a class? Can you provide an example? | |
Describe inheritance and its purpose. How does it support code reusability? | |
What is polymorphism? Explain the difference between compile-time and runtime polymorphism with examples. | |
What is abstraction in OOP, and how does it differ from encapsulation? | |
Classes and Objects | |
What is the difference between a class and an object? | |
What are constructors in OOP, and why are they important? | |
Can a class have multiple constructors? How does constructor overloading work? | |
What is a destructor, and when is it used in OOP? | |
What is the purpose of the this keyword? | |
Inheritance and Composition | |
What is the difference between composition and inheritance? When would you choose one over the other? | |
Explain the concept of multiple inheritance. Why doesn’t C# support it directly, and how can you achieve similar functionality? | |
What is the purpose of the base keyword in inheritance? | |
How do abstract classes differ from interfaces, and when would you use each in a project? | |
Polymorphism and Method Behavior | |
What is method overloading, and how does it differ from method overriding? | |
Explain the difference between the virtual, override, and new keywords in C#. | |
What is late binding, and how does it relate to polymorphism? | |
How does polymorphism improve flexibility and maintainability in a program? | |
What are virtual methods, and why are they useful? | |
Interfaces and Abstract Classes | |
What is an interface, and how does it differ from an abstract class? | |
Can a class implement multiple interfaces? Provide an example. | |
What are default implementations in interfaces, and how do they work in C#? | |
What are the advantages and disadvantages of using interfaces over inheritance? | |
Why can’t an interface have a constructor in C#? | |
Advanced OOP Topics | |
What is a sealed class, and when would you use it? | |
Explain the concept of an inner or nested class. When might it be useful? | |
What is the difference between shallow copy and deep copy in object cloning? | |
What is the difference between upcasting and downcasting? When would you use each? | |
How do you implement operator overloading in C#? | |
Design Patterns and Principles in OOP | |
What is the Singleton pattern, and how do you implement it? | |
Explain the Factory pattern with an example. How does it promote flexibility? | |
Describe the Observer pattern and provide an example of how it might be used. | |
What is the Dependency Inversion Principle, and how does it apply to OOP? | |
How does the SOLID principle relate to OOP, and what is each letter in SOLID shorthand for? | |
Practical OOP Scenarios | |
Describe a situation where you would use an abstract class instead of an interface. | |
How would you design a class hierarchy for a transportation system with classes like Vehicle, Car, Bike, and Truck? | |
What are some drawbacks of excessive inheritance? How might it negatively impact maintainability? | |
How would you refactor a class that is doing too much (violating the Single Responsibility Principle) in an OOP design? | |
How would you prevent a class from being inherited in C#? Why might this be necessary? | |
Pattern question | |
What is the Singleton pattern, and how do you implement it in a thread-safe way? | |
Explain the Factory Method pattern. How does it promote flexibility in code? | |
What is the Abstract Factory pattern, and how does it differ from the Factory Method pattern? | |
Describe the Builder pattern. When would you use it over a constructor or Factory pattern? | |
What is the Prototype pattern, and how does it handle object cloning? | |
Structural Patterns | |
What is the Adapter pattern, and how does it help in integrating incompatible interfaces? | |
Explain the Bridge pattern. How does it separate abstraction from implementation? | |
CQORS and mediatr | |
solid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment