Pergunta de entrevista da empresa Simplicity Consulting

Code this for me and expalin why