Postman Interview Questions and Answers
Question - 101 : - What is the significance of 301 status code?
Answer - 101 : -
301 status code represents permanent redirect from one website page to another. It tells the search engine that the old page is outdated and the engine has to index the new page URL.
Question - 102 : - Why is Base64 encoding primarily used in Postman?
Answer - 102 : -
Base64 encoding is primarily used because it does the task of data transmission in a textual format that is easier to be sent in the requests in HTML form statistics format. Another reason why we use this is that using identical 64 characters for encoding is heavily reliable in any language we use.
Question - 103 : - What is the purpose of the 304 status code?
Answer - 103 : -
304 status code stands for NOT MODIFIED. This is used for diminishing the bandwidth of the network in cases of restricted GET requests. In such cases, the response body should be empty or blank and the headers should have a date, location, signature etc.
Question - 104 : - Is it preferable to save our work on Postman Cloud?
Answer - 104 : -
When working on enterprise-level applications for organizations, it is not preferred to store our work on the Postman cloud because of the required privacy and security. In the Postman cloud, there are chances of security breaches by a skilled hacker.
Question - 105 : - What do you understand by the pre-request script?
Answer - 105 : -
Pre-request scripts are those scripts that are used for executing Javascript code before a request is run. It is used for performing pre-processing tasks like setting variables, parameters, headers, body data, etc.
Question - 106 : - If we have a global and a local variable of the same name, which one will be given the most preference in Postman?
Answer - 106 : -
In such cases, the higher precedence is given to the local variable by overwriting the value of the global variable.
Question - 107 : - Does Postman allow flexibility to make use of the command-line?
Answer - 107 : -
Postman provides a command-line tool called Newman using which we can run any Postman collection. It is a NodeJS based package that requires a node environment for executing collections using Newman Collection Runner. It has full parity with Postman’s Collection Runner i.e it provides support for running assertions, pre-request scripts, or other request scripts linked with the requests that belong to the collection.
We can use Newman by following the below steps:
- Install Node
- Install Newman package using npm command as: npm install -g newman
- To run the collection, first export the environment to JSON format in Postman. Then run the below command for running the collection in Newman:
newman run {{path to collection json}} -e {{path to environment json}}
Question - 108 : - How will you generate random numbers of a given range in Postman?
Answer - 108 : -
Suppose you want to generate numbers between the range 1 to N, then it can be done in the pre-request script as follows:
pm.globals.set('randomNumber', Math.floor(Math.random() * N));
We can then use this variable in the URL as:{{randomNumber}}
Question - 109 : - What do you understand by Scratch Pad?
Answer - 109 : -
Scratch Pad is a space provided by Postman that helps us to work without being connected to Postman servers. It provides the flexibility of utilizing some of the features of postman offline. The features include- collection creation, creating requests and the ability to send requests. These are stored locally and once logged in, the work is saved into the workspace.