Courseiva
mediumMultiple Choice

350-401 Practice Question: Examine the following Python script snippet that…

Examine the following Python script snippet that uses netmiko to configure 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) output = connection.send_command('show ip interface brief')

print(output)

connection.disconnect() ```

What is the primary 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 any script that connects to a device is performing configuration 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 retrieves and prints the output of 'show ip interface brief'.

The script uses netmiko's `send_command()` method, which sends a show command to the device and returns the output. It does not include any configuration commands or file transfer operations. Therefore, its primary purpose is to retrieve and print the output of 'show ip interface brief'.

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 configures an IP address on an interface.

    Why it's wrong here

    The script issues send_command with a show command, which only reads operational state; no interface configuration commands are sent. Assigning an IP address requires send_config_set with interface and ip address commands. It is tempting because netmiko can push configuration, but that needs config-mode methods, not send_command.

  • ✓

    It retrieves and prints the output of 'show ip interface brief'.

    Why this is correct

    The script calls send_command with 'show ip interface brief' and prints the returned string, so its purpose is purely read-only retrieval of interface status. No configuration commands are sent, distinguishing it from a configuration or backup script.

  • ✗

    It saves the running configuration to startup configuration.

    Why it's wrong here

    The script calls send_command with 'show ip interface brief', a read-only operational command, so it retrieves and prints interface status rather than altering configuration. Saving running to startup requires send_config_set with 'copy running-config startup-config' or 'write memory'. It is tempting because netmiko does support configuration changes, but only through config-mode methods.

  • ✗

    It backs up the configuration to a TFTP server.

    Why it's wrong here

    The script opens an SSH session and runs show ip interface brief, printing the interface status returned by the device. No file transfer or TFTP operation occurs. TFTP backup scripts use transfer_config or file copy commands, not send_command with a show command.

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 →

How Courseiva writes practice questions · Editorial policy

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.