Cognizant Interview Question

Application of oops, sql joins, asked me to execute 2 queries