nerdexam
CiscoCisco

350-401 · Question #1188

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

The correct sequence uses 'print' to display the device model to the screen, 'open' to create/access a file, 'w' as the write mode argument to open the file for writing, and 'dump' to serialize and write JSON data directly to a file object. The json.dump() function writes JSON to

Submitted by ngozi_ng· Mar 6, 2026Network Automation and Programmability - specifically working with Python scripts to interact with network device data, manipulate JSON data structures, and perform file operations using the json module (commonly tested in CCNA/CCNP DevNet or Network Automation certification tracks).

Question

Drag and Drop Question Drag and drop the code snippets from the bottom onto the blanks in the Python script to print the device model to the screen and write JSON data to a file. Not all options are used. Answer:

Explanation

The correct sequence uses 'print' to display the device model to the screen, 'open' to create/access a file, 'w' as the write mode argument to open the file for writing, and 'dump' to serialize and write JSON data directly to a file object. The json.dump() function writes JSON to a file object, while json.dumps() only converts to a string without writing to a file, making 'dump' the correct choice for file output.

Topics

#Python scripting#JSON file handling#Network automation#File I/O

Community Discussion

No community discussion yet for this question.

Full 350-401 PracticeBrowse All 350-401 Questions