Courseiva
Knowledge + Practice
CertificationsVendorsCareer RoadmapsLabs & ToolsStudy GuidesGlossaryPractice Questions
C
Courseiva

Free IT certification practice questions with explained answers for CCNA, CompTIA, AWS, Azure, Google Cloud, and more.

Certification Practice Questions

CCNA practice questionsSecurity+ SY0-701 practice questionsAWS SAA-C03 practice questionsAZ-104 practice questionsAZ-900 practice questionsCLF-C02 practice questionsA+ Core 1 practice questionsGoogle Cloud ACE practice questionsCySA+ CS0-003 practice questionsNetwork+ N10-009 practice questions
View all certifications →

Product

CertificationsCertification PathsExam TopicsPractice TestsExam Dumps vs Practice TestsStudy HubComparisons

Company

AboutContactEditorial PolicyQuestion Writing PolicyTrust Center

Legal

Privacy PolicyTerms of Service

Courseiva is a free IT certification practice platform offering original exam-style practice questions, detailed explanations, topic-based practice, mock exams, readiness tracking, and study analytics for Cisco, CompTIA, Microsoft, AWS, and other technology certifications.

© 2026 Courseiva. Courseiva is operated by JTNetSolutions Ltd. All rights reserved.

Courseiva is an independent certification practice platform and is not affiliated with, endorsed by, or sponsored by Cisco, Microsoft, AWS, CompTIA, Google, ISC2, ISACA, or any other certification vendor. Vendor names and certification marks are used only to identify the exams learners are preparing for.

Certifications›350-401›Objectives›Python for Network Automation
Objective 601.0

Python for Network Automation

350-401 Practice Questions

Full Practice Test →All Objectives

350-401 Python for Network Automation — Practice Questions

30 questions from this objective

Question 2mediummultiple choice
Study the full Python automation breakdown →

A network engineer is writing a Python script to automate the backup of running configurations from a list of 50 Cisco IOS-XE devices. The script uses the netmiko library and a for loop to connect to each device, execute 'show run', and write the output to a file. After running the script, the engineer notices that the script fails on the 15th device with a timeout error, and the remaining devices are not processed. The engineer wants to ensure that if one device fails, the script continues with the next device. What is the best way to modify the script?

Question 3mediummultiple choice
Study the full Python automation breakdown →

An engineer is using the Cisco DNA Center REST API to retrieve a list of network devices and their health scores. The engineer writes a Python script using the requests library. The script successfully retrieves data for the first 100 devices, but when trying to get the next 100, the API returns an empty list. The engineer checks the API documentation and finds that the endpoint supports pagination with the 'offset' and 'limit' parameters. The current script does not handle pagination. What should the engineer do to retrieve all devices?

Question 4hardmultiple choice
Open the full VLAN trunking answer →

A network engineer is automating the configuration of VLANs on a Cisco Nexus 9000 switch using Python and the NX-API. The engineer sends a Python dictionary with the CLI commands to the API and receives a successful response. However, when checking the switch, the VLANs are not created. The engineer verifies that the credentials and IP address are correct, and the API is enabled. The engineer also notices that the API response contains a 'code' field of '200' and a 'result' field that shows the command output. What is the most likely cause of the issue?

Question 5mediummultiple choice
Study the full Python automation breakdown →

A junior engineer is tasked with writing a Python script that uses the Cisco IOS-XE RESTCONF API to retrieve the hostname of a router. The engineer uses the requests library and sends a GET request to the URL 'https://router/restconf/data/Cisco-IOS-XE-native:native/hostname'. The request returns a 404 Not Found error. The engineer has verified that the RESTCONF service is enabled and the credentials are correct. What is the most likely reason for the 404 error?

Question 6mediummultiple choice
Open the full VLAN trunking answer →

A network engineer is using the Cisco Meraki Dashboard API to automate the creation of VLANs across multiple networks. The engineer writes a Python script that uses the 'createNetworkVlan' endpoint. The script runs successfully for the first few networks, but then starts returning HTTP 429 errors. The engineer checks the API documentation and finds that the Meraki API has rate limits. The script currently sends requests as fast as possible. What should the engineer implement to avoid hitting the rate limit?

Question 7hardmultiple choice
Study the full Python automation breakdown →

An engineer is writing a Python script to parse the output of 'show ip interface brief' from multiple Cisco routers. The engineer uses the netmiko library to collect the output and then uses regular expressions to extract the interface name, IP address, and status. The script works correctly for most routers, but on one router, the output format is slightly different (e.g., extra spaces or different column headers). The engineer wants to make the parsing more robust. What is the best approach?

Question 8easymultiple choice
Open the full VLAN trunking answer →

A network engineer is automating the deployment of a new VLAN configuration across 100 Cisco IOS-XE switches using Ansible. The engineer writes a playbook that uses the 'ios_config' module. The playbook runs, but the engineer notices that the configuration is applied to only 50 switches before the playbook stops with an error. The error message indicates that one switch is unreachable. The engineer wants to ensure that the playbook continues with the remaining switches even if some are unreachable. What Ansible configuration should the engineer use?

