Infosys interview question

Program writing and basic oops