Courseiva
mediumMultiple Choice

350-401 Practice Question: Consider the following Python script that uses the requests library to delete a VLAN via…

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?

⚠ Common exam trap

Watch out — candidates often confuse HTTP methods, thinking DELETE requires a payload like PUT/POST, or mistakenly believe DELETE can retrieve or create resources, when in fact each HTTP method has a distinct CRUD mapping in RESTCONF.

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 will delete VLAN 10 from the device configuration.

The `requests.delete()` method sends an HTTP DELETE request to the RESTCONF API endpoint for VLAN 10. When the VLAN exists, the device processes the DELETE operation and removes the VLAN configuration from the running config, returning a 204 No Content status code upon success.

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 will retrieve the configuration of VLAN 10.

    Why it's wrong here

    Reading data in RESTCONF uses GET; this script calls requests.delete(), which sends an HTTP DELETE. The Accept header only says which format the client would accept in a response body, and a successful DELETE typically returns 204 No Content with no body at all. To retrieve VLAN 10's configuration instead, the script would call requests.get() on the same URL.

  • ✗

    It will create VLAN 10 if it does not exist.

    Why it's wrong here

    DELETE never creates anything. In RESTCONF, POST creates a new resource under its parent, PUT creates or replaces a resource at the given URL, and PATCH merges changes into it, all with a body describing the data. A DELETE for a resource that does not exist returns an error, typically 404 Not Found, rather than creating it.

  • ✓

    It will delete VLAN 10 from the device configuration.

    Why this is correct

    An HTTP DELETE to the URL identifying VLAN 10 removes that resource from the running configuration, and the device typically replies 204 No Content. The change is not saved to the startup configuration automatically. In practice, check the exact data path first with a GET, because on IOS XE VLAN entries sit in the vlan-list of the Cisco-IOS-XE-vlan model under native.

  • ✗

    It will return an error because the payload is missing.

    Why it's wrong here

    DELETE requests do not need a body: the URL identifies exactly which resource to remove. The Content-Type header is harmless here even though no body is sent. Bodies are required for POST, PUT and PATCH, which carry the data to create or change, so a missing payload would only be an error for those methods, not for DELETE.

Visual reference

Switch VLAN 10 Sales (192.168.10.0/24) PC-A PC-B VLAN 20 HR (192.168.20.0/24) PC-C PC-D Router VLANs isolate traffic — inter-VLAN routing requires a Layer 3 device

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 →

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.