2 of 152 of 15 Items

Question
A loop iterates over a list and removes from the list any items that aren’t greater than 25. Which kind of error is most likely to occur in this program?

(1 point)
Responses

division by zero

division by zero

index out of range

index out of range

not enough memory

not enough memory

data type mismatch

data type mismatch
Skip to navigation

1 answer

The most likely error to occur when iterating over a list and removing items from it is "index out of range."

This can happen because when you remove items from a list while iterating over it, the size of the list changes, which can lead to trying to access an index that no longer exists.

In contrast, the other errors listed (division by zero, not enough memory, data type mismatch) are less relevant to the specific operation of removing items from a list.