Go Quiz Part-03

Below is the Golang Mcq's question which provide us to know better understanding of the Go programming language.  These question are very basic but solving these we able to understand that how good our fundamental is.

Go mqc


 

1. Which type is synonym of rune?





 

2. What is output for following code snippet?


func main() {
	var apples int32 = 1
	var oranges int16 = 2
	var compote int = apples + oranges
	fmt.Println(compote)
}	





 

3. Which statement is correct for Conversions from integers to string.?





 

4.What is the output of following code snippet?


package main

import (
	"fmt"
)

type Currency int

const (
	USD Currency = iota
	EUR
	GBP
	RMB
)

func main() {
	symbol := [...]string{USD: "$", EUR: " 9 ", GBP: " ! ", RMB: "*"}
	fmt.Println(RMB, symbol[RMB])

}






 

5. What is output for following code snippet?

	
package main

import (
	"fmt"
)

func main() {
	q := [3]int{1, 2, 3}
	q = [4]int{2, 3, 4}
	fmt.Println(q)
}

	
  




Post a Comment

0 Comments