mediumMultiple Choice
350-401 Practice Question: Examine the following Python script that uses the…
Examine the following Python script that uses the netmiko library to send configuration commands to a Cisco IOS-XE device:
```python
from netmiko import ConnectHandler
device = { 'device_type': 'cisco_ios', 'ip': '192.168.1.1', 'username': 'admin', 'password': 'cisco',
}
connection = ConnectHandler(**device) config_commands = [ 'interface GigabitEthernet1/0/1', 'description Link to Core', 'ip address 10.1.1.1 255.255.255.0', 'no shutdown'
]
output = connection.send_config_set(config_commands)
print(output)
connection.disconnect() ```
What is the purpose of this script?
⚠ Common exam trap
Cisco often tests the distinction between `send_command()` (for show commands) and `send_config_set()` (for configuration commands), leading candidates to mistakenly think the script retrieves the running config when it actually applies changes.
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 configures interface GigabitEthernet1/0/1 with a description, IP address, and enables it.
The script uses Netmiko's `send_config_set()` method to push a list of configuration commands to the device. The commands configure interface GigabitEthernet1/0/1 with a description, assign an IP address, and issue `no shutdown` to enable the interface. This matches option B exactly.
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 retrieves the running configuration of the device.
Why it's wrong here
send_config_set enters configuration mode and applies the supplied commands; it does not read or display the existing configuration. It is tempting because netmiko can retrieve configurations, but that uses send_command with a show running-config command instead of a configuration command list.
- ✓
It configures interface GigabitEthernet1/0/1 with a description, IP address, and enables it.
Why this is correct
The script passes a list of interface-level commands to `send_config_set()`, which enters global configuration mode and applies each line in sequence. This sets the description, assigns 10.1.1.1/24, and issues `no shutdown`, satisfying the stem's requirement to configure and enable GigabitEthernet1/0/1 on the IOS-XE device.
- ✗
It saves the configuration to the startup configuration.
Why it's wrong here
send_config_set pushes the listed interface commands into the running configuration only; nothing in the script invokes a save or copy operation to startup. It is tempting because configuration changes are often persisted afterwards, but that requires an explicit separate command the script never issues.
- ✗
It tests connectivity to the device using ping.
Why it's wrong here
The script opens an SSH session and pushes interface configuration commands; no ICMP echo request is generated anywhere. It is tempting because netmiko sessions are often used alongside reachability checks, but ping testing requires a separate command or tool, not send_config_set.
Go deeper
Related to this question
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 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.