Pergunta de entrevista da empresa Infosys

Please explain the below code why it is not working