Infosys interview question

Logic questions