How do you define a property in Kotlin?
Using 'property' keyword
Properties are automatically generated from constructor parameters
Using 'var' or 'val' keyword before the variable declaration
Using 'field' keyword
What is the output of the following code?
for (i in 1..5) { if (i == 3) continue println(i) }
124
1245
1234
12345
Which method adds an element to a mutable list in Kotlin?
insert()
add()
append()
put()
How do you call a method named 'myMethod' on an object 'myObject' in Kotlin?
call(myObject, myMethod)
myObject.myMethod()
myObject->myMethod()
myMethod(myObject)
What is the purpose of single-line comments in Kotlin?
To declare variables
To define code blocks
To import external libraries
To add explanations or disable code temporarily
What will be printed after executing the following Kotlin code?
for (i in 1..3) { println(i * 2) }
123
2 4 6
246
1 2 3
How do you pass a lambda expression as an argument to a function in Kotlin?
By enclosing the lambda expression in parentheses.
By simply passing the lambda expression without any special syntax.
By using the 'function' keyword before the lambda expression.
Lambda expressions cannot be passed as arguments in Kotlin.
What happens when you try to access a non-existent key in a Kotlin map?
It throws a NullPointerException.
It returns a default value.
It returns null.
It throws an IndexOutOfBoundsException.
How do you access the element at index 2 in a Kotlin array named 'numbers'?
numbers[2]
numbers.elementAt(2)
numbers.get(2)
numbers.indexOf(2)
What is the output of listOf(1, 2, 2, 3).toSet() in Kotlin?
listOf(1, 2, 2, 3).toSet()
[1, 2, 2, 3]
{1, 2, 3}
{1, 2, 2, 3}
[1, 2, 3]