Cognizant interview question

Javascript Code and SQL queries