Infosys interview question

Design pattern