Software Engineering Questions and Answers – Software Design Pattern

This set of Software Engineering Multiple Choice Questions & Answers (MCQs) focuses on “Software Design Pattern”.

1. Which mechanism is applied to use a design pattern in an OO system?
a) Inheritance
b) Composition
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: c
Explanation: Using inheritance, an existing design pattern becomes a template for a new subclass.Composition is a concept that leads to aggregate objects.

2. Design patterns does not follow the concept of software reuse.
a) True
b) False
View Answer

Answer: b
Explanation: Design patterns allow the designer to create the system architecture by integrating reusable components.

3. The use of design patterns for the development of object-oriented software has important implications for
a) Component-based software engineering
b) Reusability in general
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: c
Explanation: None.
advertisement
advertisement

4. Which of the following is a design pattern?
a) Behavioral
b) Structural
c) Abstract Factory
d) All of the mentioned
View Answer

Answer: d
Explanation: All the options are design patterns so option d.

5. You want to minimize development cost by reusing methods? Which design pattern would you choose?
a) Adapter Pattern
b) Singleton Pattern
c) Delegation pattern
d) Immutable Pattern
View Answer

Answer: c
Explanation: The delegation pattern is a design pattern in OOP where an object, instead of performing one of its stated tasks, delegates that task to an associated helper object.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. You want to avoid multiple inheritance. Which design pattern would you choose?
a) Abstraction-Occurrence Pattern
b) Player-Role Pattern
c) General Hierarchy Pattern
d) Singleton Pattern
View Answer

Answer: b
Explanation: The answer is self-explanatory.

7. The recurring aspects of designs are called design
a) patterns
b) documents
c) structures
d) methods
View Answer

Answer: a
Explanation: A pattern is the outline of a reusable solution to a general problem encountered in a particular context.
advertisement

8. Design pattern is a solution to a problem that occurs repeatedly in a variety of contexts.
a) True
b) False
View Answer

Answer: a
Explanation: Each design pattern has a name and use of each pattern has consequences.

9. Which pattern prevents one from creating more than one instance of a variable?
a) Factory Method
b) Singleton
c) Observer
d) None of the mentioned
View Answer

Answer: b
Explanation: In singleton pattern, the class itself is made responsible for keeping track of its instance.Thus it ensures that no more than one instance is created.
advertisement

10. Facade pattern promotes weak coupling between subsystem and its clients.
a) True
b) False
View Answer

Answer: a
Explanation: It is one of the patterns benefit.The facade pattern shields clients from subsystem classes and reduces the number of objects that clients deal with.

11. Which design pattern defines one-to-many dependency among objects?
a) Singleton pattern
b) Facade Pattern
c) Observer pattern
d) Factory method pattern
View Answer

Answer: c
Explanation: Observer pattern defines one-to-many dependency among objects so that when one object changes its state, all its dependents are notified.

12. Facade pattern couples a subsystem from its clients.
a) True
b) False
View Answer

Answer: b
Explanation: A facade can be a single entry point to each subsystem level. It decouples the subsystem.

13. In factory method pattern, the framework must instantiate classes but it only knows about the abstract classes, which it cannot initiate. How would one solve this problem?
a) encapsulating the knowledge of which document subclass to is to be created and
b) moving this knowledge out of the framework
c) instantiating the application specific documents without knowing their class
d) all of the mentioned
View Answer

Answer: d
Explanation: Following all the options in order will solve the factory method problem.

Sanfoundry Global Education & Learning Series – Software Engineering.

Here’s the list of Best Books in Software Engineering.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.