Engineering Questions with Answers - Multiple Choice Questions

MCQs on The Adapter Patterns and Proxy Pattern

1 - Question

Which of the following is true for Adapter pattern?
a) An adapter or wrapper is a component that provides a new interface for an existing component
b) An Adapter or Wrapper pattern is a broker pattern that provides a new interface for existing software so that it can be reused
c) Adaptation for reuse is an old technique that has been used since the beginning of software development
d) All of the mentioned

View Answer

Answer: d
Explanation: All of the mentioned are true.




2 - Question

The Adapter patterns provide object-oriented adapters in which of theses varieties?
a) One uses inheritance
b) one uses delegation
c) All of the mentioned
d) None of the mentioned

View Answer

Answer: c
Explanation: Adapter patterns includes all the mentioned varieties.




3 - Question

A class (the adapter class) may be given a new interface by an adapter class in which of the two ways?
a) The adapter may subclass the adapter. The adapter can inherit adapter operations with appropriate semantics and pragmatics, override those with inappropriate semantics or pragmatics, and add operations needed for the new interface. This is the Class Adapter pattern
b) The adapter may hold a reference to the adapter and delegate must work to the adapter object. This approach is the Object Adapter pattern
c) All of the mentioned
d) None of the mentioned

View Answer

Answer: c
Explanation: All of the mentioned are the two ways.




4 - Question

A class (the adapter class) may be given a new interface by an adapter class in which of these ways?
a) Class Adapter pattern
b) Object Adapter pattern
c) All of the mentioned
d) None of the mentioned

View Answer

Answer: c
Explanation: A class (the adapter class) may be given a new interface by an adapter class into two ways- Class Adapter pattern and Object Adapter pattern.




5 - Question

Which of these states about Object Adapter pattern?
a) The adapter can inherit adapter operations with appropriate semantics and pragmatics, override those with inappropriate semantics or pragmatics, and add operations needed for the new interface
b) The adapter may hold a reference to the adapter and delegate must work to the adapter object
c) All of the mentioned
d) None of the mentioned

View Answer

Answer: b
Explanation: The adapter may hold a reference to the adapter and delegate must work to the adapter object is for object adapter pattern.




6 - Question

Which of the following is true for proxy pattern?
a) Has exactly the same interface as the real object
b) Handles routine or illegitimate messages without accessing the real object
c) Delegates messages that it cannot handle to the real object
d) All of the mentioned

View Answer

Answer: d
Explanation: All of the mentioned is true.




7 - Question

Which of the following is not followed by proxy pattern?
a) virtual proxies
b) remote proxies
c) access proxies
d) none of the mentioned

View Answer

Answer: d
Explanation: All are followed by proxy pattern.




8 - Question

What are stand-ins for objects not yet created are called?
a) virtual proxies
b) remote proxies
c) access proxies
d) none of the mentioned

View Answer

Answer: a
Explanation: Stand-ins for objects not yet created are called virtual proxies.




9 - Question

Which of the following is incorrect with respect to the proxy pattern?
a) The Proxy pattern should be used whenever the services directly provided by some object need to be managed or mediated in some way without changing the object’s interface
b) Virtual proxies can be used to delay the creation or loading of large and time-consuming objects to preserve space and ensure rapid responses to requests
c) Remote proxies can hide the fact that an object is not locally present,handling the communication necessary to access the remote real object
d) None of the mentioned

View Answer

Answer: d
Explanation: All of the mentioned are correct for proxy pattern.




10 - Question

Which of the following is consequence for proxy pattern?
a) The Proxy pattern makes it possible to defer expensive operations until they are necessary (virtual proxies)
b) Provides an elegant way to treat remote objects as if they were local (remote proxies)
c) Provides a mechanism for implementing supplier access restrictions (protection or access proxies)
d) All of the mentioned

View Answer

Answer: d
Explanation: All of the mentioned are correct consequence for proxy pattern.

Get weekly updates about new MCQs and other posts by joining 18000+ community of active learners