Go Quizes, Golang Quizes - 02

Golang quiz or Go quiz , Solve following golang MCQs quizzes. These questions are mcq so based on their output choose any one of the correct options. You can ask your queries related to these questions in comment, we will try to answer your query.

 


 

1. How to print boolean value in Go?





 

2. How to print HexaDecimal value in GO?





 

3. What is output of following code snippet?


package main

import "fmt"

func main() {
	const freezingF, boilingF = 32.0, 212.0
	fmt.Printf("%g°F = %g°C\n", freezingF, fToC(freezingF)) 
}
func fToC(f float64) float64 {
	return (f - 32) * 5 / 9
}





 

3.What is output of the following go code ?

 
package main

import (
	"fmt"
	"strconv"
)

func main() {
	i := 2
	s := "1000"
	if len(s) > 1 {
		i, _ := strconv.Atoi(s)
		i = i + 5
	}
	fmt.Println(i)
}





 

4. What Value assigned when intialize a value in Go?

 var a int
 var s string
 var b bool




 

5. Is the below statement supported in GO?


var b, f, sp = true, 2.3, "four"





Post a Comment

1 Comments

  1. The answer to the 3rd question is incorrect. The correct answer is '32°F = 0°C'

    ReplyDelete