โ† All CPP Flashcard Decks

Design Patterns & Architecture Flashcards

7 cards from real CPP practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Design Patterns & Architecture flashcards as text
  1. In the Abstract Factory pattern, what does the factory produce?

    Answer: Families of related or dependent objects without specifying concrete classes

    Abstract Factory creates families of related products ensuring compatible objects are used together without coupling to concrete classes.

  2. Which C++ idiom most directly implements the RAII (Resource Acquisition Is Initialization) principle?

    Answer: Destructor-based resource management

    RAII ties resource lifetime to object lifetime using constructors for acquisition and destructors for release, ensuring cleanup even on exceptions.

  3. In a Layered Architecture, which layer is responsible for business logic?

    Answer: Domain/Business Logic layer

    The Domain or Business Logic layer encapsulates rules and workflows that define the core behavior of the application.

  4. What is the key difference between the Proxy and Decorator patterns?

    Answer: Proxy controls access to the subject; Decorator adds responsibilities dynamically

    Proxy manages access (lazy init, security, remote access) while Decorator transparently adds or extends behavior without changing access semantics.

  5. Which pattern provides a simplified interface to a complex subsystem?

    Answer: Facade

    The Facade pattern provides a high-level, unified interface that hides the complexity of subsystem interactions from clients.

  6. In the Builder pattern, what is the role of the Director class?

    Answer: It orchestrates the construction steps using a builder

    The Director defines the order of construction steps, delegating actual building to the concrete builder without knowing the product's internal structure.

  7. Which pattern is typically used to implement event-driven systems where objects need to be notified of state changes?

    Answer: Observer

    The Observer pattern defines a one-to-many dependency so that when one object changes state, all dependents are notified automatically.

Design Patterns & Architecture Flashcards โ€” CPP Study Cards with Answers