Cognizant interview question

some basic programming and logical questions