nerdexam
Cisco

200-901 · Question #268

Into which type of Python data structure should common data formats be parsed?

The correct answer is C. dictionary. Common data formats such as JSON, XML, and YAML are best parsed into Python dictionaries because they are inherently key-value structured.

Software Development and Design

Question

Into which type of Python data structure should common data formats be parsed?

Options

  • Asequence
  • Bset
  • Cdictionary
  • Dlist

How the community answered

(38 responses)
  • B
    3% (1)
  • C
    95% (36)
  • D
    3% (1)

Why each option

Common data formats such as JSON, XML, and YAML are best parsed into Python dictionaries because they are inherently key-value structured.

Asequence

A sequence is a general category in Python (covering lists and tuples), not a specific data structure, and does not capture key-value relationships found in common data formats.

Bset

A set stores only unique, unordered, hashable items with no associated values, making it unsuitable for structured data that requires named field access.

CdictionaryCorrect

A dictionary maps keys to values, which directly mirrors the structure of common data interchange formats like JSON objects, XML elements with attributes, and YAML mappings. Parsing into a dictionary allows programmatic access to fields by name, making it the idiomatic Python choice for working with structured API responses and configuration data.

Dlist

A list preserves order and allows duplicates but uses integer indices rather than named keys, so it cannot naturally represent the key-value pairs inherent in formats like JSON.

Concept tested: Parsing structured data formats into Python dictionaries

Source: https://docs.python.org/3/library/stdtypes.html#mapping-types-dict

Topics

#Python Data Structures#Data Parsing#Dictionaries#JSON

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice