D. Adapter calls a non-existent method 'request' instead of 'oldRequest'
Solution
Step 1: Check method calls in Adapter
Adapter calls this.oldSystem.request(), but OldSystem has only oldRequest() method.
Step 2: Identify the mismatch
The Adapter should call oldRequest() to adapt it to request().
Final Answer:
Adapter calls a non-existent method 'request' instead of 'oldRequest' -> Option D
Quick Check:
Method name mismatch in Adapter [OK]
Hint: Check method names carefully in Adapter calls [OK]
Common Mistakes:
Assuming inheritance is required in Adapter
Thinking OldSystem should be empty
Ignoring method name differences
5. You need to design a system where multiple objects form a tree structure and clients treat individual objects and compositions uniformly. Which structural pattern best organizes this relationship?
hard
A. Composite pattern
B. Facade pattern
C. Proxy pattern
D. Bridge pattern
Solution
Step 1: Understand the problem requirements
The system needs to treat individual objects and groups (tree structure) uniformly.
Step 2: Match with structural patterns
The Composite pattern allows composing objects into tree structures and clients treat them the same.
Step 3: Eliminate other options
Facade simplifies interfaces, Proxy controls access, Bridge separates abstraction from implementation; none fit the tree structure need.
Final Answer:
Composite pattern -> Option A
Quick Check:
Tree structure uniform treatment = Composite [OK]
Hint: Composite handles tree structures uniformly [OK]
Common Mistakes:
Confusing Facade with Composite
Choosing Proxy for access control only
Mixing Bridge with structural composition
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.