1.4 KiB
1.4 KiB
Which is a correct declaration?
- var int safe := 3
- var safe bool := 3
- safe := true CORRECT
Which is a correct declaration?
- var short := true
- int num := 1
- speed := 50 CORRECT
- num int := 2
Which is a correct declaration?
- x, y, z := 10, 20
- x = 10,
- y, x, p := 5, "hi", 1.5 CORRECT
- y, x = "hello", 10
Which declaration is equal to the following declaration?
var s string = "hi"
- var s int = "hi"
- s := "hi" CORRECT
- s, p := 2, 3
Which declaration is equal to the following declaration?
var n = 10
- n := 10.0
- m, n := 1, 0
- var n int = 10 CORRECT
What's the type of the s
variable?
s := "hmm..."
- bool
- string CORRECT
- int
- float64
What's the type of the b
variable?
b := true
- bool CORRECT
- string
- int
- float64
What's the type of the i
variable?
i := 42
- bool
- string
- int CORRECT
- float64
What's the type of the f
variable?
f := 6.28
- bool
- string
- int
- float64 CORRECT
What's the value of the x
variable?
y, x := false, 20
- 10
- 20 CORRECT
- false
What's the value of the x
variable?
y, x := false, 20
x, z := 10, "hi"
- 10 CORRECT
- 20
- false
Which of the following declaration can be used in the package scope?
- x := 10
- y, x := 10, 5
- var x, y = 5, 10 CORRECT