Pregunta de entrevista de Cognizant

Basic programming and probability questions