HCLTech interview question

Simple coding questions.