First steps in Go
by Kwiz
Qs
20
Difficulty
Junior
Plays
3
Record
n/a
Description

This Go programming quiz is for beginners dipping their toes into the language. It covers basics related to writing your first program in Go.

This quiz is adapted from the Learn Go Github: https://github.com/inancgumus/learngo/ and was originally created by Go expert Inanc Gumus http://twitter.com/inancgumus

Question Preview
Where should you save your Go source code?
Question Preview
What does $GOPATH mean?
Question Preview
Do you need to set $GOPATH?
Question Preview
How can you print $GOPATH?
Question Preview
Which keyword below do you need use to define a package?
package main

func main() {
}
Question Preview
What is the purpose of using package main in the following program?
package main

func main() {
}
Question Preview
What is the purpose of func main in the following program?
package main

func main() {
}
Question Preview
What is the purpose of import "fmt" in the following program?
package main
import "fmt"

func main() {
    fmt.Println("Hi!")
}
Question Preview
Which keyword is used to declare a new function?
Question Preview
What is a function?
Question Preview
Do you have to call the main function yourself?
Question Preview
Do you have to call a function to execute it? (except the main func)
Question Preview
What does the following program print?
package main

func main() {
}
Question Preview
What does this program print?
package main

func main() {
    fmt.Println(Hi! I want to be a Gopher!)
}
Question Preview
What does this program print?
package main
import "fmt"

func main() {
    fmt.Println("Hi there!")
}
Question Preview
What is the difference between go build and go run?
Question Preview
Go saves the compiled code in a directory. What is the name of that directory?
Question Preview
Which is true for runtime?
Question Preview
Which is true for the compile-time?
Question Preview
When can a Go program print a message to the console?