Kotlin Program - Study Mode
[#216] val short for Value, a constant which cannot be changed once assigned?
Correct Answer
(C) val cannot be changed after its assigned
[#217] You have created a class that should be visible only to the other code in its module. Which modifier do you use?
Correct Answer
(A) internal
[#218] You are upgrading a Java class to Kotlin. What should you use to replace the Java class's static fields?
Correct Answer
(C) a companion object
[#219] You are writing a console app in Kotlin that processes test entered by the user. If the user enters an empty string, the program exits. Which kind of loop would work best for this app? Keep in mind that the loop is entered at least once
Correct Answer
(A) a do..while loop
[#220] You are attempting to assign an integer variable to a long variable, but Kotlin compiler flags it as an error. Why?
Correct Answer
(C) There is no implicit conversion from Int to Long