How do you read a line of input from the user in Kotlin?
read()
readLine()
scanner.nextLine()
input()
What is the output of the following Kotlin code?
fun main() { val numbers = listOf(1, 2, 3, 4, 5) val doubled = numbers.map { it * 2 } println(doubled) }
Error
10
[2, 4, 6, 8, 10]
[1, 2, 3, 4, 5]
How can you check if a value is within a range in Kotlin?
None of the above
Both 'in' operator and 'contains' method can be used
Using the 'in' operator
Using the 'contains' method
What is the correct way to print 'Hello, World!' to the console in Kotlin?
System.out.println("Hello, World!")
print("Hello, World!")
console.log("Hello, World!")
println("Hello, World!")
How do you access the value associated with the key "name" in a Kotlin map named user?
user
user.get("name")
user.getValue("name")
user["name"]
user.name
Which method adds an element to the end of a mutable list in Kotlin?
append()
push()
insert()
add()
What is the default visibility modifier for classes and members in Kotlin?
private
public
internal
protected
What are the two types of properties in Kotlin?
Constant and variable
Public and private
Static and dynamic
Stored and computed
How do you call a method named 'myMethod' on an object 'myObject' in Kotlin?
myMethod(myObject)
myObject->myMethod()
call(myObject, myMethod)
myObject.myMethod()
What happens when you try to access a non-existent key in a Kotlin map?
It throws an IndexOutOfBoundsException.
It throws a NullPointerException.
It returns null.
It returns a default value.