Cognizant Interview Question

Basics to tricky questions in java