This set of Software Design Interview Questions and Answers focuses on “The Prototype Pattern,Reactor Pattern and Command Pattern”.
1. Which of the following are true for prototype pattern?
a) A clone is a copy of an object
b) When values stored in an entity (including references) are reproduced in the copy, the copy operation is said to be shallow
c) In contrast, a copy operation is deep when copies are made of all referenced entities in the original composite, and references to the new entities are placed in the copy
d) All of the mentioned
View Answer
Explanation: All of the mentioned are true.
2. Any class using the built-in cloning mechanism is supposed to do which of the following?
a) Implement the Cloneable interface
b) Define a concrete public or protected clone() operation
c) In the clone() operation, obtain a new object by calling super.clone()
d) All of the mentioned
View Answer
Explanation: All of the mentioned are true.
3. Which of the following are correct for copy constructor?
a) A copy constructor is a constructor that takes an instance of its class as an argument and creates a clone of its argument
b) A copy constructor must be used when a final field must be set in creating the clone because only a constructor can set a final field
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: All of the mentioned are true.
4. Which of the following pattern has Step up phase as its activity?
a) Prototype pattern
b) Reactor Pattern
c) Command pattern
d) None of the mentioned
View Answer
Explanation: Reactor pattern has two phases-Step up phase and Operational Phase.
5. What happen in the operational phase of Reactor pattern?
a) The Client registers the Reactor with the Target
b) The Reactor responds to event notifications from the Target
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: The operational phase of Reactor pattern-The Reactor responds to event notifications from the Target.
6. The reactor patterns provide a good model for event-driven portions of a program for which of the following reasons?
a) Client and Target Decoupling
b) Client Decomposition
c) Operation Encapsulation
d) All of the mentioned
View Answer
Explanation: All of the mentioned are correct reasons.
7. Which of the following are consequences for command pattern?
a) Reactor patterns provide event-driven design models
b) They decouple clients and targets
c) Encapsulate reactions to event
d) None of the mentioned
View Answer
Explanation: All are the consequences for Reactor pattern.
8. Which among these are advantages for Function Class?
a) Additional features can be added to the function class, enhancing its capabilities
b) The function class can include other data and operations the encapsulated operation needs
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: All of the mentioned are advantages.
9. Which of the several aspects of the Command pattern may be varied or elaborated to help achieve particular design goals
a) An invoker may accept registration of more than one command
b) The invoker may offer operations for un-registering one or more commands
c) An invoker may offer several kinds of registrations for different kinds of events
d) All of the mentioned
View Answer
Explanation: All of the mentioned are the goals.
10. Which of the following are the consequences for Command pattern?
a) Event-driven design is facilitated
b) Making event-handling code easy to find, change, and reuse
c) The invoker is loosely coupled to both the command and client classes,making them easy to change
d) All of the mentioned
View Answer
Explanation: All of the mentioned are the consequences.
Sanfoundry Global Education & Learning Series – Software Architecture and Design.
- Get Free Certificate of Merit in Software Architecture and Design
- Participate in Software Architecture and Design Certification Contest
- Become a Top Ranker in Software Architecture and Design
- Take Software Architecture and Design Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Practice Computer Science MCQs
- Buy Software Architecture and Design Books
- Apply for Software Architecture and Design Internship
- Practice MCA MCQs
- Buy MCA Books