0
0
Goprogramming~10 mins

What is Go - Interactive Quiz & Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to print a greeting in Go.

Go
package main

import "fmt"

func main() {
    fmt.[1]("Hello, Go!")
}
Drag options to blanks, or click blank then click option'
APrintln
BPrint
CPrintf
DPrintfln
Attempts:
3 left
๐Ÿ’ก Hint
Common Mistakes
Using Print instead of Println will not add a new line.
2fill in blank
medium

Complete the code to declare a variable with value 10.

Go
package main

func main() {
    var x [1] = 10
}
Drag options to blanks, or click blank then click option'
Abool
Bint
Cfloat
Dstring
Attempts:
3 left
๐Ÿ’ก Hint
Common Mistakes
Using string or bool types for numbers.
3fill in blank
hard

Fix the error in the function declaration.

Go
package main

func [1]() {
    // code
}
Drag options to blanks, or click blank then click option'
Adef
Bfunction
Cfunc
Dmain
Attempts:
3 left
๐Ÿ’ก Hint
Common Mistakes
Using 'function' or 'def' which are not Go keywords.
4fill in blank
hard

Fill both blanks to create a map with string keys and int values.

Go
package main

func main() {
    m := make(map[[1]][2])
}
Drag options to blanks, or click blank then click option'
Astring
Bint
Cfloat64
Dbool
Attempts:
3 left
๐Ÿ’ก Hint
Common Mistakes
Mixing up key and value types.
5fill in blank
hard

Fill all three blanks to declare a slice of strings and add an element.

Go
package main

import "fmt"

func main() {
    var s [][1]
    s = append(s, [2])
    fmt.[3](s)
}
Drag options to blanks, or click blank then click option'
Aint
B"hello"
CPrintln
Dstring
Attempts:
3 left
๐Ÿ’ก Hint
Common Mistakes
Using int instead of string for the slice type.