mediumMultiple Choice
350-401 Practice Question: An engineer retrieves telemetry data from a Cisco…
An engineer retrieves telemetry data from a Cisco IOS-XE device using RESTCONF and receives the following response:
```json
{"ietf-interfaces:interfaces": {
"interface": [
{
"name": "GigabitEthernet1",
"type": "iana-if-type:ethernetCsmacd",
"enabled": true,
"ipv4": {
"address": [
{
"ip": "192.168.1.1",
"netmask": "255.255.255.0"
}
]
}
}
]
}
}```
What is the correct way to access the IP address of the interface using Python?
⚠ Common exam trap
The trap is forgetting that YANG list nodes become Python lists requiring [0] indexing and that the top-level key includes the module prefix, causing candidates to omit either the prefix or the list index.
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['ietf-interfaces:interfaces']['interface'][0]['ipv4']['address'][0]['ip']
The JSON response nests the interface data under the top-level key 'ietf-interfaces:interfaces', then under 'interface' (a list), then indexes the first element, then accesses 'ipv4', then 'address' (a list), then indexes the first element, then accesses 'ip'. The correct path must include the module-prefixed top-level key, the list indexing on 'interface', and the list indexing on 'address'.
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['ietf-interfaces:interfaces']['interface'][0]['ipv4']['address'][0]['ip']
Why this is correct
RESTCONF returns the JSON exactly as structured by the YANG module, so the top-level key retains its module prefix. Indexing the interface list, then the ipv4 address list, reaches the ip leaf, matching the nested hierarchy shown in the response.
- ✗
data['interface'][0]['ipv4']['address']['ip']
Why it's wrong here
The top-level key is 'ietf-interfaces:interfaces', not 'interface', so this lookup raises a KeyError before reaching the list. It is tempting because 'interface' is the YANG container name, and would be correct if the JSON were normalised to strip the module prefix and promote the list to the root.
- ✗
data['interfaces']['interface']['ipv4']['address']['ip']
Why it's wrong here
The JSON nests the interface list under the 'ietf-interfaces:interfaces' module prefix and wraps entries in an array, so this path omits both the prefix and the list index. It is tempting because it mirrors the logical hierarchy, and would work if the response were flattened without module-prefixed keys or YANG list arrays.
- ✗
data['ietf-interfaces:interfaces']['interface']['ipv4']['address'][0]['ip']
Why it's wrong here
The 'interface' node is a YANG list, so RESTCONF returns it as a JSON array; indexing it with ['interface'] before ['ipv4'] raises a TypeError. The tempting shortcut mirrors the leaf structure, but list handling requires ['interface'][0] first, as in the correct option.
Go deeper
Related to this question
About these practice questions
One of 1,923 original 350-401 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 and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Cisco exam blueprint
This 350-401 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 350-401 exam.