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

Quiz: LLM Workflow Patterns · Question 6 of 10

What does this print? (code)

What does this print?

from concurrent.futures import ThreadPoolExecutor
import time

def work(n):
    time.sleep(0.05 * (3 - n))
    return n * 10

with ThreadPoolExecutor(max_workers=3) as pool:
    print(list(pool.map(work, [0, 1, 2])))
  1. A.[20, 10, 0]
  2. B.[0, 10, 20]
  3. C.[0, 1, 2]
  4. D.The order is random
Answer & explanation

Correct answer: [0, 10, 20]

pool.map returns results in input order, even though the calls finish in a different order.

Can you get the rest right without peeking?

Take the timed Quiz: LLM Workflow Patterns quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →