How do you use a named argument when calling a function in Kotlin?
By simply passing the values in the correct order.
By using the '->' symbol followed by the argument name and value.
Named arguments are not supported in Kotlin.
By specifying the argument name followed by '=' and the value inside the function call.
How do you declare a variable in Kotlin with a String value 'Hello'?
string greeting = 'Hello'
var greeting: String = "Hello"
val greeting = "Hello"
var greeting = 'Hello'
Can you modify the elements of an immutable list in Kotlin?
Yes
No
How do you pass a lambda expression as an argument to a function in Kotlin?
Lambda expressions cannot be passed as arguments 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.
What is the size of the array declared in this Kotlin code?
val fruits = arrayOf("apple", "banana")
1
0
2
3
Which loop in Kotlin guarantees that the loop body will execute at least once?
while loop
for loop
for-each loop
do-while loop
Which data type represents a whole number in Kotlin?
Boolean
Float
Int
String
What is the difference between a MutableSet and an ImmutableSet in Kotlin?
MutableSets are ordered, while ImmutableSets are unordered.
There is no difference; both are interchangeable.
MutableSets allow duplicate elements, while ImmutableSets do not.
MutableSets can be modified after creation, while ImmutableSets cannot.
What is the primary advantage of using arrays over lists in Kotlin?
Arrays offer better performance for certain operations.
Arrays are dynamically sized.
Arrays are immutable.
Arrays can store different data types.
How do you exit a loop prematurely in Kotlin?
Using the 'continue' keyword
Using the 'break' keyword
Using the 'return' keyword
All of the above