Recall & Review
beginner Click to reveal answer
What does fmt.Println do in Go?
It prints the given values to the console followed by a new line, making output easy to read.
beginner Click to reveal answer
How do you print multiple values with fmt.Println?
You separate values by commas inside fmt.Println, and it prints them with spaces in between.
beginner Click to reveal answer
What happens if you use fmt.Println without any arguments?
It prints just a new line, moving the cursor to the next line in the console.
beginner Click to reveal answer
Write a simple Go code snippet using fmt.Println to print "Hello, friend!"
package main
import "fmt"
func main() {
fmt.Println("Hello, friend!")
}beginner Click to reveal answer
Why is fmt.Println preferred for quick output in Go programs?
Because it automatically adds spaces between values and a new line at the end, making output formatting simple.
What does fmt.Println add automatically after printing the values?
✗ Incorrect
fmt.Println adds a new line after printing the values, so the next output starts on a new line.
How do you print the values 5 and 10 separated by a space using fmt.Println?
✗ Incorrect
Using commas inside fmt.Println prints each value separated by spaces automatically.
Which package must you import to use fmt.Println?
✗ Incorrect
The fmt package contains the Println function for output.
What will fmt.Println() print if called with no arguments?
✗ Incorrect
Calling fmt.Println with no arguments prints only a new line.
Which of these is a correct way to print "Go is fun" using fmt.Println?
✗ Incorrect
Strings must be in double quotes in Go to be printed correctly.
Explain how fmt.Println works and why it is useful for output in Go.
Think about what happens when you print multiple things and how the output looks.
You got /4 concepts.
Write a short Go program that prints your name using fmt.Println.
Remember the basic structure of a Go program and how to print text.
You got /4 concepts.
