Recall & Review
beginner
What is a channel in Go?
A channel in Go is a way to send and receive values between different goroutines safely and synchronously.
Click to reveal answer
beginner
How do you create an unbuffered channel of integers in Go?
Use
make(chan int) to create an unbuffered channel that sends and receives integers.Click to reveal answer
intermediate
What is the difference between buffered and unbuffered channels?
Unbuffered channels block the sender until the receiver is ready. Buffered channels allow sending a limited number of values without blocking.
Click to reveal answer
beginner
How do you create a buffered channel with capacity 3 for strings?
Use
make(chan string, 3) to create a buffered channel that can hold 3 strings without blocking the sender.Click to reveal answer
intermediate
Why should channels be created before using them?
Channels must be created with
make before use because they are references to data structures that manage communication. Using a nil channel causes deadlock.Click to reveal answer
How do you create an unbuffered channel of type int in Go?
✗ Incorrect
Use make(chan int) to create an unbuffered channel of integers.
What happens when you send to an unbuffered channel with no receiver ready?
✗ Incorrect
Sending to an unbuffered channel blocks the sender until a receiver receives the value.
How do you create a buffered channel with capacity 5 for float64 values?
✗ Incorrect
Use make(chan float64, 5) to create a buffered channel with capacity 5.
What is the default value of a channel variable before creation?
✗ Incorrect
A channel variable is nil before it is created with make.
Which keyword is used to create a channel in Go?
✗ Incorrect
Channels are created using the make keyword.
Explain how to create both unbuffered and buffered channels in Go and when you might use each.
Think about how channels control communication between goroutines.
You got /6 concepts.
Describe what happens if you try to send or receive on a nil channel in Go.
Consider what happens when a channel is not initialized.
You got /4 concepts.