1.

The _______________ is a design pattern that adds behavior to an individual object, either statically or dynamically, without affecting the behavior of other objects from the same class.(a) Adapter Pattern(b) Bridge Pattern(c) Decorator Pattern(d) Composite PatternThis question was addressed to me during an interview.I want to ask this question from Comparing Stubs, Mock Objects and In-container Testing topic in section In-container Testing of JUnit

Answer»

Right option is (c) DECORATOR Pattern

The explanation: The decorator pattern is OFTEN USEFUL for adhering to the SINGLE RESPONSIBILITY Principle.



Discussion

No Comment Found

Related InterviewSolutions