nerdexam
CiscoCisco

350-401 · Question #429

350-401 Question #429: Real Exam Question with Answer & Explanation

The correct answer is D: Each device that is looped through in the devices.txt file is put into its own dictionary that is. The Python script processes each device entry from the devices.txt file and organizes each device's attributes into its own dictionary.

Submitted by cyberguy42· Mar 6, 2026Automation

Question

Refer to the exhibit. What is achieved when this Python script is executed?

Options

  • AAll devices that are looped through in the devices.txt file are put into a list that is appended to the
  • BAll devices that are looped through in the devices.txt file are put into a single dictionary that is
  • CEach device that is looped through in the devices.txt file is put into its own list that is appended to
  • DEach device that is looped through in the devices.txt file is put into its own dictionary that is

Explanation

The Python script processes each device entry from the devices.txt file and organizes each device's attributes into its own dictionary.

Common mistakes.

  • A. This option suggests that all devices are consolidated into a single list without specifying the structured nature of each device's data, which is less flexible and descriptive than using dictionaries for device attributes.
  • B. Putting all devices into a single dictionary typically implies that each device is identified by a unique key within that dictionary (e.g., device name as key), which is different from 'each device ... put into its own dictionary'.
  • C. Storing each device's attributes in its own list (e.g., ['hostname', 'ip', 'os']) is less descriptive and harder to access by specific attribute names compared to using a dictionary with meaningful keys (e.g., {'hostname': 'R1', 'ip': '1.1.1.1'}).

Concept tested. Python list of dictionaries data structure for parsing files

Reference. https://docs.python.org/3/tutorial/datastructures.html

Topics

#Python scripting#Python data structures#File I/O

Community Discussion

No community discussion yet for this question.

Full 350-401 PracticeBrowse All 350-401 Questions