Cognizant Interview Question

SQL queries, Pattern printing and reverse the string