1. Which of the following is syntactically correct about channel?

  • A. var ch chan int
  • B. ch := make(chan int)
  • C. <- ch
  • D. ch <-

2. What does the following code output?

  • A.0
  • B.1
  • C.Compilation error
type person struct {  
    name string
}

func main(a) {  
    var m map[person]int
    p := person{"mike"}
    fmt.Println(m[p])
}
Copy the code

3. What does the following code output?

  • A.18
  • B.5
  • C.Compilation error
func hello(num ...int) {  
    num[0] = 18
}

func main(a) {  
    i := []int{5.6.7}
    hello(i...)
    fmt.Println(i[0])}Copy the code

Check out “Golang is coming” or visit seekload.net for answers and the latest interview questions.