mediumMultiple Choice
350-401 Practice Question: Examine this Python script that uses the napalm…
Examine this Python script that uses the napalm library to manage a Cisco IOS-XE device:
```python
from napalm import get_network_driver
driver = get_network_driver('ios') device = driver('192.168.1.1', 'admin', 'cisco') device.open()
print(device.get_facts())
device.close() ```
What is the output of this script?
⚠ Common exam trap
Cisco often tests the distinction between `get_facts()` and `get_config()` to see if candidates confuse retrieving device metadata with retrieving the actual configuration.
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
✓
It prints a dictionary containing device facts like hostname, model, uptime, etc.
The script uses the napalm library with the 'ios' driver to connect to a Cisco IOS-XE device. The `get_facts()` method returns a dictionary containing device facts such as hostname, vendor, model, serial number, uptime, and OS version. Therefore, the output is a dictionary of these facts, not a configuration or connectivity test.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
It displays the running configuration of the device.
Why it's wrong here
NAPALM's get_facts() method is specifically designed to retrieve device facts, such as hostname, model, uptime, and operating system version, and returns them as a dictionary. The running configuration is a separate piece of data accessed through a different NAPALM method, typically get_config(), which returns the device's configuration in text or structured format. In this script, no call to get_config() is made, so the output cannot be the running configuration.
- ✓
It prints a dictionary containing device facts like hostname, model, uptime, etc.
Why this is correct
get_facts() is a NAPALM method that returns a dictionary containing key-value pairs of device information, including hostname, model, uptime, serial number, os_version, and vendor. The script likely calls this method and then prints the resulting dictionary to the console. This dictionary provides a normalized, vendor-agnostic view of the device's basic identity and operational state, which is useful for inventory and auditing purposes.
- ✗
It applies a configuration change to the device.
Why it's wrong here
The NAPALM script is performing a read-only operation by calling get_facts(), and no configuration change methods are invoked. Applying a configuration change in NAPALM would require methods such as load_merge_candidate() or load_replace_candidate() followed by commit_config(), along with the appropriate configuration data to push. Since the script only retrieves facts and prints them, it does not alter the device's configuration in any way.
- ✗
It tests connectivity to the device using ICMP.
Why it's wrong here
NAPALM does not use ICMP for device interactions; it connects to network devices using SSH (or occasionally other APIs like RESTCONF or NETCONF) to execute commands and retrieve structured data. ICMP-based connectivity testing is typically performed with the ping command from the control host, which is outside the scope of NAPALM's role in network automation. The script's use of get_facts() implies an SSH-based connection to gather device facts, not an ICMP echo exchange.
Go deeper
Related to this question
About these practice questions
This 350-401 question is part of Courseiva's 1,923-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.