Pregunta de entrevista de Oracle

Gave two questions to write the code.