Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new quiz for Kotlin lang #3580

Merged
merged 1 commit into from
Apr 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add new quiz for Kotlin lang
- Changed the answers of Q68 to `_.moveTo("LA")` and unchecked it
- Added new quizzes as Q82 and Q83
  • Loading branch information
Husseinhj authored Apr 25, 2022
commit 238351c042b19f4351a1850152d55e1a39dc66fb
32 changes: 30 additions & 2 deletions kotlin/kotlin-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -900,9 +900,9 @@ fun main() {
}
```

- [x] `moveTo( "LA")`
- [ ] `::moveTo("LA")`
- [x] `moveTo("LA")`
- [ ] `::moveTo("LA")`
- [ ] `_.moveTo("LA")`
- [ ] `it.moveTo("LA")`

#### Q69. For the Product class you are designing, you would like the price to be readable by anyone, but changeable only from within the class. Which property declaration implements your design?
Expand Down Expand Up @@ -1058,3 +1058,31 @@ names[3]= "Delta"
- [ ] one.

[reference](https://www.programiz.com/kotlin-programming/constructors#:~:text=In%20Kotlin%2C%20there%20are%20two,to%20put%20additional%20initialization%20logic)

#### Q82. What is the default visibility modifier in Kotlin?

- [ ] protected
- [ ] private
- [ ] internal
- [x] public

[reference](https://kotlinlang.org/docs/visibility-modifiers.html)


#### Q83. The code below compiles and executes without issue, but is not idiomatic kotlin. What is a better way to impelement the `printlln()`?

```kotlin
fun main() {
val name: String = "Amos"
val grade: Float = 95.5f
println("My name is " + name + ". I score " + grade + " points on the last coding quiz.")
}
```

- [ ] Use `new printf()`.
- [ ] Use `string.format` instead.
- [ ] Use `string append` instead.
- [x] Use string templates instead.

[reference](https://kotlinlang.org/docs/basic-syntax.html#string-templates)