Cognizant interview question

Mostly java and C++ based