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
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
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)- A6% (2)
- B83% (29)
- C9% (3)
- D3% (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
Community Discussion
No community discussion yet for this question.

