Implementing Cisco Enterprise Network Core Technologies (350-401 ENCOR) Exam Materials - Question #427 Discussion

Comment Image Comment Image Comment Image
Question Diagram

Refer to the exhibit. How should the script be completed so that each device configuration is saved into a JSON-formatted file under the device name? (Choose one answer)

  • A. Insert after the for loop:
    with open(f"Hostname.json", "w") as OutFile:
    OutFile.write(Response)
  • B. Append to the body of the for loop:
    with open(f"Hostname.json", "w") as OutFile:
    OutFile.write(Response.text)
  • C. Insert after the for loop:
    with open(f"Hostname.json", "w") as OutFile:
    OutFile.write(json.dumps(Response.text))
  • D. Insert immediately before the for loop:
    with open(f"Hostname.json", "w") as OutFile:
    OutFile.write(json.load(Devices))
Correct Answer: B

Brave-Dump Community Votes

Answer: B (3 votes) 75%
Answer: C (1 vote) 25%

Community Explanations & Comments (4)

Anonymous User 2 months ago
Selected: C
C because json.dump() makes the file JSON format
Brave-Dumps.com Admin 2 months ago
C is not correct because Response.text is already JSON-formatted. Using json.dumps(Response.text) encodes the JSON again as a string, and placing the code after the loop saves only the last device. The intended answer is B.
Brave-Dumps.com Admin 2 months ago
Selected: B
B is the correct here
CITN 2 months ago
Selected: B
B is the correct answer
Anonymous User 1 week ago
Selected: B
B is correct