TutorialPedia.org
Toggle Menu
Home
Online Go Compiler
Tutorials
JavaScript Tutorials
Golang Tutorials
Linux Command Line Tutorials
Blog
All Posts
Go Concurrency Patterns
Test your understanding of Goroutines,channels,and concurrency patterns in Go.
1. What is the primary keyword used to start a concurrent execution in Go?
thread
go
concur
goroutine
2. Which of the following are synchronization primitives provided by the sync package?
sync.WaitGroup
sync.Mutex
sync.Channel
sync.Cond
3. A goroutine is managed by the operating system kernel.
True
False
4. What package provides the WaitGroup type for synchronizing goroutines?
5. Which pattern involves multiple goroutines processing tasks and sending results to a single channel?
Worker Pool
Fan-out/Fan-in
Rate Limiting
Context Propagation
6. Which operations on an unbuffered channel block until the other side is ready?
Sending a value
Receiving a value
Closing the channel
Checking channel length
7. The select statement can execute multiple case clauses simultaneously.
True
False
8. What method of sync.WaitGroup is used to decrement its counter when a goroutine finishes?
9. What is the primary purpose of the context package?
Creating buffered channels
Managing goroutine lifecycles and cancellation
Implementing worker pools
Synchronizing mutexes
10. Which of the following are considered Go concurrency patterns?
Fan-out/Fan-in
Observer
Rate Limiting
Worker Pool
Singleton
11. A buffered channel with capacity 3 blocks when sending the 4th element without a corresponding receive.
True
False
12. What keyword is used to declare a channel variable in Go?
13. Which statement allows a goroutine to wait on multiple channel operations?
switch
select
case
go
14. Which are characteristics of unbuffered channels?
Capacity of 0
Send blocks until receive is ready
Created with make(chan T, 1)
Receive blocks until send is ready
15. The sync.Mutex type provides exclusive access to shared resources.
True
False
16. What happens when you send a value to a closed channel?
17. Which pattern limits the number of operations allowed in a given time period?
Fan-out
Rate Limiting
Fan-in
Worker Pool
18. Which methods are part of sync.WaitGroup?
Add
Start
Done
Wait
Close
19. Goroutines continue executing after the main function exits.
True
False
20. What term describes the pattern where a single goroutine distributes tasks to multiple worker goroutines?
Reset
Answered 0 of 0 — 0 correct