Pergunta de entrevista da empresa Cisco

Two logic design questions. Implementation of a module that does some task.