CCNP Automation Practice Question
A network engineer is using a Python script with the ncclient library to retrieve configuration from a Cisco IOS XE device via NETCONF. The script uses the <get-config> RPC with a source of <running/> and a filter of <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native"/>. The script successfully retrieves the configuration but the output is in XML format. The engineer wants to convert this XML into a Python dictionary for easier manipulation. Which Python library is specifically designed to parse XML into a dictionary structure?
⚠ Common exam trap
Candidates often confuse general XML parsing libraries with a library that specifically outputs a dictionary.
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
✓
xmltodict
xmltodict is specifically designed to convert XML into a Python dictionary, making it the ideal choice for transforming NETCONF XML responses into a manipulable dictionary format.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
ElementTree
Why it's wrong here
ElementTree is part of the Python standard library for parsing XML into a tree structure. It does not convert XML to a dictionary; it provides an ElementTree object. To get a dictionary, the engineer would need to traverse the tree and build one manually. It is not specifically designed for dictionary conversion.
- ✗
lxml
Why it's wrong here
lxml is a powerful XML and HTML parsing library that provides ElementTree-like APIs, but it does not directly convert XML to a dictionary. It is used for parsing and navigating XML trees, not for dictionary conversion. While it can be used to build a dictionary manually, it is not specifically designed for that purpose.
- ✗
BeautifulSoup
Why it's wrong here
BeautifulSoup is primarily used for parsing HTML and XML, but it is not designed to convert XML into a dictionary. It creates a parse tree that can be navigated, but does not provide a direct dictionary representation. It is more suited for web scraping than for structured data conversion.
- ✓
xmltodict
Why this is correct
xmltodict is a Python library that converts XML into a dictionary, making it easy to work with XML data in Python. It preserves attributes and nested structures, and is commonly used with NETCONF responses. It directly addresses the need to transform XML into a dictionary for manipulation.
About these practice questions
Courseiva writes every 350-401 question from scratch — 1,923 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.