Advanced Swift
Q99 / 100

What is the difference between Task and TaskGroup in structured concurrency?

Correct! Well done.

Incorrect.

The correct answer is B) Task creates a single async work unit; TaskGroup creates a dynamic set of concurrent child tasks with structured lifetimes and result collection

B

Correct Answer

Task creates a single async work unit; TaskGroup creates a dynamic set of concurrent child tasks with structured lifetimes and result collection

Explanation

withTaskGroup(of: T.self) { group in group.addTask { work1() }; group.addTask { work2() }; for try await result in group { collect(result) } } manages dynamic concurrency.

Progress
99/100