nerdexam
Cisco

350-401 · Question #765

Which Python code snippet must be added to the script to store the changed interface configuration to a local JSON-formatted file? A. B. C. D.

The correct answer is B. OutFile = open("ifaces.json", "w") OutFile.write(UpdatedConfig) OutFile.close(). Option B is correct because it opens a file in write mode and uses OutFile.write(UpdatedConfig) to write the updated configuration string directly to the JSON file. This assumes UpdatedConfig is already a properly formatted JSON string, which is the appropriate way to write pre-s

Submitted by satoshi_tk· Mar 6, 2026Software Development and Design / Network Programmability - writing Python scripts to interact with REST APIs and persist configuration data to local files using JSON formatting (e.g., Cisco DevNet or CCNP Enterprise certification objectives)

Question

Which Python code snippet must be added to the script to store the changed interface configuration to a local JSON-formatted file? A. B. C. D.

Exhibits

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

Options

  • AOutFile = open("ifaces.json", "w") OutFile.write(Response.text) OutFile.close()
  • BOutFile = open("ifaces.json", "w") OutFile.write(UpdatedConfig) OutFile.close()
  • COutFile = open("ifaces.json", "w") json.dump(UpdatedConfig,OutFile) OutFile.close()
  • DOutFile = open("ifaces.json", "w") OutFile.write(Response.json()) OutFile.close()

How the community answered

(35 responses)
  • A
    6% (2)
  • B
    83% (29)
  • C
    9% (3)
  • D
    3% (1)

Explanation

Option B is correct because it opens a file in write mode and uses OutFile.write(UpdatedConfig) to write the updated configuration string directly to the JSON file. This assumes UpdatedConfig is already a properly formatted JSON string, which is the appropriate way to write pre-serialized JSON content to a file using standard Python file I/O operations.

Topics

#Python file I/O#JSON handling#REST API scripting#Network automation

Community Discussion

No community discussion yet for this question.

Full 350-401 Practice