Challenge - 5 Problems
Go Structure Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
โ Predict Output
intermediate2:00remaining
Output of a simple Go program
What is the output of this Go program?
Go
package main import "fmt" func main() { fmt.Println("Hello, Go!") }
Attempts:
2 left
๐ก Hint
Look at the exact string inside fmt.Println and remember Go is case-sensitive.
โ Incorrect
The program prints exactly what is inside the quotes with correct capitalization.
โ Predict Output
intermediate2:00remaining
Variable declaration and output
What will this Go program print?
Go
package main import "fmt" func main() { var x int = 5 fmt.Println(x) }
Attempts:
2 left
๐ก Hint
The variable x is assigned 5 before printing.
โ Incorrect
The program prints the value of x, which is 5.
โ Predict Output
advanced2:00remaining
Understanding package and import
What error does this Go program produce?
Go
package main func main() { fmt.Println("Hi") }
Attempts:
2 left
๐ก Hint
Check if the fmt package is imported before using it.
โ Incorrect
The program uses fmt.Println but does not import fmt, causing undefined error.
โ Predict Output
advanced2:00remaining
Multiple functions and main execution
What is the output of this Go program?
Go
package main import "fmt" func greet() { fmt.Println("Hello") } func main() { greet() fmt.Println("World") }
Attempts:
2 left
๐ก Hint
Functions run in the order they are called inside main.
โ Incorrect
The greet function prints Hello, then main prints World on a new line.
๐ง Conceptual
expert2:00remaining
Go program entry point and package rules
Which statement about Go program structure is correct?
Attempts:
2 left
๐ก Hint
Think about what Go requires to start running a program.
โ Incorrect
Go requires package main and main() as the entry point for executables.