2018-10-13 23:30:21 +03:00
|
|
|
## 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?
|
|
|
|
```go
|
|
|
|
var s string = "hi"
|
|
|
|
```
|
|
|
|
|
|
|
|
* var s int = "hi"
|
|
|
|
* s := "hi" *CORRECT*
|
|
|
|
* s, p := 2, 3
|
|
|
|
|
|
|
|
## Which declaration is equal to the following declaration?
|
|
|
|
```go
|
|
|
|
var n = 10
|
|
|
|
```
|
|
|
|
|
|
|
|
* n := 10.0
|
|
|
|
* m, n := 1, 0
|
|
|
|
* var n int = 10 *CORRECT*
|
|
|
|
|
|
|
|
## What's the type of the `s` variable?
|
|
|
|
```go
|
|
|
|
s := "hmm..."
|
|
|
|
```
|
|
|
|
|
|
|
|
* bool
|
|
|
|
* string *CORRECT*
|
|
|
|
* int
|
|
|
|
* float64
|
|
|
|
|
|
|
|
## What's the type of the `b` variable?
|
|
|
|
```go
|
|
|
|
b := true
|
|
|
|
```
|
|
|
|
|
|
|
|
* bool *CORRECT*
|
2018-11-18 05:03:43 +08:00
|
|
|
* string
|
2018-10-13 23:30:21 +03:00
|
|
|
* int
|
|
|
|
* float64
|
|
|
|
|
|
|
|
## What's the type of the `i` variable?
|
|
|
|
```go
|
|
|
|
i := 42
|
|
|
|
```
|
|
|
|
|
|
|
|
* bool
|
2018-11-18 05:03:43 +08:00
|
|
|
* string
|
2018-10-13 23:30:21 +03:00
|
|
|
* int *CORRECT*
|
|
|
|
* float64
|
|
|
|
|
|
|
|
## What's the type of the `f` variable?
|
|
|
|
```go
|
|
|
|
f := 6.28
|
|
|
|
```
|
|
|
|
|
|
|
|
* bool
|
2018-11-18 05:03:43 +08:00
|
|
|
* string
|
2018-10-13 23:30:21 +03:00
|
|
|
* int
|
|
|
|
* float64 *CORRECT*
|
|
|
|
|
|
|
|
## What's the value of the `x` variable?
|
|
|
|
|
|
|
|
```go
|
|
|
|
y, x := false, 20
|
|
|
|
```
|
|
|
|
|
|
|
|
* 10
|
|
|
|
* 20 *CORRECT*
|
|
|
|
* false
|
|
|
|
|
|
|
|
## What's the value of the `x` variable?
|
|
|
|
|
|
|
|
```go
|
|
|
|
y, x := false, 20
|
|
|
|
x, z := 10, "hi"
|
|
|
|
```
|
|
|
|
|
|
|
|
* 10 *CORRECT*
|
|
|
|
* 20
|
|
|
|
* false
|
|
|
|
|
2018-11-18 05:03:43 +08:00
|
|
|
## Which of the following declaration can be used in the package scope?
|
2018-10-13 23:30:21 +03:00
|
|
|
|
|
|
|
* x := 10
|
|
|
|
* y, x := 10, 5
|
2020-05-20 22:45:12 +07:00
|
|
|
* var x, y = 5, 10 *CORRECT*
|