What is a higher-order function in Kotlin?
A function that takes another function as a parameter or returns a function.
A function that cannot be overridden in a subclass.
A function that is declared using the inline keyword.
inline
A function that operates on collections and sequences.
What is a potential downside of relying heavily on recursion in Kotlin?
It can make the code more difficult to debug and understand compared to iterative solutions.
It always leads to slower performance than iterative approaches.
It prevents the use of higher-order functions like 'map' and 'filter'.
It is not supported for complex data structures like trees and graphs.
Which of the following is NOT a characteristic of an abstract class in Kotlin?
It cannot have properties.
It cannot be instantiated.
It can have abstract methods without implementation.
It can have non-abstract methods with implementation.
What is the purpose of the CoroutineContext?
CoroutineContext
Defines the entry point for a coroutine.
Synchronizes access to shared resources.
Serializes data passed between coroutines.
Stores information about the coroutine's execution environment.
What does the ? operator signify in Kotlin?
?
It defines a constant variable.
It marks a variable as able to hold null values.
It forces a variable to throw a NullPointerException.
It's used for string interpolation.
Which of these is NOT a common use case for sealed classes in Kotlin?
Representing a finite set of possible states.
Defining an extensive inheritance hierarchy.
Modeling a closed type system.
Creating algebraic data types.
What is the primary difference between an abstract class and an interface in Kotlin?
An interface can have properties, while an abstract class cannot.
An abstract class can only inherit from one other class, while an interface can inherit from multiple.
There is no difference; they are interchangeable.
An abstract class can have constructors, while an interface cannot.
Which function type represents a function that takes an Int and returns a String?
(Int) -> Unit
Int.() -> String
String(Int)
(Int) -> String
What is the primary purpose of extension functions in Kotlin?
To create abstract methods that must be implemented by subclasses.
To override existing methods of a class.
To define static methods within a class.
To add new functionality to existing classes without inheriting from them.
Which keyword is used to cancel an ongoing coroutine in Kotlin?
cancel
terminate
interrupt
stop