What are the two types of properties in Kotlin?
Constant and variable
Static and dynamic
Stored and computed
Public and private
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.
You can't define multiple constructors in Kotlin.
Using the 'secondary' keyword before the constructor declaration.
What is the output of the following code?
for (i in 1..5) { if (i == 3) continue println(i) }
12345
1234
1245
124
How can you add an element to a mutable list in Kotlin?
Using the push() function
push()
You cannot add elements to a mutable list once it's created.
Using the add() function
add()
Using the append() function
append()
What happens when you try to access a non-existent key in a Kotlin map?
It throws a NullPointerException.
It throws an IndexOutOfBoundsException.
It returns null.
It returns a default value.
What is the correct way to print 'Hello, World!' to the console in Kotlin?
console.log("Hello, World!")
System.out.println("Hello, World!")
print("Hello, World!")
println("Hello, World!")
What is the correct way to create a range of integers from 1 to 5 (inclusive) in Kotlin?
range(1, 5)
[1, 2, 3, 4, 5]
1..5
1 to 5
What is the primary difference between listOf() and mutableListOf() in Kotlin?
listOf()
mutableListOf()
There is no difference; both functions are interchangeable.
listOf() creates an immutable list, while mutableListOf() creates a mutable list.
listOf() creates a fixed-size list, while mutableListOf() creates a dynamically sized list.
listOf() creates a list of integers, while mutableListOf() creates a list of strings.
Can you modify the elements of an immutable list in Kotlin?
No
Yes
What is a data class in Kotlin?
A class for database interactions.
A class that holds only constants.
A class designed to primarily hold data and provides automatically generated utility functions.
A class that cannot be instantiated.