Logo

Kotlin Questions Set 2:

Quiz Mode

There are 6 built-in types to represent numbers in Kotlin

1
2
3
4

Solution:

Which of the following is a valid variable name in Kotlin?

1
2
3
4

Solution:

What is the output of this program?

fun main() {

    var name: String = "Amar"

    name = 007

    println(name)

}

1
2
3
4

Solution:

Which type of exception does the Elvis operator in Kotlin handle?

1
2
3
4

Solution:

Which of the following options is the syntactically correct way to get the length of a string?

1
2
3
4

Solution:

What is the output of the following Kotlin program?

fun main(args: Array<String>) {

   val number1: Int = 540

   val number2: Byte = number1.toByte()

   println("$number2")

}

1
2
3
4

Solution:

What are Lambda Functions?

1
2
3
4

Solution:

What is the output of the following Kotlin program?

fun main(args: Array<String>) {
   val coolvariables = { x: Int, z: Int -> x * z }
   val ant = coolvariables(18, 19)
   println(ant)
}

1
2
3
4

Solution:

What is the output of this Kotlin program?

1
2
3
4

Solution:

What is the output of the following Kotlin program?

fun main(args: Array<String>) {
   val one = "Only "
   val three = "the wisest "
   val nine = "Survive."
   val result = one + three + nine
   println(result)
}

1
2
3
4
5

Solution: