350-401 exam dumps

350-401 practice question 314 of 631

Implementing Cisco Enterprise Network Core Technologies. Professional level, Cisco. Free question with the correct answer and a full explanation.

350-401 Question 314

Single answer

You are configuring a network automation script, and the script requires a valid JSON-encoded file to define the configuration of a Cisco router. Which of the following JSON file snippets is valid and properly formatted?

  1. A

    { 'hostname': 'Router1', 'interfaces': [ { 'name': 'GigabitEthernet0/0', 'ip': '192.168.1.1' } ] }

  2. B

    { "hostname": "Router1", "interfaces": [ { "name": "GigabitEthernet0/0", "ip": "192.168.1.1" } ] }

  3. C

    { "hostname": "Router1", "interfaces": { "name": "GigabitEthernet0/0", "ip": "192.168.1.1" } }

  4. D

    { "hostname": "Router1", "interfaces": [ { "name": "GigabitEthernet0/0", "ip": "192.168.1.1" }, ] }

Show answer and explanation

Correct answer: B

Explanation

Option 2 is the correct answer because it adheres to the JSON standard, including the use of double quotes for strings and proper structural formatting for objects and arrays. JSON syntax is strict, and common errors, such as the use of single quotes, trailing commas, or incorrect object structures, can cause a file to be invalid.

  • A. Incorrect.

    This option is invalid because JSON requires double quotes (") for strings, but this snippet uses single quotes (').

  • B. Correct.

    This option is valid because it uses proper JSON formatting: strings are enclosed in double quotes, and arrays and objects are correctly structured.

  • C. Incorrect.

    This option is invalid because the 'interfaces' key should use an array ([]) to list multiple objects, but it incorrectly uses an object ({}) instead.

  • D. Incorrect.

    This option is invalid because it includes a trailing comma (,) after the last item in the array, which is not allowed in JSON.

Timed practice exam

Take a 350-401 practice test under exam conditions

75 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam