102 lines
1.3 KiB
Markdown
102 lines
1.3 KiB
Markdown
![]() |
## 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*
|
||
|
* string
|
||
|
* int
|
||
|
* float64
|
||
|
|
||
|
## What's the type of the `i` variable?
|
||
|
```go
|
||
|
i := 42
|
||
|
```
|
||
|
|
||
|
* bool
|
||
|
* string
|
||
|
* int *CORRECT*
|
||
|
* float64
|
||
|
|
||
|
## What's the type of the `f` variable?
|
||
|
```go
|
||
|
f := 6.28
|
||
|
```
|
||
|
|
||
|
* bool
|
||
|
* string
|
||
|
* 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
|
||
|
|
||
|
## Which following declaration can be used in the package scope?
|
||
|
|
||
|
* x := 10
|
||
|
* y, x := 10, 5
|
||
|
* var x, y = 5, 10
|