Question
Which SOLID principle emphasizes that a class should
have only one reason to change?Solution
The Single Responsibility Principle (SRP) in SOLID design principles states that a class should have only one reason to change, meaning it should encapsulate only one responsibility. This principle promotes cohesion and ensures that each class handles a single task or functionality. For instance, in an inventory management system, a Product class should handle product-related data only, while a separate Inventory class manages stock levels. Adhering to SRP reduces complexity, makes code easier to understand, and simplifies debugging and testing. By isolating responsibilities, developers can introduce changes without affecting unrelated parts of the system. Why Other Options Are Incorrect :
- Open/Closed Principle : Focuses on extending classes without modifying existing code, not on single responsibility.
- Liskov Substitution Principle : Ensures that derived classes can be substituted for their base classes without breaking functionality.
- Dependency Inversion Principle : Encourages dependency on abstractions rather than concrete implementations, unrelated to single responsibilities.
- Interface Segregation Principle : Suggests splitting large interfaces into smaller, specific ones, focusing on interface design, not class responsibilities.
On its 9th Foundation Day, what Gross Merchandise Value (GMV) did Government e Marketplace (GeM) achieve in FY 2024–25?Â
According to IATA, India surpassed which country to become the world’s 5th largest aviation market in 2024?Â
Safran’s new LEAP engine MRO facility inaugurated in Hyderabad was built with an investment of how much?Â
Under the Mukhyamantri Mahila Rojgar Yojana, how much initial direct transfer was made into each woman’s bank account?Â
Which new plant species was discovered in Arunachal Pradesh by the Botanical Survey of India?
Who was appointed Chairman of the Fertiliser Association of India (FAI) in June 2025?Â
World Consumer Rights Day is celebrated every year in which of the following date?
Which Indian naval ship represented India in the maiden bilateral maritime exercise with the Hellenic Navy in the Mediterranean?Â
Ministry of Tribal Affairs organised One Day Mega Health Camp ‘Abua Bugin Hodmo-Our Better Health’ at which of the following city?
In the newly established hydrogen blending project in Ahmedabad, what is the initial percentage of green hydrogen blended with natural gas?