Cognizant interview question

Basic programming and probability questions