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.
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")
}
0 Comments