Structural Design Patterns Quiz

Q1. Which pattern allows incompatible interfaces to work together?




Q2. Which structural pattern decouples an abstraction from its implementation, allowing the two to vary independently?




Q3. Which pattern composes objects into tree structures so that clients can treat individual objects and compositions uniformly (i.e., as part-whole hierarchies)?




Q4. Which pattern attaches additional responsibilities to an object dynamically without altering its class?




Q5. Which pattern provides a unified interface to a complex subsystem, making it easier for clients to access its functionality?




Q6. Which pattern uses sharing to support large numbers of fine-grained objects efficiently by keeping their common state in one place?




Q7. Which pattern provides a surrogate or placeholder for another object to control access to it?




Q8. Your project needs to integrate a third-party library that expects data in a different format than your system produces. Which pattern should you use to reconcile these differences?




Q9. You are designing a drawing application that must support multiple rendering engines for various shapes. Which structural pattern allows you to independently vary the shape abstractions and the rendering implementations?




Q10. In a GUI framework, you have a Window component. You want to add features like scroll bars or borders to specific Window instances at runtime without modifying the Window class. Which pattern is most suitable?




Q11. A certain subsystem in your application is very complex. You decide to create a class that encapsulates the entire subsystem’s workflow and provides one simple method process() for client code. Which pattern does this describe?




Q12. In an image viewer, loading high-resolution images is slow. You want to load an image only when it’s scrolled into view while the rest of the code uses an Image interface transparently. Which pattern would you apply?




Q13. A text editor must handle thousands of character objects, many identical in font and style. Which pattern helps reduce memory usage?




Q14. The Decorator and Proxy patterns both wrap another object and implement the same interface. Which statement correctly distinguishes their intents?




Q15. One drawback of the Decorator pattern is that:




Q16. What is a potential disadvantage of using the Flyweight pattern?




Q17. When applying the Composite pattern, a design challenge is that:




Q18. A graphics editing application allows grouping shapes, dynamically adding scrollbars or borders, and deferring loading of detailed images until needed. Which set of structural patterns is being used (in order)?




Q19. What happens if you apply the Bridge pattern where an abstraction has only one fixed implementation?




Q20. A potential drawback of using the Facade pattern is that:




design-patterns