Exam 350-401 All QuestionsBrowse all questions from this exam
Question 512

An engineer must create a script to append and modify device entries in a JSON-formatted file. The script must work as follows:

✑ Until interrupted from the keyboard, the script reads in the hostname of a device, its management IP address operating system type, and CLI remote access protocol.

✑ After being interrupted, the script displays the entered entries and adds them to the JSON-formatted file, replacing existing entries whose hostname matches.

The contents of the JSON-formatted file are as follows:

Drag and drop the statements onto the blanks within the code to complete the script. Not all options are used.

Select and Place:

    Correct Answer:

Discussion
MO_2022

1. import json 2. while True: 3. except 4. File = open 5. File.close()

Arnaud_R1

In that case, it should be File = open instead of File.open() "File" is not defined in the script before, so no method can be applied to it. Also, the parenthesis after the blank field help us here.

x3rox

Thank you mate!

ccnptoppler34

it should be File = open instead of File.open()

nushadu

JSON Library in Python Method >>>>>>>>> Description dumps() >>>>>>>>> encoding to JSON objects dump() >>>>>>>>> encoded string writing on file loads() >>>>>>>>> Decode the JSON string load() >>>>>>>>> Decode while JSON file read

SeMo0o0o

correct

SeMo0o0o

i misread it, given answer is incorrect

SeMo0o0o

given answer is incorrect import json while True: except File = open File.close()

SeMo0o0o

....................

wengzaii96

I thought I was learning programming instead of networking. Nowadays people are using software-defined

eojedad

definitly is File = open, compared to question 496 ...outfile = open(...)