03/03/2026
*β
Programming Concepts Interview Questions with Answers: Part-4*
*31. What is Dependency Injection?*
- Dependency Injection (DI) is a design technique where objects receive dependencies from outside.
- Reduces tight coupling, improves testability, and flexibility.
- Example: Instead of a class creating a database connection, it receives it.
*32. What is a Design Pattern? Name some common ones*
- Design Pattern is a reusable solution to common software design problems.
- Benefits: standardized solutions, better maintainability, reusable code structure.
- Common patterns: Singleton, Factory, Adapter, Observer, Strategy.
*33. What is Microservices Architecture?*
- Microservices Architecture is an architecture where an application is built as small independent services.
- Features: each service handles one function, independently deployable, communicate via APIs.
- Benefits: scalability, flexibility, faster deployment.
*34. What is Event-Driven Architecture?*
- Event-Driven Architecture is a system where components communicate by producing and responding to events.
- Benefits: loose coupling, real-time processing, scalable systems.
- Example: Order placed β payment processed β email sent.
*35. What is Race Condition?*
- Race Condition occurs when multiple threads access shared data simultaneously, causing unpredictable results.
- Cause: improper synchronization.
- Solution: locks, synchronization mechanisms, semaphores.
*36. What is Memory Leak?*
- Memory Leak occurs when a program does not release unused memory.
- Effects: increased memory usage, slow performance, application crash.
- Causes: unreleased objects, improper resource handling.
*37. Explain Garbage Collection*
- Garbage Collection is automatic memory management that removes unused objects.
- Purpose: prevent memory leaks, free unused memory.
- Languages using GC: Java, Python, C #.
*38. What is Lazy Loading?*
- Lazy Loading is a technique where resources are loaded only when needed.
- Benefits: faster initial loading, reduced memory usage, better performance.
- Example: images loading only when user scrolls.
*39. What is Idempotency in APIs?*
- Idempotency is an operation that produces the same result even if executed multiple times.
- Example: HTTP GET β idempotent, DELETE β idempotent.
- Importance: prevents duplicate operations, ensures reliability in distributed systems.
*40. What is SOLID principle?*
- SOLID is five principles for writing maintainable and scalable software.
- S β Single Responsibility, O β Open/Closed, L β Liskov Substitution, I β Interface Segregation, D β Dependency Inversion.
- Goal: clean, flexible, maintainable code.
*Double Tap β₯οΈ For More*