What will be the output of the following code snippet?
package main
import "fmt"
func main() {
a := 5
b := &a
*b = 10
fmt.Println(a)
}
What is the output of the following code snippet?
package main
import "fmt"
func main() {
var x int = 10
var p *int = &x
*p = 20
fmt.Println(x)
}
What is the output of the following code snippet?
package main
import "fmt"
func main() {
arr := [3]int{1, 2, 3}
ptr := &arr[0]
ptr++
fmt.Println(*ptr)
}
What is the output of the following code?
package main
import "fmt"
func main() {
a := []int{1, 2, 3}
b := make([]int, len(a))
copy(b, a)
fmt.Println(b)
}
What is the purpose of a switch statement in Go Lang?
What is the purpose of the break keyword in a Go Lang loop?
What is the output of the following code snippet?
package main
import "fmt"
func main() {
var ptr *int
x := 10
ptr = &x
if ptr != nil {
fmt.Println(*ptr)
} else {
fmt.Println("ptr is nil")
}
}
What will be the output of the following code snippet?
package main
import "fmt"
func main() {
arr := [5]int{1, 2, 3, 4, 5}
slice := arr[1:3]
slice = append(slice, 6)
fmt.Println(arr)
}
What is the purpose of the continue keyword in a Go Lang for loop?
What will be the output of the following code snippet?
package main
import "fmt"
type person struct {
name string
age int
}
func main() {
p1 := person{name: "John", age: 30}
p2 := p1
p2.age = 40
fmt.Println(p1)
}