nerdexam
Cisco

200-901 · Question #89

Refer to the exhibit. What is the function of the python script?

The correct answer is E. Loop through the returned list of network devices and, for each device, print the device name. The script loops through a list of network devices and prints only the device name for each entry in the list.

Software Development and Design

Question

Refer to the exhibit. What is the function of the python script?

Exhibit

200-901 question #89 exhibit

Options

  • ACount and print the total number of available devices.
  • BIterate over a list of network devices and write all device names and management IP addresses
  • CIterate over a list of network devices and write all device type and associated management IP
  • DFor each device that is returned, display the device and, for each device, print the device name
  • ELoop through the returned list of network devices and, for each device, print the device name

How the community answered

(36 responses)
  • C
    6% (2)
  • D
    3% (1)
  • E
    92% (33)

Why each option

The script loops through a list of network devices and prints only the device name for each entry in the list.

ACount and print the total number of available devices.

The script does not count or accumulate a total number of devices - it iterates and prints an attribute per device.

BIterate over a list of network devices and write all device names and management IP addresses

The script does not write both device names and management IP addresses - only the device name is referenced in the loop body.

CIterate over a list of network devices and write all device type and associated management IP

The script does not print device type or management IP - those fields are not accessed within the loop.

DFor each device that is returned, display the device and, for each device, print the device name

This option is imprecise and redundant - it conflates the outer iteration with the inner print action without correctly identifying the attribute being printed.

ELoop through the returned list of network devices and, for each device, print the device nameCorrect

The script uses a for loop to iterate over a returned list of network devices. For each iteration, it accesses only the device name attribute and prints it, making option E the most accurate and complete description of the script's behavior.

Concept tested: Python iteration over network device list

Source: https://developer.cisco.com/docs/dna-center/

Topics

#Python loops#List iteration#Network device data#Script output

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice