🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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 →
  1. Q1. Which pattern ensures a class has only one instance?
  2. Q2. YouTube notifying all subscribers when a video is uploaded is an example of:
  3. Q3. Choosing a delivery-fee calculation (standard/express/free) at runtime is the:
  4. Q4. Why is a Singleton's constructor private?
  5. Q5. Factory, Singleton and Builder belong to which group?
  6. Q6. Why is the get() method of the lesson's AppConfig Singleton marked synchronized?
  7. Q7. What does this print? (code)
  8. Q8. paymentfactory("upi") returns a Upi object. What is the main benefit of this factory?
  9. Q9. Java I/O streams such as new BufferedReader(new FileReader(f)) add behaviour by wrapping. Which pattern is this?
  10. Q10. What is a common risk of overusing Singletons?