HCLTech interview question

Scripting interview was little difficult as I am bad in coding.