Tata interview question

Oops concept