fix: massive questions markdown fix
This commit is contained in:
@@ -10,8 +10,12 @@
|
||||
3. 57 *CORRECT*
|
||||
4. "Try Me!"
|
||||
|
||||
> 4. Nice Try. But, that's not right. Sorry.
|
||||
> 3. That's right. The remainder operator only works on integer values.
|
||||
> **4:** Nice Try. But, that's not right. Sorry.
|
||||
>
|
||||
>
|
||||
> **3:** That's right. The remainder operator only works on integer values.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## What's the result of this expression?
|
||||
@@ -43,7 +47,9 @@ var degree float64 = 10 / 4
|
||||
3. 2 *CORRECT*
|
||||
4. 0
|
||||
|
||||
> 3. That's right. An integer value cannot contain fractional parts.
|
||||
> **3:** That's right. An integer value cannot contain fractional parts.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## What's the result of this expression?
|
||||
@@ -55,7 +61,9 @@ var degree float64 = 3. / 2
|
||||
3. 1
|
||||
4. 0
|
||||
|
||||
> 1. That's right. `3.` makes the whole expression a float value.
|
||||
> **1:** That's right. `3.` makes the whole expression a float value.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## What's the type of the `x` variable?
|
||||
@@ -67,10 +75,18 @@ x := 5 * 2.
|
||||
3. bool
|
||||
4. string
|
||||
|
||||
> 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?
|
||||
> **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?
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## What's the type of the `x` variable?
|
||||
@@ -82,10 +98,18 @@ x := 5 * -(2)
|
||||
3. bool
|
||||
4. string
|
||||
|
||||
> 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?
|
||||
> **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?
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## Which kind of values can result in inaccurate calculations?
|
||||
|
@@ -41,4 +41,6 @@
|
||||
4. -12
|
||||
5. -12.0 *CORRECT*
|
||||
|
||||
> 4. You're close but remember! The result of an expression with floats and integers is always a float.
|
||||
> **4:** You're close but remember! The result of an expression with floats and integers is always a float.
|
||||
>
|
||||
>
|
@@ -7,9 +7,15 @@ var n float64
|
||||
3. `n = n + 1` *CORRECT*
|
||||
4. `++n`
|
||||
|
||||
> 1. This just assigns 1 to n.
|
||||
> 2. IncDec statement can't be used as an operator.
|
||||
> 4. Go doesn't support prefix incdec notation.
|
||||
> **1:** This just assigns 1 to n.
|
||||
>
|
||||
>
|
||||
> **2:** IncDec statement can't be used as an operator.
|
||||
>
|
||||
>
|
||||
> **4:** Go doesn't support prefix incdec notation.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## Which expression decreases `n` by 1?
|
||||
@@ -21,9 +27,15 @@ var n int
|
||||
3. `n = n - 1` *CORRECT*
|
||||
4. `--n`
|
||||
|
||||
> 1. This just assigns -1 to n.
|
||||
> 2. IncDec statement can't be used as an operator.
|
||||
> 4. Go doesn't support prefix incdec notation.
|
||||
> **1:** This just assigns -1 to n.
|
||||
>
|
||||
>
|
||||
> **2:** IncDec statement can't be used as an operator.
|
||||
>
|
||||
>
|
||||
> **4:** Go doesn't support prefix incdec notation.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## Which code below equals to `n = n + 1`?
|
||||
@@ -32,9 +44,15 @@ var n int
|
||||
3. `++n`
|
||||
4. `n = n ++ 1`
|
||||
|
||||
> 2. IncDec statement can't be used as an operator.
|
||||
> 3. Go doesn't support prefix incdec notation.
|
||||
> 4. What's that? ++?
|
||||
> **2:** IncDec statement can't be used as an operator.
|
||||
>
|
||||
>
|
||||
> **3:** Go doesn't support prefix incdec notation.
|
||||
>
|
||||
>
|
||||
> **4:** What's that? ++?
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## Which code below equals to `n = n + 1`?
|
||||
@@ -43,9 +61,15 @@ var n int
|
||||
3. `++n`
|
||||
4. `n = n ++ 1`
|
||||
|
||||
> 1. IncDec statement can't be used as an operator.
|
||||
> 3. Go doesn't support prefix incdec notation.
|
||||
> 4. What's that? ++?
|
||||
> **1:** IncDec statement can't be used as an operator.
|
||||
>
|
||||
>
|
||||
> **3:** Go doesn't support prefix incdec notation.
|
||||
>
|
||||
>
|
||||
> **4:** What's that? ++?
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## Which code below equals to `n -= 1`?
|
||||
@@ -54,9 +78,15 @@ var n int
|
||||
3. `n--` *CORRECT*
|
||||
4. `--n`
|
||||
|
||||
> 1. IncDec statement can't be used as an operator.
|
||||
> 2. IncDec statement can't be used as an operator. And also, you can't use it with `1--`. The value should be addressable. You're going to learn what that means soon.
|
||||
> 4. Go doesn't support prefix incdec notation.
|
||||
> **1:** IncDec statement can't be used as an operator.
|
||||
>
|
||||
>
|
||||
> **2:** IncDec statement can't be used as an operator. And also, you can't use it with `1--`. The value should be addressable. You're going to learn what that means soon.
|
||||
>
|
||||
>
|
||||
> **4:** Go doesn't support prefix incdec notation.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## Which code below divides the `length` by 10?
|
||||
@@ -64,9 +94,15 @@ var n int
|
||||
2. `length /= 10` *CORRECT*
|
||||
3. `length //= 10`
|
||||
|
||||
> 1. What's that? `//`?
|
||||
> 2. That's right. This equals to: `length = length / 10`
|
||||
> 3. What's that? `//=`?
|
||||
> **1:** What's that? `//`?
|
||||
>
|
||||
>
|
||||
> **2:** That's right. This equals to: `length = length / 10`
|
||||
>
|
||||
>
|
||||
> **3:** What's that? `//=`?
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## Which code below equals to `x = x % 2`?
|
||||
@@ -74,8 +110,12 @@ var n int
|
||||
2. `x =% x`
|
||||
3. `x %= x` *CORRECT*
|
||||
|
||||
> 1. This is a division. You need to use the remainder operator.
|
||||
> 2. Close... But, the `%` operator is on the wrong side of the assignment.
|
||||
> **1:** This is a division. You need to use the remainder operator.
|
||||
>
|
||||
>
|
||||
> **2:** Close... But, the `%` operator is on the wrong side of the assignment.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## Which function below converts a string value into a float value?
|
||||
@@ -95,4 +135,6 @@ func ParseFloat(s string, bitSize int) (float64, error)
|
||||
3. `strconv.ParseFloat("10", "64")`
|
||||
4. `strconv.ParseFloat(10, 64)`
|
||||
|
||||
> 1. There are no 128-bit floating point values in Go (Actually there are, but they only belong to the compile-time).
|
||||
> **1:** There are no 128-bit floating point values in Go (Actually there are, but they only belong to the compile-time).
|
||||
>
|
||||
>
|
@@ -8,8 +8,12 @@
|
||||
3. "Hello" `"World"`
|
||||
4. "\"Hello\" `\"World\"`"
|
||||
|
||||
> 1. Go doesn't interpret the escape sequences in raw string literals.
|
||||
> 2. That's right. Go interprets `\"` as `"` but it doesn't do so for ` \"World\"`.
|
||||
> **1:** Go doesn't interpret the escape sequences in raw string literals.
|
||||
>
|
||||
>
|
||||
> **2:** That's right. Go interprets `\"` as `"` but it doesn't do so for ` \"World\"`.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## What's the best way to represent the following text in the code?
|
||||
@@ -57,8 +61,11 @@
|
||||
</xml>`
|
||||
```
|
||||
|
||||
> 2-3. You can't write a string literal like that. It can't be multiple-lines.
|
||||
> 4. You don't need to use escape sequences inside raw string literals.
|
||||
> **2-3:** You can't write a string literal like that. It can't be multiple-lines.
|
||||
>
|
||||
> **4:** You don't need to use escape sequences inside raw string literals.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## What's the result of the following expression?
|
||||
@@ -71,7 +78,9 @@ len("lovely")
|
||||
3. 6 *CORRECT*
|
||||
4. 0
|
||||
|
||||
> 2. Remember! "a" is 1 char. `a` is also 1 char.
|
||||
> **2:** Remember! "a" is 1 char. `a` is also 1 char.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## What's the result of the following expression?
|
||||
@@ -84,10 +93,18 @@ len("very") + len(`\"cool\"`)
|
||||
3. 16
|
||||
4. 10
|
||||
|
||||
> 1. There are also double-quotes, count them as well.
|
||||
> 2. That's right. Go doesn't interpreted \" in raw string literals.
|
||||
> 3. Remember! "very" is 4 characters. `very` is also 4 characters.
|
||||
> 4. Remember! Go doesn't interpreted \" in raw string literals.
|
||||
> **1:** There are also double-quotes, count them as well.
|
||||
>
|
||||
>
|
||||
> **2:** That's right. Go doesn't interpreted \" in raw string literals.
|
||||
>
|
||||
>
|
||||
> **3:** Remember! "very" is 4 characters. `very` is also 4 characters.
|
||||
>
|
||||
>
|
||||
> **4:** Remember! Go doesn't interpreted \" in raw string literals.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## What's the result of the following expression?
|
||||
@@ -100,9 +117,15 @@ len("very") + len("\"cool\"")
|
||||
3. 16
|
||||
4. 10 *CORRECT*
|
||||
|
||||
> 1. There are also double-quotes, count them as well.
|
||||
> 2. Remember! Go interprets escape sequences in string literals.
|
||||
> 4. That's right. Go does interpret \" in a string literal. So, "\"" means ", which is 1 character.
|
||||
> **1:** There are also double-quotes, count them as well.
|
||||
>
|
||||
>
|
||||
> **2:** Remember! Go interprets escape sequences in string literals.
|
||||
>
|
||||
>
|
||||
> **4:** That's right. Go does interpret \" in a string literal. So, "\"" means ", which is 1 character.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## What's the result of the following expression?
|
||||
@@ -119,9 +142,15 @@ len("péripatéticien")
|
||||
3. 18
|
||||
4. 20
|
||||
|
||||
> 1. Remember! é is 2 bytes long.
|
||||
> 2. An english letter is 1 byte long. However, é is 2 bytes long. So, that makes up 16 bytes. Cool.
|
||||
> 3. You didn't count the double-quotes, did you?
|
||||
> **1:** Remember! é is 2 bytes long.
|
||||
>
|
||||
>
|
||||
> **2:** An english letter is 1 byte long. However, é is 2 bytes long. So, that makes up 16 bytes. Cool.
|
||||
>
|
||||
>
|
||||
> **3:** You didn't count the double-quotes, did you?
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## How can you find the correct length of the characters in this string literal?
|
||||
@@ -134,9 +163,15 @@ len("péripatéticien")
|
||||
3. `utf8.RuneCountInString("péripatéticien")` *CORRECT*
|
||||
4. `unicode/utf8.RuneCountInString("péripatéticien")`
|
||||
|
||||
> 1. Where are the double-quotes?
|
||||
> 2. This only finds the bytes in a string value.
|
||||
> 4. You're close. But, the package's name is utf8 not unicode/utf8.
|
||||
> **1:** Where are the double-quotes?
|
||||
>
|
||||
>
|
||||
> **2:** This only finds the bytes in a string value.
|
||||
>
|
||||
>
|
||||
> **4:** You're close. But, the package's name is utf8 not unicode/utf8.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## What's the result of the following expression?
|
||||
@@ -149,8 +184,12 @@ utf8.RuneCountInString("péripatéticien")
|
||||
3. 18
|
||||
4. 20
|
||||
|
||||
> 1. This is its byte count. `RuneCountInString` counts the runes (codepoints) not the bytes.
|
||||
> 2. That's right. `RuneCountInString` returns the number of runes (codepoints) in a string value.
|
||||
> **1:** This is its byte count. `RuneCountInString` counts the runes (codepoints) not the bytes.
|
||||
>
|
||||
>
|
||||
> **2:** That's right. `RuneCountInString` returns the number of runes (codepoints) in a string value.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## Which package contains string manipulation functions?
|
||||
@@ -172,10 +211,18 @@ strings.Repeat("*x", 3) + "*"
|
||||
3. `*x3`
|
||||
4. `*x*x*x*` *CORRECT*
|
||||
|
||||
> 1. You're close but you missed the concatenation at the end.
|
||||
> 2. Look closely.
|
||||
> 3. Wow! You should really watch the lectures again. Sorry.
|
||||
> 4. That's right. Repeat function repeats the given string. And, the concatenation operator combines the strings.
|
||||
> **1:** You're close but you missed the concatenation at the end.
|
||||
>
|
||||
>
|
||||
> **2:** Look closely.
|
||||
>
|
||||
>
|
||||
> **3:** Wow! You should really watch the lectures again. Sorry.
|
||||
>
|
||||
>
|
||||
> **4:** That's right. Repeat function repeats the given string. And, the concatenation operator combines the strings.
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
## What's the result of this expression?
|
||||
@@ -188,7 +235,15 @@ strings.ToUpper("bye bye ") + "see you!"
|
||||
3. `bye bye + see you!`
|
||||
4. `BYE BYE see you!` *CORRECT*
|
||||
|
||||
> 1. You missed the ToUpper?
|
||||
> 2. You're close but look closely. ToUpper only changes the first part of the string there.
|
||||
> 3. Not even close. Sorry.
|
||||
> 4. Perfect! Good catch! ToUpper only changes the first part of the string there.
|
||||
> **1:** You missed the ToUpper?
|
||||
>
|
||||
>
|
||||
> **2:** You're close but look closely. ToUpper only changes the first part of the string there.
|
||||
>
|
||||
>
|
||||
> **3:** Not even close. Sorry.
|
||||
>
|
||||
>
|
||||
> **4:** Perfect! Good catch! ToUpper only changes the first part of the string there.
|
||||
>
|
||||
>
|
Reference in New Issue
Block a user