PCPP Python Design Patterns Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Thames
T
Thames
Community Contributor
Quizzes Created: 11982 | Total Attempts: 187,298
| Attempts: 11 | Questions: 20 | Updated: Aug 17, 2026
Please wait...
Question 1 / 21
🏆 Rank #-- ▾
0 %
0/100
Score 0/100

1. In Python, the ____ pattern is often implemented using the @property decorator.

Explanation

The Decorator pattern adds behavior to an existing function or object without changing how it is used. In Python, `@property` decorates a method so it can be accessed like an attribute, while allowing logic such as validation or computed values to be added behind that interface.

Submit
Please wait...
About This Quiz
PCPP Python Design Patterns Quiz - Quiz

This quiz evaluates your understanding of design patterns in Python, a core topic for the PCPP certification. You'll test your knowledge of creational, structural, and behavioral patterns, their implementations, and when to apply them in real-world scenarios. Master these patterns to write more maintainable, scalable Python code.

2.

What first name or nickname would you like us to use?

You may optionally provide this to label your report, leaderboard, or certificate.

2. Which pattern allows an object to alter its behavior when its internal state changes?

Explanation

The State pattern lets an object change its behavior based on its current internal state. It represents each state as a separate object, moving state-specific behavior out of the main object and avoiding large conditional statements. When the object’s state changes, its behavior changes accordingly.

Submit

3. The Memento pattern is used to capture and externalize an object's internal state without violating encapsulation. True or False?

Explanation

The Memento pattern lets an object save a snapshot of its state in a separate memento and later restore it. The memento exposes little or none of the object’s internal details to other objects, so state can be preserved and recovered without breaking encapsulation. It is commonly used to support undo or rollback operations.

Submit

4. What is the primary purpose of the Bridge pattern?

Explanation

The Bridge pattern separates an abstraction from its implementation so both can vary independently. This reduces tight coupling and makes it easier to extend or change either side without affecting the other.

Submit

5. The Proxy pattern is used to provide a surrogate or placeholder for another object. True or False?

Explanation

True. The Proxy pattern creates a stand-in object that controls access to another object. It can handle tasks such as delaying object creation, enforcing access permissions, or adding logging, while presenting an interface similar to the real object.

Submit

6. Which pattern provides a way to access elements of a collection sequentially without exposing its underlying representation?

Explanation

The Iterator pattern separates traversal from a collection’s internal structure. It provides a standard interface for requesting elements one at a time, allowing clients to move through items sequentially without knowing how the collection stores them. This supports consistent iteration across different collection types and encapsulates traversal logic and state.

Submit

7. The ____ pattern encapsulates a request as an object, allowing parameterization and queueing of requests.

Explanation

The Command pattern turns a request into a standalone object that contains the operation and its parameters. This lets systems pass, store, queue, or log requests without needing to know how they are executed, and makes it easier to support features such as undo and redo.

Submit

8. What does the Composite pattern allow you to do?

Explanation

The Composite pattern lets clients treat individual objects and groups of objects uniformly. By arranging objects in a tree, it represents part-whole hierarchies—for example, treating a folder and its files through the same interface.

Submit

9. The Chain of Responsibility pattern is a behavioral pattern. True or False?

Explanation

The Chain of Responsibility pattern is behavioral because it defines how requests pass through a sequence of handlers. Each handler can process a request or forward it to the next handler, keeping the sender independent of which handler ultimately responds.

Submit

10. Which creational pattern creates objects by copying an existing object rather than creating from scratch?

Explanation

The Prototype pattern creates new objects by cloning an existing instance. This is useful when constructing an object from scratch is costly or complex, or when the desired object’s configuration can be copied from a prototype. It differs from factory patterns, which create objects through methods or factory classes.

Submit

11. Which design pattern restricts a class to have only one instance and provides a global point of access to it?

Explanation

The Singleton pattern ensures that a class has only one instance and provides a shared, globally accessible way to retrieve it. This is useful when a single coordinated instance—such as a configuration manager or logger—is needed throughout an application.

Submit

12. What is the main goal of the Template Method pattern?

Explanation

The Template Method pattern defines an algorithm’s overall structure in a base class, while allowing subclasses to customize specific steps without changing that structure.

Submit

13. The Facade pattern provides a unified, simplified interface to a set of interfaces in a subsystem. True or False?

Explanation

True. The Facade pattern offers a single, straightforward interface that hides the complexity of a subsystem’s multiple interfaces, making it easier for clients to use.

Submit

14. Which pattern defines a one-to-many dependency where when one object changes state, all dependents are notified automatically?

Explanation

The Observer pattern establishes a one-to-many relationship between a subject and its dependents. When the subject’s state changes, it automatically notifies its observers, allowing them to update accordingly without tight coupling.

Submit

15. The Builder pattern is primarily used to construct complex objects step by step. True or False?

Explanation

True. The Builder pattern creates complex objects through a sequence of steps, separating the construction process from the object’s final representation and allowing different configurations.

Submit

16. What does the Strategy pattern allow you to do?

Explanation

The Strategy pattern encapsulates a family of algorithms behind a common interface, allowing them to be selected or swapped at runtime without changing the code that uses them.

Submit

17. The Adapter pattern converts the interface of one class into another that clients expect. True or False?

Explanation

The Adapter pattern acts as a bridge between incompatible interfaces. It wraps an existing class and translates its methods or data into the format expected by clients, allowing them to work together without changing the original class.

Submit

18. Which pattern is used to add new functionality to objects dynamically without altering their structure?

Explanation

The Decorator pattern adds functionality to an object dynamically by wrapping it in another object that provides additional behavior. This lets you extend an object’s capabilities without changing its original structure or affecting other objects of the same type.

Submit

19. In the Observer pattern, what are the two main roles?

Explanation

The Subject maintains state and notifies registered Observers when that state changes. Observers receive these updates, allowing objects to stay synchronized without tightly coupling the Subject to each observer’s behavior.

Submit

20. What is the primary purpose of the Factory pattern?

Explanation

The Factory pattern centralizes object creation, allowing code to request an object without knowing which concrete class will be instantiated. This reduces dependency on specific implementations and makes it easier to change or extend the types of objects created.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (20)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
In Python, the ____ pattern is often implemented using the @property...
Which pattern allows an object to alter its behavior when its internal...
The Memento pattern is used to capture and externalize an object's...
What is the primary purpose of the Bridge pattern?
The Proxy pattern is used to provide a surrogate or placeholder for...
Which pattern provides a way to access elements of a collection...
The ____ pattern encapsulates a request as an object, allowing...
What does the Composite pattern allow you to do?
The Chain of Responsibility pattern is a behavioral pattern. True or...
Which creational pattern creates objects by copying an existing object...
Which design pattern restricts a class to have only one instance and...
What is the main goal of the Template Method pattern?
The Facade pattern provides a unified, simplified interface to a set...
Which pattern defines a one-to-many dependency where when one object...
The Builder pattern is primarily used to construct complex objects...
What does the Strategy pattern allow you to do?
The Adapter pattern converts the interface of one class into another...
Which pattern is used to add new functionality to objects dynamically...
In the Observer pattern, what are the two main roles?
What is the primary purpose of the Factory pattern?
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!