Recall & Review
beginner
What is the basic structure of a Go program?
A Go program starts with a
package main declaration, followed by an import statement for packages, and a func main() function where the program begins execution.Click to reveal answer
beginner
What does the
func main() function do in a Go program?The
func main() function is the entry point of a Go program. It is where the program starts running.Click to reveal answer
beginner
How do you print text to the console in Go?
You use the
fmt.Println() function from the fmt package to print text to the console.Click to reveal answer
beginner
What package must you import to use <code>fmt.Println()</code>?You must import the <code>fmt</code> package using <code>import "fmt"</code>.Click to reveal answer
beginner
Why do Go programs start with
package main?The
package main tells Go this is an executable program, not a library. It must have a main function to run.Click to reveal answer
What keyword starts a Go program's main file?
✗ Incorrect
Every Go executable program starts with the keyword
package main.Which function is the entry point of a Go program?
✗ Incorrect
The
func main() function is where the program begins execution.How do you print "Hello, World!" in Go?
✗ Incorrect
Use
fmt.Println("Hello, World!") to print text in Go.Which package do you import to use
fmt.Println()?✗ Incorrect
The
fmt package provides formatted I/O functions like Println.What happens if you omit
package main in a Go program?✗ Incorrect
Without
package main, the code is treated as a library, not an executable program.Describe the steps to write and run your first Go program that prints "Hello, World!".
Think about the structure and the print statement.
You got /5 concepts.
Explain why the
main function and package main are essential in a Go program.Focus on program start and type.
You got /4 concepts.