Cognizant Interview Question

The main questions are on oops