Question 9hardmultiple choice
Study the full QoS explanation →

An engineer is using the Cisco pyATS framework to test the configuration of a new QoS policy on a router. The engineer writes a testbed file and a test script that logs into the router, applies the configuration, and then verifies the output of 'show policy-map interface'. The test script fails because the verification step cannot find the expected output. The engineer confirms that the configuration was applied successfully. What is the most likely cause of the failure?

Question 10easymultiple choice
Study the full Python automation breakdown →

A network engineer is automating the collection of syslog messages from a Cisco ASA firewall using a Python script that connects via SSH and runs 'show log'. The script uses the paramiko library. The script works for a few minutes, but then the SSH connection drops with an error 'Server connection dropped'. The engineer suspects that the ASA is closing the connection due to inactivity. What is the best way to keep the connection alive?

Question 11mediummultiple choice
Study the full Python automation breakdown →

A network engineer writes the following Python script using 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': 'cisco123',

}

connection = ConnectHandler(**device) output = connection.send_command('show ip interface brief')

print(output)

connection.disconnect() ```

What is the primary issue with this script?

Question 12mediummultiple choice
Study the full Python automation breakdown →

A network engineer uses NAPALM to retrieve the ARP table from a Cisco IOS-XE device:

```python

from napalm import get_network_driver

driver = get_network_driver('ios') device = driver('192.168.1.1', 'admin', 'cisco123') device.open() arp_table = device.get_arp_table()

print(arp_table)

device.close() ```

What is the expected data type of arp_table?

Question 13hardmultiple choice
Open the full VLAN trunking answer →

A network engineer writes an Ansible playbook to configure a VLAN on a Cisco Nexus switch:

```yaml --- - name: Configure VLAN hosts: nxos_switches gather_facts: no tasks: - name: Create VLAN 100 cisco.nxos.nxos_vlan: vlan_id: 100 name: test_vlan state: present ```

What is a potential issue with this playbook?

Question 14hardmultiple choice
Study the full Python automation breakdown →

A network engineer uses the Requests library to query a Cisco IOS-XE device via RESTCONF for interface statistics:

```python

import requests
from requests.auth import HTTPBasicAuth

url = 'https://192.168.1.1/restconf/data/Cisco-IOS-XE-interfaces-oper:interfaces/interface=GigabitEthernet1/statistics' headers = {'Accept': 'application/yang-data+json'} auth = HTTPBasicAuth('admin', 'cisco123') response = requests.get(url, headers=headers, auth=auth, verify=False)

print(response.json())

```

What is the most likely issue with this code?

Question 15mediummultiple choice
Study the full Python automation breakdown →

A network engineer uses the Cisco DNA Center REST API to retrieve the list of devices. The API returns the following JSON:

```json

{
  "response": [
    {
      "id": "12345678-1234-1234-1234-123456789abc",
      "managementIpAddress": "192.168.1.1",
      "hostname": "Router1",
      "platformId": "ISR4331",
      "role": "ACCESS",
      "series": "ISR4300 Series"
    }
  ],
  "version": "1.0"
}

```

The engineer writes the following Python code to extract the hostname of the first device:

```python

import requests

url = 'https://dna-center.local/dna/intent/api/v1/network-device' headers = {'X-Auth-Token': 'valid_token', 'Accept': 'application/json'} response = requests.get(url, headers=headers, verify=False) data = response.json()

hostname = data['response'][0]['hostname']
print(hostname)

```

What is a potential issue with this code?

Question 16hardmultiple choice
Read the full REST/YANG explanation →

A network engineer configures model-driven telemetry on a Cisco IOS-XE device using gRPC dial-out. The subscription configuration snippet is:

``` telemetry ietf subscription 100 encoding encode-kvgpb filter xpath /interfaces/interface/statistics stream yang-push update-policy periodic 500 receiver ip address 10.1.1.1 50001 protocol grpc-tcp ```

What is the primary issue with this configuration?

Question 17mediummultiple choice
Study the full Python automation breakdown →

A network engineer writes a Python script using Paramiko to execute a command on a Cisco IOS device:

```python

import paramiko

ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('192.168.1.1', username='admin', password='cisco123') stdin, stdout, stderr = ssh.exec_command('show version') output = stdout.read().decode()

print(output)

ssh.close() ```

What is a potential issue with this approach?

Question 18mediummultiple choice
Study the full Python automation breakdown →

A network engineer uses the Requests library to send a RESTCONF PATCH request to modify the hostname of a Cisco IOS-XE device:

```python

import requests
from requests.auth import HTTPBasicAuth

url = 'https://192.168.1.1/restconf/data/Cisco-IOS-XE-native:native/hostname' headers = {'Content-Type': 'application/yang-data+json'} auth = HTTPBasicAuth('admin', 'cisco123') payload = { 'Cisco-IOS-XE-native:hostname': 'NewRouter'

}

response = requests.patch(url, json=payload, headers=headers, auth=auth, verify=False)

print(response.status_code)

