nerdexam
Cisco

350-401 · Question #928

Refer to the exhibit. What is output by this code?

The correct answer is B. 0 1 2 3 4 5. The Python code iterates through and prints a sequence of numbers from 0 up to and including 5, separated by spaces.

Submitted by parkjh· Mar 6, 2026

Question

Refer to the exhibit. What is output by this code?

Options

  • A0 5
  • B0 1 2 3 4 5
  • C0 1 2 3 4
  • D(0,5)

How the community answered

(29 responses)
  • A
    10% (3)
  • B
    83% (24)
  • C
    3% (1)
  • D
    3% (1)

Why each option

The Python code iterates through and prints a sequence of numbers from 0 up to and including 5, separated by spaces.

A0 5

This output implies only the start and end values were printed, not the entire sequence generated by a typical loop structure for `range(0,5)` or similar that includes intermediate values.

B0 1 2 3 4 5Correct

The Python code, likely using a `for` loop with a `range` function such as `range(6)` or `range(0, 6)`, iterates through numbers starting from 0 and ending at 5 (inclusive). Each number is then printed, typically separated by a space, resulting in the output "0 1 2 3 4 5".

C0 1 2 3 4

This output stops at 4, suggesting the range function used was exclusive of the last value, e.g., `range(5)` or `range(0, 5)`.

D(0,5)

This output format suggests a tuple `(0, 5)` was printed, not individual numbers in a sequence.

Concept tested: Python `range()` function and loop iteration

Source: https://docs.python.org/3/library/stdtypes.html#range

Topics

#Programming basics#Code interpretation#Loops#Python syntax

Community Discussion

No community discussion yet for this question.

Full 350-401 Practice