Pergunta de entrevista da empresa STMicroelectronics

Why function switch runs fast then if then?