Test Your Knowledge of Go Concurrency
waywardfriar
Created 6/19/2024
Do you think you know everything about Go concurrency? Take this quiz to find out!
1. What keyword is used to start a goroutine in Go?
2. Which of the following is used to synchronize goroutines?
map
sync.WaitGroup
strings
io.Reader
3. What is the purpose of the 'select' statement in Go?
To handle asynchronous I/O operations
To select an element from a slice
To randomly execute one of several code branches
To manage multiple channel operations
4. How do you create an unbuffered channel in Go?
ch := make(chan int, 0)
ch := make(chan int)
ch := make(chan int, -1)
ch := makeBufferedChannel()
5. What does the keyword 'defer' do in the context of Go concurrency?
Delays the execution of a function until a certain condition is met
Immediately terminates the currently executing goroutine
Schedules a function call to be run after the function completes
Pauses the execution of a goroutine temporarily