Which of the following declares an unchangeable list of strings?
val school = arrayOf("shark", "salmon", "minnow")
var school = arrayOf("shark", "salmon", "minnow")
val school = listOf("shark", "salmon", "minnow")
val school = mutableListOf("shark", "salmon", "minnow")
What will be the output of the following code? for (i in 3..8 step 2) print(i)
for (i in 3..8 step 2) print(i)
345678
468
38
357
What is the purpose of the question mark in this code? var rocks: Int? = 3
var rocks: Int? = 3
The type of the variable rocks isn't fixed.
rocks
The variable rocks can be set to null.
The variable rocks cannot be set to null.
The variable rocks shouldn't be initialized right away.
Last updated 5 years ago