Tech Mahindra interview question

Palindrome,OOPS concepts.