Courseiva
mediumMultiple ChoiceObjective-mapped

CCNP Practice Question: Consider the following Python script that uses…

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

    A GET request is used for retrieval, not DELETE.

  • It will create VLAN 10 if it does not exist.

    Why it's wrong here

    A POST or PUT request is used for creation, not DELETE.

  • It will delete VLAN 10 from the device configuration.

    Why this is correct

    The DELETE method removes the specified resource.

  • It will return an error because the payload is missing.

    Why it's wrong here

    DELETE requests typically do not require a payload; the URL identifies the resource.

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

About these practice questions

Courseiva writes every 350-401 question from scratch — 1,175 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

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.