Skip to content
Sharp

Iterators and Generators · interview question

What does a strong engineer do when reasoning through iterator protocol code?

Multiple choiceHardchapter-8-curatedpremiumiterators-and-generatorsiterator-protocol
python
numbers = iter([1, 2, 3])
print(next(numbers))
print(next(numbers))
Choose one answer
Answer and explanation

Correct answer

C. Narrate the data shape, the state changes, and the exact rule order step by step.

Why

Interviewers often use simple code to test whether you can reason through execution without bluffing.

Test yourself on Iterators and Generators

A free test with instant, explained results. No account needed.

Start free test
All Iterators and Generators questions →