Which of the following is NOT an advantage of Kotlin?
More verbose than Java
Interoperable with Java
Concise syntax
Null safety
What is a field in Kotlin?
A constant value
A property declared inside a function
A static variable
A backing field for a property
What is the output of listOf(1, 2, 2, 3).toSet() in Kotlin?
listOf(1, 2, 2, 3).toSet()
[1, 2, 2, 3]
{1, 2, 3}
[1, 2, 3]
{1, 2, 2, 3}
How do you access the value associated with the key "name" in a Kotlin map named user?
user
user.name
user.getValue("name")
user["name"]
user.get("name")
What is the difference between 'val' and 'var' when declaring a property in Kotlin?
'val' declares a mutable property, 'var' an immutable one.
'val' is for local variables, 'var' for class properties.
'val' declares an immutable property, 'var' a mutable one.
There is no difference; they are interchangeable.
How can you check if a value is within a range in Kotlin?
Using the 'contains' method
Both 'in' operator and 'contains' method can be used
None of the above
Using the 'in' operator
Which keyword is used to declare a class in Kotlin?
struct
interface
class
object
What is the correct syntax to declare a class named 'MyClass' in Kotlin?
class MyClass()
object MyClass
class MyClass {}
public class MyClass
What is the default visibility modifier for classes and members in Kotlin?
protected
public
private
internal
Which data type represents a whole number in Kotlin?
Boolean
Int
String
Float