Skip to content

Design Patterns Practice Exam

Test yourself under real exam conditions: 50 timed questions, 60 on the clock, pass mark 70%%. Instant score with a full review of everything you got wrong. Free — no account needed.

📝 50 questions · ⏱ 60 minutes · 🎯 Pass mark 70% · 🆓 Free, no signup

Exam details

  • 50 questions drawn from 51 cards
  • Countdown timer — auto-submits when time runs out
  • Pass mark 70% (real certification threshold)
  • Full review of wrong answers at the end
  • No signup required — save your score with a free account

Sample Questions

5 shown

What are Design Patterns in software engineering?

Show ▼

Design patterns are reusable solutions to commonly occurring problems in software design. They were popularized by the Gang of Four (GoF) in their 1994 book. They are not code, but templates for solving problems that can be adapted to many situations.

Benefits:

  • Provide a shared vocabulary among developers
  • Promote proven, tested solutions
  • Improve code maintainability and flexibility

What are the three categories of GoF Design Patterns?

Show ▼

The three categories are:

  • Creational Patterns – Deal with object creation mechanisms (e.g., Singleton, Factory Method, Builder)
  • Structural Patterns – Deal with object composition and relationships (e.g., Adapter, Decorator, Facade)
  • Behavioral Patterns – Deal with communication between objects (e.g., Observer, Strategy, Command)

What is the Singleton pattern?

Show ▼

The Singleton pattern ensures a class has only one instance and provides a global point of access to it.

Key traits:

  • Private constructor
  • Static method to get the instance
  • Lazy or eager initialization
Example: public static Singleton getInstance() { if (instance == null) instance = new Singleton(); return instance; }

What are the drawbacks of the Singleton pattern?

Show ▼

Singleton drawbacks include:

  • Introduces global state, making code harder to test
  • Violates the Single Responsibility Principle (manages its own lifecycle)
  • Thread safety issues if not implemented carefully
  • Tight coupling to the Singleton class
  • Often considered an anti-pattern when overused

What is the Factory Method pattern?

Show ▼

The Factory Method defines an interface for creating objects but lets subclasses decide which class to instantiate.

abstract class Creator {
  abstract Product factoryMethod();
}


Benefits:

  • Follows the Open/Closed Principle
  • Decouples client code from concrete classes
  • Subclasses control instantiation

🎯 Take the Design Patterns Practice Exam