mediumMultiple ChoiceObjective-mapped
200-901 Practice Question: A Python script uses the `requests` library to…
A Python script uses the `requests` library to fetch device details from Cisco DNA Center. The API returns a JSON response with nested objects. To extract the management IP address from the response stored in variable `data`, which code snippet is correct? The JSON structure is:
{
"response": [
{
"managementIpAddress": "192.168.1.1",
"hostname": "router1"
}
]
}Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
data['response'][0]['managementIpAddress']
The response contains a list under key 'response'; correct access is via data['response'][0]['managementIpAddress'].
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
data.managementIpAddress
Why it's wrong here
This assumes attribute access; 'data' is a dict, not an object.
- ✗
data['response']['managementIpAddress']
Why it's wrong here
Misses the list index; 'response' is a list.
- ✗
data.get('response')[0].get('managementIpAddress')
Why it's wrong here
While syntactically valid, it is less direct and not the typical simple extraction.
- ✓
data['response'][0]['managementIpAddress']
Why this is correct
Correctly indexes into the list and retrieves the management IP.
Go deeper
Related to this question
About these practice questions
One of 989 original 200-901 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.