
Creational Design Pattern
Authored by Kasmir Syariati
Computers
University
Used 6+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
22 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
30 sec • 2 pts
Which of the following creational design patterns shares the goal of hiding the object creation logic from the client code?
Factory
Builder
Prototype
Abstract Factory
Singleton
Answer explanation
Both Factory Method and Abstract Factory hide the object creation logic and provide an interface for clients to interact with the created objects.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When might you choose the Prototype pattern over the Factory Method pattern?
When you need to create complex objects with many configurable parts.
When you need to ensure only one instance of an object exists.
When you want to defer the decision of which object to create until runtime.
When you need a central registry to manage all created objects.
Answer explanation
Prototype excels at creating complex objects by cloning existing ones, while Factory Method focuses on creating new objects based on a type.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The Factory Method pattern often relies on inheritance to differentiate between object types. Can the Builder pattern also leverage inheritance for similar purposes?
No, Builder uses composition to define object structures.
Yes, Builder subclasses can define specific construction steps for different object types.
Builder relies solely on interfaces to define object creation logic.
Both inheritance and composition are commonly used in Builder.
Answer explanation
Builder uses composition with different builder methods to define object structures, not inheritance.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Imagine a system where you need to create different shapes (Square, Circle) based on user input. Which creational pattern would be most suitable, considering the Factory Method?
Singleton
Abstract Factory
Prototype
Builder
Answer explanation
Abstract Factory allows creating families of related objects (like shapes) based on a user choice.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The Factory Method class typically defines a method to create objects. Can the Singleton pattern also define a similar method for controlled access to its single instance?
No, Singleton relies on a static field for access, not a method.
Yes, the Singleton class can have a getInstance() method for controlled access.
Singleton uses a factory class to delegate object creation.
Both Factory Method and Singleton hide the object creation logic completely.
Answer explanation
Singleton often defines a getInstance() method to provide controlled access to its single instance.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When using the Factory Method pattern, the client code interacts with the created objects through an interface. Does the Builder pattern also enforce this concept?
No, Builder clients directly interact with concrete builder classes.
Yes, Builder provides an interface to define the object structure, which clients use.
Factory Method allows concrete classes to be returned, while Builder always returns interfaces.
Both patterns hide the implementation details of the created objects.
Answer explanation
Builder defines an interface for object construction, similar to Factory Method using interfaces for created objects.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Compared to the Factory Method, the Abstract Factory pattern introduces an additional layer of abstraction. What benefit does this extra layer provide?
It simplifies the creation of complex objects with many parts.
It allows creating families of related objects based on a type.
It reduces the number of concrete factory classes required.
It enforces code reusability for object creation logic.
Answer explanation
Abstract Factory provides a central location to define families of related objects, promoting code reuse and flexibility.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
20 questions
Review Quiz (Chapter 3&4)
Quiz
•
University
20 questions
Software Processes
Quiz
•
University
20 questions
Telecommunications
Quiz
•
University
19 questions
SDLC
Quiz
•
University
20 questions
PhotoShop Test Review
Quiz
•
9th Grade - University
20 questions
QUIZ DASAR DASAR PEMROGRAMAN JAVA
Quiz
•
11th Grade - University
18 questions
Java thread - MCQ
Quiz
•
University
20 questions
Deep Learning Quiz 2
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade