nerdexam
Cisco

350-401 · Question #945

Refer to the exhibit. What is the value of the variable list after the code is run?

The correct answer is B. [1, 2, 3, 10]. The Python list.insert() method is used to add an element at a specified index in a list, modifying the list in place.

Submitted by noor.lb· Mar 6, 2026Automation

Question

Refer to the exhibit. What is the value of the variable list after the code is run?

Options

  • A[1, 2, 10]
  • B[1, 2, 3, 10]
  • C[1, 2, 10, 4]
  • D[1, 10,10,10]

How the community answered

(57 responses)
  • A
    16% (9)
  • B
    75% (43)
  • C
    4% (2)
  • D
    5% (3)

Why each option

The Python `list.insert()` method is used to add an element at a specified index in a list, modifying the list in place.

A[1, 2, 10]

This choice incorrectly suggests the list would truncate or remove elements after insertion.

B[1, 2, 3, 10]Correct

The `list.insert(index, element)` method inserts an `element` at a specific `index`. For the list `[1, 2, 3, 4]`, inserting `10` at index `2` effectively modifies the list to include `10` after `2` and `3`, resulting in the list `[1, 2, 3, 10]`.

C[1, 2, 10, 4]

This choice incorrectly suggests that an existing element (3) would be removed while inserting at index 2.

D[1, 10,10,10]

This choice incorrectly suggests multiple insertions or replacements, which is not what `list.insert()` does.

Concept tested: Python list `insert()` method

Source: https://docs.python.org/3/tutorial/datastructures.html#more-on-lists

Topics

#Python programming#list manipulation#code execution#variable tracing

Community Discussion

No community discussion yet for this question.

Full 350-401 Practice