Cognizant interview question

Simple Oops concept and basic programming