Logo

Golang Questions Set 6:

Quiz Mode

Can a function in Go accept a function as a parameter?

1
2

Solution:

Which keyword is used to define a function in Go?

1
2
3
4

Solution:

What is the keyword used to declare a constant in Go?

1
2
3
4

Solution:

Which of the following is NOT a way to handle errors in Go?

1
2
3
4

Solution:

What is a function signature in Go?

1
2
3
4

Solution:

Which of the following is a valid way to check for an error in Go?

1
2
3
4

Solution:

What is an interface in Go?

1
2
3
4

Solution:

Which of the following is the correct syntax to define a function that takes a pointer as an argument in Go?

1
2
3
4

Solution:

What is the output of the following Go program?

package main

import "fmt"


func main() {

  x := map[string]int{"one": 1, "two": 2, "three": 3}

  for key, value := range x {

    if value == 2 {

      delete(x, key)

    }

  }

  fmt.Println(len(x))

}


Solution:

Which of the following is true about passing a pointer to a function in Go?

1
2
3
4

Solution: