Professional Documents
Culture Documents
OOP 21-22 en
OOP 21-22 en
_____________________________________________________________________________________________________
_____________________________________________________________________________________________________
_____________________________________________________________________________________________________
______________________________________________
2. What are the objectives of the decorator pattern? Choose the right answer(s).
a. Enable the dynamic addition of functionality to an object.
b. Provide a uniform interface to a higher-level set of different interfaces in the system.
c. Allow the transfer of responsibility for creating objects to subclasses.
d. Hide the complexity of subsystems from the client.
e. Provide a substitute for the object to its control and protection.
f. Ensure that the class has one instance within the entire application.
g. Define an interface for creating objects.
h. Provide a flexible alternative to inheritance.
_____________________________________________________________________________________________________
_____________________________________________________________________________________________________
_____________________________________________________________________________________________________
_____________________________________________________________________________________________________
______________________________________________
3. Indicate for each case which design pattern you will use if you intend to:
a. Gather the information for an object before requesting its construction.
b. Defer for later the decision of which class to instantiate.
c. Construct a family of objects that share some characteristics.
d. Specify an object to create by giving an example from a copy of an existing object.
________________________________________________________________________________________________________
________________________________________________________________________________________________________
Page 1/5
________________________________________________________________________________________________________
________________________________________________________________
________________________________________________________________________________________________________
________________________________________________________________________________________________________
________________________________________________________________________________________________________
________________________________________________________________
5. Writing the Adapter pattern in Java will always result in an object adapter but never in a class
adapter
a. True
b. False
Page 2/5
________________________________________________________________________________________________________
________________________________________________________________________________________________________
__________________________________________________________________________
Question II [pts]:
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
Page 3/5
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
Page 4/5
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
_______________________________________________________________________________________
Page 5/5