@Hemant Javeri - you must follow the task instructions as stated in the exam. The instructions will clearly state the filename that you are supposed to save your query or code in. For example, task #3 might tell you to save your Hive query in a text file named /home/horton/solutions/task3 on the local filesystem.
We do not care how you write or execute the script - you can use the Hive shell, Hive View in Ambari, write the query in a text editor using vi or gedit, etc. But you must run the script, it must generate the desired output, and you must save the query or code in the specified text file.