Infosys interview question

Basic OOP and