CS FundamentalsHardProduct-company placement
A rules engine must evaluate business rules such as (age > 18 AND country = 'IN') OR isVip from a small fixed grammar, using one class per grammar rule (And, Or, Comparison, Variable) and a method evaluate(context) on each. Which design pattern is this?
- A. Interpreter
- B. Chain of Responsibility
- C. Strategy
- D. Command
Correct answer: A. Interpreter
Interpreter represents each grammar rule as a class and evaluates a sentence by recursively evaluating its syntax tree, which is structured as a Composite. Chain of Responsibility passes a request along handlers, not through a parse tree.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- Match each module with its type of cohesion. P: computes the mean, maximum and histogram of the same input array. Q: performs one of…
- A media player has states Stopped, Playing and Paused and events play, pause and stop. Valid transitions: Stopped–play→Playing…
- A UML class diagram says each Course has 1..3 Instructors and each Instructor teaches 0..4 Courses (many-to-many). Which configuration is…
- A company split its monolith into 12 microservices, but every release still needs all 12 deployed together in a fixed order, and several…
- A gRPC API's Protocol Buffers message had field 'int32 discount = 4', which was deleted last year. A developer now adds 'string coupon =…
- For monitoring, which pairing of method and what it tracks is correct?