Infosys interview question

Written test is little difficult