nerdexam
Cisco

350-401 · Question #1042

Refer to the exhibit. What is printed to the console when this script is run?

The correct answer is D. a key-value pair in string type. The script prints a string representation of the dictionary data because f-strings convert embedded expressions into their string equivalent.

Submitted by the_admin· Mar 6, 2026Automation

Question

Refer to the exhibit. What is printed to the console when this script is run?

Exhibits

350-401 question #1042 exhibit 1
350-401 question #1042 exhibit 2

Options

  • Aa key-value pair in tuple type
  • Ban error
  • Ca key-value pair in list type
  • Da key-value pair in string type

How the community answered

(21 responses)
  • A
    5% (1)
  • B
    5% (1)
  • C
    19% (4)
  • D
    71% (15)

Why each option

The script prints a string representation of the dictionary `data` because f-strings convert embedded expressions into their string equivalent.

Aa key-value pair in tuple type

The output is not a tuple type; it is a string representation of a dictionary.

Ban error

The script is syntactically correct and will execute without generating an error.

Ca key-value pair in list type

The output is not a list type; it is a string representation of a dictionary.

Da key-value pair in string typeCorrect

When an f-string includes a dictionary object like `{data}`, Python's `__str__` method is implicitly called on the dictionary, converting it into its string representation. This results in the literal dictionary syntax, including keys, values, and curly braces, being embedded directly into the output string.

Concept tested: Python f-string dictionary representation

Source: https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals

Topics

#Python scripting#Data types#Output interpretation

Community Discussion

No community discussion yet for this question.

Full 350-401 Practice