Kotlin Program - Study Mode

[#91] Which snippet correctly shows setting the variable max to whichever variable holds the greatest value, a or b, using idiomatic Kotlin?
Correct Answer

(C) val max = if (a > b) a else b

[#92] Which lifecycle method should you override to pause the simulation when the app is not on the screen?
Correct Answer

(B) onStop()

[#93] Your function is passed by a parameter obj of type Any. Which code snippet shows a way to retrieve the original type of obj, including package information?
Correct Answer

(D) obj::class

[#94] Which function changes the value of the element at the current iterator location?
Correct Answer

(C) set() (reference)

[#95] The Kotlin .. operator can be written as which function?
Correct Answer

(C) a.rangeTo(b)