Pergunta de entrevista da empresa Virtusa

Question on Collections in Java and some SQL query.