🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Design Patterns: all 10 questions

Quiz: Design Patterns · Question 7 of 10

A food app should sort restaurants by distance, rating or delivery time, chosen by the user at run time. Which pattern…

A food app should sort restaurants by distance, rating or delivery time, chosen by the user at run time. Which pattern fits best?

  1. A.Singleton
  2. B.Adapter
  3. C.Builder
  4. D.Strategy
Answer & explanation

Correct answer: Strategy

Each sorting rule is a strategy with the same interface; the user's choice picks one.

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 →