Tech Mahindra interview question

Oops concepts