

Prototype Design
Flashcard
•
Computers
•
University
•
Practice Problem
•
Hard
Wayground Content
FREE Resource
Student preview

9 questions
Show all answers
1.
FLASHCARD QUESTION
Front
What is the main purpose of the Prototype Pattern?
Back
To create objects by copying existing ones instead of using constructors.
2.
FLASHCARD QUESTION
Front
What method is used in Java to implement prototyping? Options: clone(), newInstance(), prototype(), Object.assign()
Back
clone()
3.
FLASHCARD QUESTION
Front
Which of the following is an advantage of using the Prototype Pattern? Reduces the need for subclassing, Improves performance by avoiding object recreation, Allows for dynamic object cloning, All of the above
Back
All of the above
4.
FLASHCARD QUESTION
Front
What is the key difference between shallow and deep copies?
Back
A shallow copy only copies primitive fields but not references.
5.
FLASHCARD QUESTION
Front
What happens if a class does not implement Cloneable and calls clone()?
Back
It throws a CloneNotSupportedException
6.
FLASHCARD QUESTION
Front
Which situation does not require the Prototype Pattern? Creating objects is expensive, Object structure is complex, Each object needs to be completely unique, We need to improve object creation performance
Back
Each object needs to be completely unique
7.
FLASHCARD QUESTION
Front
Why might using .clone() cause issues with nested objects?
Back
It performs a shallow copy by default.
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 Microsoft
or continue with
%20(1).png)
Apple
Others
Already have an account?