← All topics
Quiz: Design Patterns: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. Which group does the Observer pattern belong to?
- Q2. What does this print? (code)
- Q3. A payment module must create a UPI, card or wallet object based on the user's choice, without if/else scattered everywhere. Which pattern f…
- Q4. Your code expects send(phone, text) but a vendor library offers pushmessage(payload). Which pattern connects them?
- Q5. What does this print? (code)
- Q6. What is the key difference between Adapter and Decorator?
- Q7. A food app should sort restaurants by distance, rating or delivery time, chosen by the user at run time. Which pattern fits best?
- Q8. Which is a real drawback of the Singleton pattern?
- Q9. What does this print? (code)
- Q10. An object has many optional fields, and a constructor with ten parameters is hard to read. Which pattern helps?