107 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

2018-10-13 23:30:21 +03:00
## Which group of operators below is arithmetic operators?
1. **, /, ^, !, ++, --
2. *, /, %, +, - *CORRECT*
3. &, |, +, -, /
## Which value below you can use with a remainder operator?
1. 3.54
2. true
3. 57 *CORRECT*
4. "Try Me!"
2018-10-19 20:31:10 +03:00
> **4:** Nice Try. But, that's not right. Sorry.
>
> **3:** That's right. The remainder operator only works on integer values.
>
2018-10-13 23:30:21 +03:00
## What's the result of this expression?
```go
8 % 3
```
1. 4
2. 2 *CORRECT*
2018-10-13 23:30:21 +03:00
3. 0
4. 1
2018-10-13 23:30:21 +03:00
## What's the result of this expression?
```go
-(3 * -2)
```
1. -6
2. -1
3. 0
4. 6 *CORRECT*
## What's the result of this expression?
```go
var degree float64 = 10 / 4
```
1. 2.5
2. 2.49
3. 2 *CORRECT*
4. 0
2018-10-19 20:31:10 +03:00
> **3:** That's right. An integer value cannot contain fractional parts.
>
2018-10-13 23:30:21 +03:00
## What's the result of this expression?
```go
var degree float64 = 3. / 2
```
1. 1.5 *CORRECT*
2. 1.49
3. 1
4. 0
2018-10-19 20:31:10 +03:00
> **1:** That's right. `3.` makes the whole expression a float value.
>
2018-10-13 23:30:21 +03:00
## What's the type of the `x` variable?
```go
x := 5 * 2.
```
1. int
2. float64 *CORRECT*
3. bool
4. string
2018-10-19 20:31:10 +03:00
> **1:** Look closely to 2 there.
>
> **2:** Why? Because, `2.` there makes the expressions a float value. Cool.
>
> **3:** Oh, come on! Life is not always true and false.
>
> **4:** I can't see any double-quotes or back-quotes, can you?
>
2018-10-13 23:30:21 +03:00
## What's the type of the `x` variable?
```go
x := 5 * -(2)
```
1. int *CORRECT*
2. float64
3. bool
4. string
2018-10-19 20:31:10 +03:00
> **1:** Why? Because, there only integer numbers.
>
> **2:** I can't see any fractional parts there, can you?
>
> **3:** Oh, come on! Life is not always true and false.
>
> **4:** I can't see any double-quotes or back-quotes, can you?
>
2018-10-13 23:30:21 +03:00
## Which kind of values can result in inaccurate calculations?
1. integers
2. floats *CORRECT*
3. bools
4. strings