200-901 exam dumps

200-901 practice question 5 of 204

Cisco DevNet Associate. Associate level, Cisco. Free question with the correct answer and a full explanation.

200-901 Question 5

Single answer

You are building a Python application that consumes data from an API that returns JSON. Which library and method combination should you use to parse the JSON data into a Python dictionary?

  1. A

    xml.etree.ElementTree and ElementTree.parse()

  2. B

    json and json.loads()

  3. C

    yaml and yaml.load()

  4. D

    csv and csv.reader()

Show answer and explanation

Correct answer: B

Explanation

To parse JSON data into a Python dictionary, the 'json' library is used along with the 'json.loads()' method. This method takes a JSON-formatted string and converts it into a Python data structure such as a dictionary or list. Other libraries such as xml.etree.ElementTree, yaml, and csv are used to parse other data formats like XML, YAML, and CSV, respectively.

  • A. Incorrect.

    xml.etree.ElementTree and ElementTree.parse() are used for parsing XML data, not JSON.

  • B. Correct.

    json and json.loads() is the correct combination for parsing JSON data into a Python dictionary.

  • C. Incorrect.

    yaml and yaml.load() is used for parsing YAML data, not JSON.

  • D. Incorrect.

    csv and csv.reader() is used for parsing CSV data, not JSON.

Timed practice exam

Take a 200-901 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