nerdexam
Cisco

350-401 · Question #512

Refer to the exhibit. Which code results in the working Python script displaying a list of network devices from the Cisco DNA Center?

The correct answer is B. login = dnac_login(dnac["host"], dnac["username"], dnac["password"]). To display a list of network devices from Cisco DNA Center using a Python script, the essential first step is to authenticate and establish a session.

Submitted by emma.c· Mar 6, 2026

Question

Refer to the exhibit. Which code results in the working Python script displaying a list of network devices from the Cisco DNA Center?

Exhibits

350-401 question #512 exhibit 1
350-401 question #512 exhibit 2

Options

  • Anetwork_device_list(dnac["host"], dnac["username"],dnac["password"])
  • Blogin = dnac_login(dnac["host"], dnac["username"], dnac["password"])
  • Clogin = dnac_login(dnac["host"], dnac["username"], dnac["password"])
  • Dnetwork_device_list(dnac["host"], dnac["username"], dnac["password"])

How the community answered

(41 responses)
  • A
    5% (2)
  • B
    80% (33)
  • C
    12% (5)
  • D
    2% (1)

Why each option

To display a list of network devices from Cisco DNA Center using a Python script, the essential first step is to authenticate and establish a session.

Anetwork_device_list(dnac["host"], dnac["username"],dnac["password"])

The `network_device_list` function would typically retrieve the list of devices, but attempting to call it without first performing an authentication step would result in an unauthorized access error.

Blogin = dnac_login(dnac["host"], dnac["username"], dnac["password"])Correct

The `dnac_login` function is responsible for authenticating with the Cisco DNA Center API using the provided host, username, and password. Establishing a successful login session and obtaining an authentication token or session object is a mandatory prerequisite before any subsequent API calls, such as fetching a list of network devices, can be made.

Clogin = dnac_login(dnac["host"], dnac["username"], dnac["password"])

This option is identical to option B, which is the correct choice, but the prompt designates B as the distinct correct answer.

Dnetwork_device_list(dnac["host"], dnac["username"], dnac["password"])

Similar to option A, calling `network_device_list` directly without an established authenticated session would fail to retrieve device information.

Concept tested: Cisco DNA Center API authentication

Source: https://developer.cisco.com/dnac/

Topics

#Cisco DNA Center API#Python scripting#API authentication#Network programmability

Community Discussion

No community discussion yet for this question.

Full 350-401 Practice