```

What is the expected HTTP status code if the request is successful?

Question 19hardmultiple choice
Read the full Ansible explanation →

A network engineer writes an Ansible playbook to gather facts from a Cisco IOS device using the ios_facts module:

```yaml --- - name: Gather IOS Facts hosts: ios_devices gather_facts: no tasks: - name: Collect facts cisco.ios.ios_facts: gather_subset: - hardware register: device_facts

- name: Show serial number debug: msg: "Serial number is {{ device_facts['ansible_facts']['ansible_net_serialnum'] }}" ```

What is a potential issue with this playbook?

Question 20mediummultiple choice
Study the full Python automation breakdown →

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?

Question 21mediummultiple choice
Study the full Python automation breakdown →

Consider the following Python script using the requests library to interact with a Cisco IOS-XE device via RESTCONF:

```python

import requests
from requests.auth import HTTPBasicAuth

url = 'https://192.168.1.1/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1/0/1' headers = { 'Accept': 'application/yang-data+json', 'Content-Type': 'application/yang-data+json'

}

auth = HTTPBasicAuth('admin', 'cisco')

response = requests.get(url, headers=headers, auth=auth, verify=False)

print(response.json())

```

What is the script attempting to do?

Question 22mediummultiple choice
Study the full Python automation breakdown →

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?

Question 23mediummultiple choice
Study the full Python automation breakdown →

Review the following Python script that uses the Cisco IOS-XE RESTCONF API to modify an interface:

```python

import requests
from requests.auth import HTTPBasicAuth

url = 'https://192.168.1.1/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1/0/1' headers = { 'Accept': 'application/yang-data+json', 'Content-Type': 'application/yang-data+json'

}

auth = HTTPBasicAuth('admin', 'cisco')

payload = { 'Cisco-IOS-XE-native:GigabitEthernet': { 'name': '1/0/1', 'description': 'Configured via RESTCONF'

}
}

response = requests.put(url, headers=headers, auth=auth, json=payload, verify=False)

print(response.status_code)

```

What is the expected result if the script runs successfully?

Question 24mediummultiple choice
Study the full Python automation breakdown →

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?

Question 25mediummultiple choice
Open the full VLAN trunking answer →

Consider the following Python script that uses the requests library to delete a VLAN via RESTCONF on a Cisco IOS-XE device:

```python

import requests
from requests.auth import HTTPBasicAuth

url = 'https://192.168.1.1/restconf/data/Cisco-IOS-XE-native:native/vlan=10' headers = { 'Accept': 'application/yang-data+json', 'Content-Type': 'application/yang-data+json'

}

auth = HTTPBasicAuth('admin', 'cisco')

response = requests.delete(url, headers=headers, auth=auth, verify=False)

print(response.status_code)

```

What is the expected outcome if the VLAN 10 exists?

Question 26easymultiple choice
Review the full OSPF breakdown →

What is the default OSPF hello interval on an Ethernet link?

Question 27easymultiple choice
Open the full BGP breakdown →

Which BGP attribute is preferred when it has the lowest value?

Question 28mediummultiple choice
Study the full EIGRP explanation →

What is the maximum hop count for EIGRP?

Question 29mediumdrag order
Study the full Python automation breakdown →

Drag and drop the steps of connecting to a network device via Netmiko into the correct order, from first to last.

Question 30mediumdrag order
Full question →

Drag and drop the steps of parsing 'show interfaces' output using TextFSM into the correct order, from first to last.

Question 31mediumdrag order
Study the full Python automation breakdown →

Drag and drop the steps of using a Python REST API call to retrieve device configuration via Cisco DNA Center into the correct order, from first to last.

More Python for Network Automation questions available in the full practice test.

Continue Practising →
←

Previous objective

Automation

Next objective

Ansible Automation

→

All 350-401 Objectives

  • 100.Architecture15%
  • 101.Enterprise Network Design
  • 102.SD-Access Architecture
  • 103.SD-WAN Architecture
  • 104.QoS Architecture
  • 200.Virtualization10%
  • 201.Network Function Virtualization
  • 202.Virtual Machines and Hypervisors
  • 203.VRF and Path Isolation
  • 300.Infrastructure30%
  • 301.OSPF
  • 302.BGP
  • 303.EIGRP
  • 304.VLANs and Trunking
  • 305.Spanning Tree Protocol
  • 306.EtherChannel
  • 307.Wireless Infrastructure
  • 308.MPLS
  • 309.WAN Technologies
  • 310.NAT and DHCP
  • 311.IP Multicast
  • 312.QoS
  • 400.Network Assurance10%
  • 401.SNMP and Syslog
  • 402.NetFlow and Telemetry
  • 403.SPAN and RSPAN
  • 404.IP SLA
  • 500.Security20%
  • 501.AAA, RADIUS, and TACACS+
  • 502.ACLs and CoPP
  • 503.802.1X and TrustSec
  • 504.VPN Technologies
  • 505.Infrastructure Security
  • 600.Automation15%
  • 601.Python for Network Automation
  • 602.Ansible Automation
  • 603.REST APIs and Data Models
  • 604.Cisco DNA Center
  • 605.Model-Driven Telemetry