Virtue Infotek interview question

oops concepts sql query