What annotation must be added to a method in the superclass to allow it to be overridden in a subclass?
@Open
@Override
@Abstract
@Overrideable
What is the purpose of runBlocking in Kotlin coroutines?
runBlocking
To execute a suspending function from a non-suspending context
To switch between different dispatchers
To cancel an ongoing coroutine
To define a custom coroutine scope
Which of the following is NOT a characteristic of an abstract class in Kotlin?
It cannot be instantiated.
It can have non-abstract methods with implementation.
It cannot have properties.
It can have abstract methods without implementation.
What is a potential risk of using recursion without a proper base case?
It forces the use of tail recursion optimization.
It can lead to an infinite loop and a StackOverflowError.
It prevents the function from returning any value.
It makes the code less readable and harder to understand.
What is destructuring in Kotlin, particularly in the context of data classes?
Destructuring is not relevant to data classes.
Breaking down a data class instance into its constituent properties.
Deleting specific properties from a data class instance.
Converting a data class to a different data type.
What is the primary difference between an abstract class and an interface in Kotlin?
An interface can have properties, while an abstract class cannot.
There is no difference; they are interchangeable.
An abstract class can have constructors, while an interface cannot.
An abstract class can only inherit from one other class, while an interface can inherit from multiple.
Which of the following is NOT a standard coroutine scope in Kotlin?
GlobalScope
CoroutineScope
viewModelScope
lifecycleScope
How do you define a suspending function in Kotlin?
By extending the CoroutineScope interface
By using the suspend keyword in the function definition
suspend
By annotating the function with @Coroutine
@Coroutine
By implementing the Suspendable interface
Suspendable
What happens when a suspending function calls another suspending function?
It creates a new thread for the nested function call
It throws a SuspendException
SuspendException
The calling function suspends until the called function completes
It executes the called function asynchronously using a callback
Can a sealed class be instantiated directly in Kotlin?
Yes, just like regular classes.
Yes, but only inside the same file where it's defined.
No, sealed classes cannot be instantiated directly.
Only if the sealed class is declared as open.
open