Bird
Raised Fist0

Which of the following problems CANNOT be effectively solved using the Command Pattern with undo/redo, request queuing, and logging?

easy🔍 Pattern Recognition Q2 of Q15
OOP & Design Patterns - Command Pattern - Undo/Redo, Request Queuing & Logging
Which of the following problems CANNOT be effectively solved using the Command Pattern with undo/redo, request queuing, and logging?
ABatch processing of user commands with logging
BDynamically switching between different sorting algorithms at runtime
CDecoupling UI actions from business logic execution
DImplementing undo/redo functionality in a text editor
Step-by-Step Solution
Solution:
  1. Step 1: Analyze each problem's requirements

    Undo/redo, batching, and decoupling fit Command Pattern well.
  2. Step 2: Identify problem not suited for Command Pattern

    Dynamic algorithm switching is Strategy Pattern's domain, not Command Pattern.
  3. Final Answer:

    Option B -> Option B
  4. Quick Check:

    Command Pattern encapsulates commands, not algorithm selection [OK]
Quick Trick: Command Pattern does not switch algorithms dynamically [OK]
Common Mistakes:
MISTAKES
  • Confusing Command with Strategy for algorithm changes
Trap Explanation:
PITFALL
  • Candidates often think Command Pattern handles algorithm switching, but it only encapsulates requests, not behavior changes.
Interviewer Note:
CONTEXT
  • Tests anti-pattern recognition and pattern boundaries
Master "Command Pattern - Undo/Redo, Request Queuing & Logging" in OOP & Design Patterns

2 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More OOP & Design Patterns Quizzes