Question d’entretien chez Cognizant

Few puzzles to be coded in java.