Infosys interview question

Please explain the below code why it is not working