Infosys interview question

basic question on c++ and java