Direction: Choose the correct option
Q1.
What is an iterator in Python?
Direction: Choose the correct option
Q2.
What does the `iter()` function do?
Direction: Choose the correct option
Q3.
What is a generator in Python?
Direction: Choose the correct option
Q4.
What does `yield` do in a function?
Direction: Choose the correct option
Q5.
How do you iterate over a generator?
Direction: Choose the correct option
Q6.
What is the output of `def gen(): yield 1; yield 2; list(gen())`?
Direction: Choose the correct option
Q7.
What is the difference between a list comprehension and a generator expression?
Direction: Choose the correct option
Q8.
What happens when a generator is exhausted?
Direction: Choose the correct option
Q9.
Can a generator be used only once?
Direction: Choose the correct option
Q10.
What is the purpose of `yield from`?
