Which of the following design patterns violates the Open/Closed Principle of SOLID principles in object-oriented design?
The Singleton pattern violates the Open/Closed Principle of SOLID, which states that software entities (classes, modules, functions) should be open for extension but closed for modification. The Singleton pattern is designed to restrict the instantiation of a class to a single object. To achieve this, the class is tightly coupled to its own instance management logic, which means modifying or extending this behavior requires changes to the original class. As a result, Singleton classes are not easily extensible without modification, making them contrary to the Open/Closed Principle. Why Other Options are Incorrect: A) Strategy Pattern: The Strategy Pattern adheres to the Open/Closed Principle by allowing algorithms to be selected and applied at runtime without modifying existing code. C) Factory Method Pattern: This pattern promotes extensibility by allowing subclasses to alter the type of objects that will be created, without modifying the client code. D) Decorator Pattern: The Decorator Pattern is designed to extend functionality dynamically by wrapping objects, adhering to the Open/Closed Principle. E) Adapter Pattern: The Adapter Pattern allows for existing classes to be used without modification by adapting their interfaces to a new target interface, following the Open/Closed Principle.
Four of the following five are alike in a certain way and thus form a group. Which of the following does not belong to the group?
Poonam walks 15m towards East and turns right and walks 8m then, she turns left and walks 12m and then turns left and walks 8m. In which direction and h...
If one more person P is standing towards South-West with respect to G, then in which direction is L, standing with respect to P?
Point C is in which direction with respect of Point B?
What is the distance between K’s house and Z’s house?
Savita starts walking from Mall and walks 10 m towards East and then turns right and walks 90 m. Then she turns left and walks 40 m. After that she agai...
Study the following information carefully and answer the given questions:
Point T is 16 m east of point U. Point U is 6 m north of point V and ...
If V is 4m to the North of O, then what is the distance between V and P?
What is the direction of point I with respect of point F?
What is the direction of Z with respect to E?