Govt. Exams
Entrance Exams
Inheritance and polymorphism provide better maintainability, scalability, and follow SOLID principles compared to conditional logic.
ASP.NET Core Web API with [ApiController] attribute is the modern approach for building RESTful APIs that return JSON.
AddScoped, AddSingleton, and AddTransient are methods to register services with different lifetimes in ASP.NET Core DI.
Async/Await enables non-blocking I/O operations, allowing ASP.NET Core to handle more concurrent requests efficiently.
ASP.NET Web Forms lifecycle: Init → Load → Event Handling (ViewState restored) → Render → Unload.
For persistent data across multiple sessions, database storage is the best approach. Session State is temporary and Application State is server-wide.
A base class with virtual Logout() allows common implementation, while abstract Login() forces derived classes to provide their own implementation. This combines code reuse with flexibility.
Open/Closed Principle states that classes should be open for extension (SavingsAccount, CurrentAccount extend Account) but closed for modification (Account class rules remain unchanged). This is a classic example of OCP.
In C#, if you attempt to override a non-virtual method without using 'new' keyword, the compiler issues a warning but the method is hidden (not overridden). Using 'new' keyword explicitly hides the base method.
Strategy pattern defines a family of algorithms (logger types) and makes them interchangeable through interface polymorphism, allowing runtime selection.