How do you use a named argument when calling a function in Kotlin?
By using the '->' symbol followed by the argument name and value.
Named arguments are not supported in Kotlin.
By simply passing the values in the correct order.
By specifying the argument name followed by '=' and the value inside the function call.
What is a lambda expression in Kotlin?
A keyword used for error handling.
A special kind of variable.
A type of loop in Kotlin.
A way to define anonymous functions.
Which of the following is NOT an advantage of Kotlin?
Interoperable with Java
Null safety
Concise syntax
More verbose than Java
What is the correct syntax to define a function named 'greet' that takes no arguments and returns nothing in Kotlin?
function greet() {}
fun greet() {}
def greet() {}
void greet() {}
How do you pass a lambda expression as an argument to a function in Kotlin?
By enclosing the lambda expression in parentheses.
Lambda expressions cannot be passed as arguments in Kotlin.
By simply passing the lambda expression without any special syntax.
By using the 'function' keyword before the lambda expression.
Which data type represents a whole number in Kotlin?
String
Boolean
Int
Float
What is the correct way to create a range of integers from 1 to 5 (inclusive) in Kotlin?
[1, 2, 3, 4, 5]
1 to 5
range(1, 5)
1..5
How do you create an instance of a class named 'MyClass' in Kotlin?
MyClass myClass = new MyClass()
MyClass myClass
var myClass = new MyClass()
val myClass = MyClass()
What is the output of the following Kotlin code?
fun main() { val result = add(3, 5) println(result) } fun add(a: Int, b: Int): Int = a + b
5
8
3
Error
How do you exit a loop prematurely in Kotlin?
All of the above
Using the 'return' keyword
Using the 'continue' keyword
Using the 'break' keyword