Accenture Interview Question

Sql queries for CTE