Skip to content
Sharp

Design patterns · interview question

Which design pattern would you use to allow a payment processor to select between different validation checks dynamically?

Multiple choiceMediumchapter-13-curatedpremiumdesign-patternsstrategy-pattern
Choose one answer
Answer and explanation

Correct answer

A. Strategy Pattern

Why

The Strategy Pattern is ideal for selecting between different validation checks dynamically, as it allows each validation algorithm to be encapsulated in its own class and chosen at runtime.

Test yourself on Design patterns

A free test with instant, explained results. No account needed.

Start free test
All Design patterns questions →