Tech Mahindra interview question

oops concept