
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
The instructions and questions for quiz 5 in cse 70, a university-level object-oriented programming course offered in fall 2009. Students are required to answer questions related to various oop concepts, including pattern matching, adapter design, and the principle of least knowledge.
Typology: Exercises
1 / 1
This page cannot be seen from the preview
Don't miss anything!
This quiz is to be taken by yourself with closed books, closed notes, no electronic devices.
Match each pattern with its description:
To make a Turkey look like a Duck, we need to provide an adapter interface
A) with the Turkey methods and implement them with calls to equivalent Duck methods B) with the Duck methods and implement them with calls to equivalent Turkey methods C) with both Turkey and Duck method and implement them with calls to each other's equivalent methods D) that uses reflection to create a Turkey object each time the client requests a Duck object E) that throws an UnsupportedOperationException each time the client tries to use any Duck method F) that throws an UnsupportedOperationException each time the client tries to use any Turkey method
A) the object itself B) any object the method creates/instantiates C) any object returned from calling other methods D) any object passed in as a parameter to the method E) any component of the object (for example, instance variables referencing other objects)
Pattern
____ Strategy
____ Adapter
____ Iterator
____ Facade
____ Composite
____ Observer
____ Template Method
A) Clients treat collections of objects and individual objects uniformly B) Provides a way to traverse a collection of objects without exposing the collection's implementation C) Simplifies the interface of a group of classes D) Changes the interface of one or more classes E) Allows a group of objects to be notified when some state changes F) Encapsulates interchangeable behaviors and uses delegation to decide which one to use G) Defines the steps of an algorithm and allows subclasses to decide how to implement one or more steps