Question
Which SOLID principle emphasizes that software entities
should be open for extension but closed for modification?Solution
The Open/Closed Principle (OCP) is one of the SOLID principles for object-oriented design. 1. Key Idea: Software entities like classes, modules, and functions should be extendable without altering existing code. 2. Implementation: Achieved through techniques like inheritance, polymorphism, or interfaces that allow new functionality to be added without modifying the original codebase. 3. Benefits: Promotes code reusability, reduces the risk of introducing bugs into stable code, and facilitates easier maintenance and scaling. 4. Example: A class for processing payments could use an interface for payment methods. Adding a new payment type would require extending the interface, not modifying the class. This principle ensures that software systems are adaptable to new requirements without jeopardizing existing functionality. Why Other Options Are Incorrect: β’ A) SRP: Focuses on assigning one responsibility to each class/module but does not address extensibility. β’ C) LSP: Ensures derived classes can replace base classes without altering behavior, unrelated to modification. β’ D) ISP: Advocates for creating specific interfaces for clients, reducing unnecessary dependencies. β’ E) DIP: Encourages high-level modules to depend on abstractions rather than concrete implementations.
Which the following is not the reason for demand pull inflation?
Which among the following method is also called as Original cost method, Fixed Installment method or Equal Installment method?
Under the Pradhan Mantri Suraksha Bima Yojana risk coverage of ________for accidental death and complete disability and _______ for partial disability i...
As per the Credit Guarantee Scheme for Micro and Small Enterprises, what is the maximum credit facility limit eligible for guarantee coverage when exten...
Calculate EOQ (approx.) from the following details:
Annual Consumption: 20000 units
Ordering cost: Rs. 10 per order
Purchase price:...
What is the value of per unit of inventory if the firm uses absorption costing?
Direct material cost per unit = Rs.3
Direct Labour cost ...
As per IRACP norms, i n case of a loan other than revolving facility, SMA-0 is defined as which of the following?
PM SVANidhi allows street vendors to avail an initial loan of ___________.
Which of the following has an implicit cost of capital
Which of the following financial activity cannot be outsourced by an NBFC?