Yes Madam interview question

Sql query based on joins