Infosys interview question

based on java and sql