Golang quiz questions - Part 05

The fifth portion of the Golang quiz will be covered in this post. We've included several MCQs based on basic programming problems in Golang. Please answer these questions correctly by selecting the appropriate alternatives. This article aims to see how our Golang fundamentals are doing.

This is part of a golang quiz for interview preparation; we have previously released several quizzes based on python and other languages; please check them out and let us know if there are any modifications that need to be made.

 

golang quiz

 

 

1. what is the output of below code snippet

package main

import (
        "fmt"
        "strings"
)

func main() {
        var str strings.Builder

        str.WriteString("a")
        str.WriteString("b")
        str.WriteString("c")

        fmt.Println(str.String())
}




 

2. which type is alias of "rune"?





 

3. what is the output of below code snippet?

package main

import (
        "fmt"
)

const(
        a = 3
)

func main() {
        a = 5
        fmt.Println(a)
}




 

4. what is the output of below code snippet?

package main

import (
        "fmt"
        "strconv"
)


func main() {
        str := "abc"
        fmt.Println(str+"_xyz")
}




 

5. what is the := operator?





Post a Comment

0 Comments