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.

← Python for Network Automation practice sets

350-401 Python for Network Automation • Complete Question Bank

350-401 Python for Network Automation — All Questions With Answers

Complete 350-401 Python for Network Automation question bank — all 0 questions with answers and detailed explanations.

58
Questions
Free
No signup
Certifications/350-401/Practice Test/Python for Network Automation/All Questions
Question 1mediummultiple 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 2mediummultiple 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 3hardmultiple 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 4mediummultiple 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 5mediummultiple 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 6hardmultiple 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 7easymultiple 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 8hardmultiple 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 9easymultiple 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 10mediummultiple 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 11mediummultiple 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 12hardmultiple 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 13hardmultiple 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 14mediummultiple 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 15hardmultiple choice
Study the full Python automation breakdown →

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 16mediummultiple 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 17mediummultiple 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 18hardmultiple 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 19mediummultiple 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 20mediummultiple 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 21mediummultiple 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 22mediummultiple 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 23mediummultiple 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 24mediummultiple 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 25easymultiple choice
Review the full OSPF breakdown →

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

Question 26easymultiple choice
Open the full BGP breakdown →

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

Question 27mediummultiple choice
Study the full EIGRP explanation →

What is the maximum hop count for EIGRP?

Question 28mediumdrag 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 29mediumdrag order
Study the full Python automation breakdown →

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

Question 30mediumdrag 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.

Question 31mediumdrag order
Study the full Python automation breakdown →

Drag and drop the steps of NAPALM get_facts() retrieval from IOS-XE device into the correct order, from first to last.

Question 32mediumdrag order
Study the full Python automation breakdown →

Drag and drop the steps of Netmiko multi-threaded device polling workflow into the correct order, from first to last.

Question 33harddrag order
Study the full Python automation breakdown →

Drag and drop the steps of gNMI Subscribe RPC using Python gRPC library into the correct order, from first to last.

Question 34mediumdrag order
Study the full Python automation breakdown →

Drag and drop the steps of Jinja2 template rendering for device config generation into the correct order, from first to last.

Question 35mediumdrag order
Study the full Python automation breakdown →

Drag and drop the steps of REST API call using Requests library to DNA Center into the correct order, from first to last.

Question 36mediumdrag order
Study the full Python automation breakdown →

Drag and drop the steps of NAPALM get_facts() retrieval from IOS-XE device into the correct order, from first to last.

Question 37mediumdrag order
Study the full Python automation breakdown →

Drag and drop the steps of Netmiko multi-threaded device polling workflow into the correct order, from first to last.

Question 38harddrag order
Study the full Python automation breakdown →

Drag and drop the steps of gNMI Subscribe RPC using Python gRPC library into the correct order, from first to last.

Question 39mediumdrag order
Study the full Python automation breakdown →

Drag and drop the steps of Jinja2 template rendering for device config generation into the correct order, from first to last.

Question 40mediumdrag order
Study the full Python automation breakdown →

Drag and drop the steps of REST API call using Requests library to DNA Center into the correct order, from first to last.

Question 41mediummatching
Study the full Python automation breakdown →

Drag and drop each Python library on the left to its matching network use case on the right.

Question 42mediummatching
Study the full Python automation breakdown →

Drag and drop each Netmiko device type on the left to its matching operating system on the right.

Question 43mediummatching
Study the full Python automation breakdown →

Drag and drop each NAPALM getter on the left to its matching returned data on the right.

Question 44mediummatching
Study the full Python automation breakdown →

Drag and drop each Python data structure on the left to its matching network config use on the right.

Question 45mediummatching
Study the full Python automation breakdown →

Drag and drop each HTTP method on the left to its matching REST operation on the right.

Question 46mediummatching
Study the full Python automation breakdown →

Drag and drop each Python library on the left to its matching network use case on the right.

Question 47mediummatching
Study the full Python automation breakdown →

Drag and drop each Netmiko device type on the left to its matching OS on the right.

Question 48mediummatching
Study the full Python automation breakdown →

Drag and drop each NAPALM getter on the left to its matching returned data on the right.

Question 49mediummatching
Study the full Python automation breakdown →

Drag and drop each Python data structure on the left to its matching network config use on the right.

Question 50mediummatching
Study the full Python automation breakdown →

Drag and drop each HTTP method on the left to its matching REST operation on the right.

Question 51mediummulti select
Study the full Python automation breakdown →

Which two statements about using Python for network automation with Cisco devices are true? (Choose two.)

Question 52mediummulti select
Study the full Python automation breakdown →

Which two statements about using Python for configuration management and templating in network automation are true? (Choose two.)

Question 53hardmulti select
Study the full Python automation breakdown →

Which three statements about using Python for interacting with Cisco IOS-XE devices via NETCONF and RESTCONF are true? (Choose three.)

Question 54hardmulti select
Study the full Python automation breakdown →

Which three statements about using Python for device inventory and data serialization in network automation are true? (Choose three.)

Question 55mediummulti select
Study the full Python automation breakdown →

Which two statements about using Python for network automation are true? (Choose two.)

Question 56mediummulti select
Study the full Python automation breakdown →

Which two statements about Python data structures used in network automation are true? (Choose two.)

Question 57hardmulti select
Study the full Python automation breakdown →

Which three statements about Python functions and modules for network automation are true? (Choose three.)

Question 58hardmulti select
Study the full Python automation breakdown →

Which three statements about error handling and debugging in Python network automation scripts are true? (Choose three.)

Practice tests

Scored 10-question sessions with instant feedback and explanations.

350-401 Practice Test 1 — 10 Questions→350-401 Practice Test 2 — 10 Questions→350-401 Practice Test 3 — 10 Questions→350-401 Practice Test 4 — 10 Questions→350-401 Practice Test 5 — 10 Questions→350-401 Practice Exam 1 — 20 Questions→350-401 Practice Exam 2 — 20 Questions→350-401 Practice Exam 3 — 20 Questions→350-401 Practice Exam 4 — 20 Questions→Free 350-401 Practice Test 1 — 30 Questions→Free 350-401 Practice Test 2 — 30 Questions→Free 350-401 Practice Test 3 — 30 Questions→350-401 Practice Questions 1 — 50 Questions→350-401 Practice Questions 2 — 50 Questions→350-401 Exam Simulation 1 — 100 Questions→

Practice by domain

Each domain maps to a weighted exam section. Focus on the domain where you are weakest.

ArchitectureEnterprise Network DesignSD-Access ArchitectureSD-WAN ArchitectureQoS ArchitectureVirtualizationNetwork Function VirtualizationVirtual Machines and HypervisorsVRF and Path IsolationInfrastructureOSPFBGPEIGRPVLANs and TrunkingSpanning Tree ProtocolEtherChannelWireless InfrastructureMPLSWAN TechnologiesNAT and DHCPIP MulticastQoSNetwork AssuranceSNMP and SyslogNetFlow and TelemetrySPAN and RSPANIP SLASecurityAAA, RADIUS, and TACACS+ACLs and CoPP802.1X and TrustSecVPN TechnologiesInfrastructure SecurityAutomationPython for Network AutomationAnsible AutomationREST APIs and Data ModelsCisco DNA CenterModel-Driven Telemetry

Practice by scenario

Filter questions by type — troubleshooting, exhibit, drag-and-drop, PBQ, ACLs, OSPF, and more.

Browse scenarios→

Continue studying

All Python for Network Automation setsAll Python for Network Automation questions350-401 Practice Hub