What is the most appropriate collection type in Kotlin to store a list of unique user IDs?
Set
MutableList
Map
List
What is the correct way to print 'Hello, World!' to the console in Kotlin?
console.log("Hello, World!")
println("Hello, World!")
System.out.println("Hello, World!")
print("Hello, World!")
How do you access the value associated with the key "name" in a Kotlin map named user?
user
user.get("name")
user["name"]
user.name
user.getValue("name")
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
8
Error
3
5
What is the output of the following Kotlin code: 'println(2 + 3 * 4)'?
10
14
20
Which loop in Kotlin guarantees that the loop body will execute at least once?
for loop
for-each loop
do-while loop
while loop
How do you define a secondary constructor in Kotlin?
By using the 'override' keyword before the constructor declaration.
By defining another constructor inside the class body using the 'constructor' keyword.
Using the 'secondary' keyword before the constructor declaration.
You can't define multiple constructors in Kotlin.
What is the difference between a MutableSet and an ImmutableSet in Kotlin?
There is no difference; both are interchangeable.
MutableSets are ordered, while ImmutableSets are unordered.
MutableSets allow duplicate elements, while ImmutableSets do not.
MutableSets can be modified after creation, while ImmutableSets cannot.
What is the correct syntax to declare a class named 'MyClass' in Kotlin?
class MyClass()
class MyClass {}
object MyClass
public class MyClass
What is a field in Kotlin?
A property declared inside a function
A backing field for a property
A static variable
A constant value