Pregunta de entrevista de Cognizant

random question on Java and SQL queries