Olete.in
Articles
Mock Tests
🧪 Go Lang MCQ Quiz Hub
Go Lang mcq
Choose a topic to test your knowledge and improve your Go Lang skills
1. what is the output of below code snippet package main import ( "fmt" ) func main() { var x int lstArray := [3]int{1, 2, 3} x, lstArray = lstArray[0], lstArray[1:] fmt.Println( x, lstArray) }
1 [2,3]
1 [1,2,3]
Error
None of the above
2. what is the output of below code snippet package main import ( "fmt" ) func main() { var x int lstArray := []int{1, 2, 3} x, lstArray = lstArray[0], lstArray[1:] fmt.Println( x, lstArray) }
[1,2,3]
. 1 [2,3]
Error
None of the above
3. what is the output of below code snippet? package main import ( "fmt" ) func main() { var x int lstArray := [...]int{1, 2, 3} x, lstArray = lstArray[0], lstArray[1:] fmt.Println(x, lstArray) }
1 [1 2 3]
1 [2 3]
Error
None of the above
4. What is the output of below code snippet? package main import ( "fmt" ) func main() { x := [2]int{1,2} r := [...]int{1,2} fmt.Println(x==r) }
False
Compile time Error
Run time Error
True
5. What is the output of below code snippet? package main import ( "fmt" ) func ElementChange(x [3]int) { x[2] = 5 } func main() { x := [3]int{1, 2} ElementChange(x) fmt.Println(x) }
.[1 2 5]
[1 2]
[1 2 0]
None of the above
6. What is the output of below code snippet?package mainimport ( "fmt")func main() { x := [...]string{1:"xyz", 2:"pqr"} fmt.Println(x[0],x[1])}
Space xyz
only xyz
xyz pqr
None of the above
7. what is the output of below code snippet package main import "fmt" func main() { fmt.Println("Hello " + "World") }
.Hello
Hello World
Compile error
None of the above
Submit