Logo

Golang Questions Set 5:

Quiz Mode

Which keyword is used to recover from a panic in Go?

1
2
3
4

Solution:

Which keyword is used to create a new instance of a struct in Go?

1
2
3
4

Solution:

Which Go package provides functions for handling errors that are returned by functions in a uniform way?

1
2
3
4

Solution:

What is the output of the following code:

func change(x *int) {

*x = 5

}

func main() {

y := 10

change(&y)

fmt.Println(y)

}

1
2
3
4

Solution:

What is the output of the following code: fmt.Println(1 == 1.0)

1
2
3
4

Solution:

What happens when you dereference a nil pointer in Go?

1
2
3
4

Solution:

Which of the following is NOT a valid way to define an interface method in Go?

1
2
3
4

Solution:

What is an empty interface in Go?

1
2
3
4

Solution:

Which of the following statements is true about the panic function in Go?

1
2
3
4

Solution:

What is the purpose of a defer statement in Go?

1
2
3
4

Solution: