Pergunta de entrevista da empresa G2i

Coming coding questions, asked to identify errors and rectify.