Domanda di colloquio di Accenture

Basic logic question (not programming related) followed by two explicit coding questions.