Infosys interview question

Basics only