Engineering Questions with Answers - Multiple Choice Questions

MCQs on Software Design Pattern

1 - Question

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 - Question

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 - Question

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.




4 - Question

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 - Question

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.




6 - Question

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 - Question

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.




8 - Question

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 - Question

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.




10 - Question

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 - Question

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 - Question

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 - Question

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.

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