Cognizant interview question

Basic oops quetions