🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Iterators and Generators: all 10 questions

Quiz: Iterators and Generators · Question 9 of 10

What does yield from [4, 5] do inside a generator?

What does yield from [4, 5] do inside a generator?

  1. A.Yields the list [4, 5] as one value
  2. B.Yields 4 and then 5, one at a time
  3. C.Returns the list and ends the generator
  4. D.Raises a SyntaxError
Answer & explanation

Correct answer: Yields 4 and then 5, one at a time

yield from hands out every item of the iterable separately.

Can you get the rest right without peeking?

Take the timed Quiz: Iterators and Generators quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →