Infosys interview question

Query on join