Examveda

What is the output of the following code?
fun main() {
    val list = listOf(1, 2, 3, 4, 5)
    for (num in list) {
        println(num)
    }
}

A. 1 2 2

B. 1 2 3 4 5

C. 5 4 3 2 1

D. 3 3 3 3

Answer: Option B


This Question Belongs to Computer Science >> Kotlin Program

Join The Discussion

Related Questions on Kotlin Program

What is Kotlin?

A. A new version of Java.

B. A JavaScript framework.

C. A statically-typed programming language for the JVM, Android, and browser.

D. A database management system.