← 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 pattern ensures a class has only one instance?
- Q2. YouTube notifying all subscribers when a video is uploaded is an example of:
- Q3. Choosing a delivery-fee calculation (standard/express/free) at runtime is the:
- Q4. Why is a Singleton's constructor private?
- Q5. Factory, Singleton and Builder belong to which group?
- Q6. Why is the get() method of the lesson's AppConfig Singleton marked synchronized?
- Q7. What does this print? (code)
- Q8. paymentfactory("upi") returns a Upi object. What is the main benefit of this factory?
- Q9. Java I/O streams such as new BufferedReader(new FileReader(f)) add behaviour by wrapping. Which pattern is this?
- Q10. What is a common risk of overusing Singletons?