← Quiz: Design Patterns: all 10 questions
Quiz: Design Patterns · Question 3 of 10
A payment module must create a UPI, card or wallet object based on the user's choice, without if/else scattered everywh…
A payment module must create a UPI, card or wallet object based on the user's choice, without if/else scattered everywhere. Which pattern fits?
- A.Factory
- B.Observer
- C.Decorator
- D.Adapter
Answer & explanation
Correct answer: Factory
A factory centralises the decision of which class to create.
Can you get the rest right without peeking?
Take the timed Quiz: Design Patterns quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →