Cognizant interview question

Two puzzles.