Courseiva
mediumMultiple Choice

350-401 Practice Question: Examine the following Python script that uses the netmiko library to send configuration…

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 sends the listed commands; it does not read back the existing configuration. To retrieve the running configuration with Netmiko, you would call send_command('show running-config') instead, which runs a show command and returns its output. The printed output here is just the echo of the configuration session, showing each command as it was entered, not a copy of the device's configuration.

  • ✓

    It configures interface GigabitEthernet1/0/1 with a description, IP address, and enables it.

    Why this is correct

    send_config_set() enters global configuration mode, sends each line in order, and exits, so the device ends up with GigabitEthernet1/0/1 described as 'Link to Core', addressed 10.1.1.1/24 and enabled with 'no shutdown'. Printing the output shows the session transcript, which is useful for spotting errors such as '% Invalid input'. On a Layer 2 switch port, 'no switchport' would also be needed before an IP address can be assigned.

  • ✗

    It saves the configuration to the startup configuration.

    Why it's wrong here

    The commands change only the running configuration. Nothing in the script copies it to startup, so the changes would be lost after a reload. Netmiko provides save_config(), which runs 'write memory' or the platform equivalent, and calling it after send_config_set() is common practice. The option is tempting because saving usually follows configuration changes, but this script never does it.

  • ✗

    It tests connectivity to the device using ping.

    Why it's wrong here

    The script connects over SSH and pushes configuration; it never sends a ping. Connecting does prove the device is reachable on port 22, but that is a side effect, not the script's purpose. Netmiko could run a ping from the device with send_command('ping 10.1.1.2'), and reachability from the automation host is usually tested separately, before connecting, for example with an ICMP or TCP check.

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 →

How Courseiva writes practice questions · Editorial policy

You might also like

Similar 350-401 questions

Written by Johnson Ajibi, MSc IT Security

Security Systems Architect · 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.