Collection variables are values stored at the collection level in Postman. They can be used across all requests within that collection to keep data consistent and reusable.
Click to reveal answer
intermediate
How do Collection variables differ from Environment variables in Postman?
Collection variables are specific to a collection and only available within it, while Environment variables are specific to an environment and can be used across multiple collections.
Click to reveal answer
beginner
How can you set a Collection variable in Postman?
You can set a Collection variable by opening the collection, going to the Variables tab, and adding a new variable name and value. You can also set it programmatically using scripts with pm.collectionVariables.set('variableName', 'value').
Click to reveal answer
intermediate
What happens if a variable name exists in both Collection and Environment variables?
Postman uses variable resolution priority. Collection variables override Environment variables if they share the same name when used inside that collection.
Click to reveal answer
beginner
Can Collection variables be used in pre-request scripts and tests?
Yes, Collection variables can be accessed and modified in pre-request scripts and test scripts using pm.collectionVariables.get('variableName') and pm.collectionVariables.set('variableName', 'value').
Click to reveal answer
Where are Collection variables stored in Postman?
AIn the Postman app settings
BGlobally across all environments
CInside a specific collection
DOnly in the current request
✗ Incorrect
Collection variables are stored inside a specific collection and are accessible only within that collection.
Which method sets a Collection variable in a Postman script?
Apm.environment.set()
Bpm.collectionVariables.set()
Cpm.globals.set()
Dpm.request.set()
✗ Incorrect
pm.collectionVariables.set() is used to set Collection variables programmatically.
If a variable exists in both Collection and Environment variables, which one is used inside the collection?
ACollection variable
BGlobal variable
CEnvironment variable
DRandomly chosen
✗ Incorrect
Collection variables have higher priority and override Environment variables inside the collection.
Can Collection variables be used in test scripts?
ANo, only Environment variables can be used
BOnly if exported first
COnly in pre-request scripts
DYes, using pm.collectionVariables.get()
✗ Incorrect
Collection variables can be accessed in test scripts using pm.collectionVariables.get().
How do you add a new Collection variable in the Postman app?
AIn the Collection's Variables tab
BIn the Environment quick look panel
CIn the Global variables tab
DIn the request headers
✗ Incorrect
New Collection variables are added in the Variables tab of the specific collection.
Explain what Collection variables are and how they help in managing data in Postman collections.
Think about how you keep common data like API keys or URLs consistent in a group of requests.
You got /4 concepts.
Describe the priority order Postman uses when resolving variables if the same name exists in Collection and Environment variables.
Consider which variable Postman picks first when two variables share the same name.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of collection variables in Postman?
easy
A. To store reusable values accessible by all requests in a collection
B. To store environment-specific URLs only
C. To save responses from API calls automatically
D. To create user interface themes in Postman
Solution
Step 1: Understand what collection variables do
Collection variables hold values that can be reused across all requests in a collection, making tests easier to manage.
Step 2: Compare options with this purpose
Only To store reusable values accessible by all requests in a collection describes storing reusable values for all requests, which matches the purpose of collection variables.
Final Answer:
To store reusable values accessible by all requests in a collection -> Option A
Quick Check:
Collection variables = reusable values [OK]
Hint: Remember: collection variables share values across all collection requests [OK]
Common Mistakes:
Confusing collection variables with environment variables
Thinking collection variables store API responses
Assuming collection variables control UI settings
2. Which syntax correctly uses a collection variable named api_key inside a request URL in Postman?
easy
A. https://api.example.com/data?key=api_key
B. https://api.example.com/data?key=[api_key]
C. https://api.example.com/data?key=$api_key
D. https://api.example.com/data?key={{api_key}}
Solution
Step 1: Recall Postman variable syntax
Postman uses double curly braces {{variable_name}} to insert variables into requests.
Step 2: Match syntax with options
Only https://api.example.com/data?key={{api_key}} uses {{api_key}}, which is the correct way to reference a collection variable.
Final Answer:
https://api.example.com/data?key={{api_key}} -> Option D
Quick Check:
Variable syntax = {{variable_name}} [OK]
Hint: Use double curly braces {{}} to insert variables in Postman [OK]
Common Mistakes:
Using plain variable name without braces
Using square brackets or dollar sign instead of {{}}
Confusing environment and collection variable syntax
3. Given a collection variable base_url set to https://api.test.com, what will be the full URL for this request?
GET {{base_url}}/users
medium
A. GET https://api.test.com/users
B. GET {{base_url}}/users
C. GET https://api.test.com{{base_url}}/users
D. GET /users
Solution
Step 1: Substitute the collection variable
The variable {{base_url}} is replaced by its value https://api.test.com in the request URL.
Step 2: Combine the parts of the URL
After substitution, the URL becomes https://api.test.com/users as the path /users is appended.
Final Answer:
GET https://api.test.com/users -> Option A
Quick Check:
Variable replaced by value = full URL [OK]
Hint: Replace {{variable}} with its value to get the full URL [OK]
Common Mistakes:
Not replacing the variable and leaving {{base_url}} as is
Appending variable value incorrectly
Ignoring the path after the variable
4. You set a collection variable token but your request still sends Authorization: Bearer {{token}} literally without replacing it. What is the likely cause?
medium
A. You used single curly braces instead of double
B. The collection variable token was not saved properly
C. Postman does not support collection variables in headers
D. The variable name is case-insensitive and mismatched
Solution
Step 1: Understand variable replacement behavior
If Postman sends {{token}} literally, it means the variable was not found or set correctly.
Step 2: Identify common causes
Most often, the variable was not saved or defined in the collection variables, so Postman cannot replace it.
Final Answer:
The collection variable token was not saved properly -> Option B
Quick Check:
Missing variable value = no replacement [OK]
Hint: Check if collection variable is saved before using it [OK]
Common Mistakes:
Assuming single braces work for variables
Thinking headers can't use variables
Ignoring case sensitivity issues
5. You want to use a collection variable user_id in a request body JSON like this:
{ "id": "{{user_id}}", "action": "delete" }
But the API expects id as a number, not a string. How should you fix the request body to send user_id as a number?
hard
A. { "id": "{{user_id}}", "action": "delete" }
B. { "id": '${{user_id}}', "action": "delete" }
C. { "id": {{user_id}}, "action": "delete" }
D. { "id": [{{user_id}}], "action": "delete" }
Solution
Step 1: Understand JSON data types
In JSON, numbers should not be inside quotes; quotes make them strings.
Step 2: Adjust variable usage in JSON
Remove quotes around {{user_id}} so Postman inserts the number directly, matching API expectation.
Final Answer:
{ "id": {{user_id}}, "action": "delete" } -> Option C
Quick Check:
Numbers in JSON = no quotes [OK]
Hint: Remove quotes around {{variable}} to send numbers, not strings [OK]
Common Mistakes:
Keeping quotes around numeric variables
Using wrong variable syntax with $ or []
Sending arrays instead of single values
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.