Top 100 Technical Interview Questions Flashcards
What are design patterns?
Design patterns are reusable solutions to common software design problems.
Explain the Singleton pattern.
The Singleton pattern ensures a class has only one instance and provides a global point of access to that instance.
What is the Factory pattern?
The Factory pattern creates objects without specifying the exact class of object that will be created.
Describe the Observer pattern.
The Observer pattern defines a dependency between objects, so that when one object changes state, all its dependents are notified and updated automatically.
How does the Strategy pattern work?
The Strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable.
What is the Decorator pattern?
The Decorator pattern attaches additional responsibilities to an object dynamically.
Explain the Adapter pattern.
The Adapter pattern allows incompatible interfaces to work together by providing a wrapper with a compatible interface.
Describe the Template Method pattern.
The Template Method pattern defines the structure of an algorithm but allows subclasses to provide certain steps’ implementations.
What is the Command pattern?
The Command pattern turns a request into a stand-alone object, containing all information about the request.
Explain the Proxy pattern.
The Proxy pattern provides a surrogate or placeholder for another object to control access to it.
What is the Chain of Responsibility pattern?
The Chain of Responsibility pattern sends a request along a chain of handlers, where each handler decides whether to process the request or pass it along.
Describe the State pattern.
The State pattern allows an object to change its behavior when its internal state changes.
What is the Composite pattern?
The Composite pattern composes objects into tree structures to represent part-whole hierarchies.
Explain the Iterator pattern.
The Iterator pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
Describe the Memento pattern.
The Memento pattern captures and restores an object’s internal state.
What does SOLID stand for?
SOLID stands for Single Responsibility Principle, Open-Closed Principle, Liskov Substitution Principle, Interface Segregation Principle, and Dependency Inversion Principle.
Explain the Single Responsibility Principle (SRP).
SRP states that a class should have only one reason to change, i.e., it should have only one responsibility.
What is the Open-Closed Principle (OCP)?
OCP suggests that software entities should be open for extension but closed for modification.
Describe the Liskov Substitution Principle (LSP).
LSP states that objects of a superclass should be replaceable with objects of its subclasses without affecting the correctness of the program.
What does the Interface Segregation Principle (ISP) state?
ISP states that clients should not be forced to depend on interfaces they don’t use.
Explain the Dependency Inversion Principle (DIP).
DIP states that high-level modules should not depend on low-level modules, both should depend on abstractions, and abstractions should not depend on details.
What is Dependency Injection (DI)?
DI is a design pattern that allows the creation of dependent objects outside of a class and provides them to the class through constructors, methods, or properties.
What is Inversion of Control (IoC)?
IoC is a principle where the control of an object’s lifecycle and dependencies are handed over to a container or framework.
Why is Dependency Injection beneficial?
DI promotes loose coupling, easier testing, and better maintainability by decoupling components and their dependencies.
Explain Constructor Injection.
Constructor Injection involves passing dependencies through a class’s constructor.
What is Property Injection?
Property Injection involves setting the dependencies through public properties on a class.
Describe Method Injection.
Method Injection involves passing dependencies as parameters to methods where they’re needed.
What is the role of an IoC container?
An IoC container manages the instantiation and injection of dependencies, following the IoC principle.
Name a few popular IoC containers in .NET.
Some examples include Unity, Autofac, Ninject, and StructureMap.
What is MVC (Model-View-Controller)?
MVC is a design pattern that separates an application into three interconnected components: Model, View, and Controller.
Explain the Model in MVC.
The Model represents the application’s data and business logic.
What is the View in MVC?
The View presents the data to the user and receives user input.
Describe the Controller in MVC.
The Controller handles user input, processes it, and updates the Model and View accordingly.
What is MVVM (Model-View-ViewModel)?
MVVM is a design pattern that separates an application into Model, View, and ViewModel components.
Explain the ViewModel in MVVM.
The ViewModel acts as an intermediary between the Model and the View, providing data and behavior for the View.
How does data binding work in MVVM?
Data binding automatically synchronizes the data between the ViewModel and the View, ensuring consistency.
What is a microservices architecture?
Microservices is an architectural style where an application is composed of loosely coupled, independently deployable services.
What are the advantages of microservices?
Advantages include scalability, independent deployment, technology diversity, and easier maintenance.
Describe the communication between microservices.
Microservices often communicate over lightweight protocols like HTTP/REST or messaging systems like RabbitMQ.
What are the challenges of microservices?
Challenges include managing distributed data, ensuring consistency, dealing with network latency, and monitoring complex systems.