nerdexam
Cisco

200-901 · Question #168

What is used in JSON to represent a Python Tuple?

The correct answer is B. Array. In JSON, a Python Tuple is represented by an Array, which is an ordered collection of values enclosed in square brackets.

Understanding and Using APIs

Question

What is used in JSON to represent a Python Tuple?

Options

  • AObject
  • BArray
  • CDict
  • DCollection

How the community answered

(46 responses)
  • A
    7% (3)
  • B
    87% (40)
  • C
    2% (1)
  • D
    4% (2)

Why each option

In JSON, a Python Tuple is represented by an Array, which is an ordered collection of values enclosed in square brackets.

AObject

A JSON Object represents a Python dictionary (dict) or similar key-value mapping, not an ordered sequence like a tuple.

BArrayCorrect

A Python Tuple is an ordered, immutable sequence of elements. In JSON, the closest equivalent for an ordered sequence is an Array, which represents an ordered list of values and is denoted by square brackets `[]`.

CDict

A Dict in Python is represented as a JSON Object, which is an unordered collection of key-value pairs.

DCollection

"Collection" is a general term and not a specific JSON data type.

Concept tested: JSON data types and Python data structure mapping

Source: https://docs.python.org/3/library/json.html#json-types

Topics

#JSON#Python#Data Serialization#JSON Array

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice