Home > Internet Programming > Quizzes > Go (Programming Language) Quiz
Go (Programming Language) Quiz
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 20% Most missed: “How is the behavior of 't.Fatal' different inside a 't.Run'?”

Go (Programming Language) MCQs For LinkedIn Skill Assessments.

Go (Programming Language) Quiz
Time left 00:00
25 Questions

1. Which is _not_ a valid loop construct in Go?
2. What is a channel?
3. What is an idiomatic way to pause execution of the current scope until an arbitrary number of goroutines have returned?
4. What is the common way to have several executables in your project?
5. What is the difference between the 'time' package’s 'Time.Sub()' and 'Time.Add()' methods?
6. What is the correct syntax ta start a goroutine that will 'print Hello Gopher!'?
7. How do you tell 'go test' to print out the tests it is running?
8. Which is the _only_ valid import statement in Go?
9. From where is the variable 'myVar' accessible if it is declared outside of any functions in a file in package 'myPackage' located inside module 'myModule'?
10. Which file names will the 'go test' command recognize as test files?
11. What should the idiomatic name be for an interface with a single method and the signature 'Save() error'?
12. What is an idiomatic way to customize the representation of a custom struct in a formatted string?
13. How can you compile main.go to an executable that will run on OSX arm64 ?
14. How will you add the number 3 to the right side?
'values := []int{1, 1, 2}'
15. If you iterate over a map in a for range loop, in which order will the key:value pairs be accessed?
16. What is the risk of using multiple field tags in a single struct?
17. This code printed '{0, 0}'. How can you fix it?
go
type Point struct {
x int
y int
}
func main() {
data := []byte('{'x':1, 'y': 2}')
var p Point
if err := json.Unmarshal(data, &p); err != nil {
fmt.Println('error: ', err)
} else {
fmt.Println(p)
}
}
18. What would happen if you attempted to compile and run this Go program?
go
package main
var GlobalFlag string
func main() {
print('['+GlobalFlag+']')
}
19. What do you need for two functions to be the same type?
20. What will be the output of this code?

ch := make(chan int)
ch <- 7
val := <-ch
fmt.Println(val)
21. What is the select statement used for?
22. What will be the output of this program?

ch := make(chan int)
close(ch)
val := <-ch
fmt.Println(val)
23. What will be printed in this code?

var stocks map[string]float64 // stock -> price
price := stocks['MSFT']
fmt.Printf('%f\n', price)
24. If your current working directory is the top level of your project, which command will run all its test packages?
25. Which choice does _not_ send output to standard error?