Pergunta de entrevista da empresa Microsoft

Simple logic questions, very interesting. Only made it to the first interview.