Which keyword is used to cancel an ongoing coroutine in Kotlin?
cancel
interrupt
terminate
stop
Which of the following is NOT a characteristic of an abstract class in Kotlin?
It cannot be instantiated.
It can have abstract methods without implementation.
It can have non-abstract methods with implementation.
It cannot have properties.
Which keyword is used to implement an interface in Kotlin?
implements
uses
inherits
extends
What is the purpose of runBlocking in Kotlin coroutines?
runBlocking
To switch between different dispatchers
To execute a suspending function from a non-suspending context
To define a custom coroutine scope
To cancel an ongoing coroutine
What is destructuring in Kotlin, particularly in the context of data classes?
Converting a data class to a different data type.
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.
How do you throw a custom exception in Kotlin?
Custom exceptions cannot be thrown in Kotlin.
By using the catch block with an instance of your custom exception class.
catch
By using the throw keyword with an instance of your custom exception class.
throw
By using the try block with an instance of your custom exception class.
try
What is the primary benefit of using polymorphism in object-oriented programming?
Flexibility and extensibility
Improved code organization
Code reusability
All of the above
What is the role of a CoroutineContext?
CoroutineContext
Provides information and settings for a coroutine
Handles exceptions thrown within a coroutine
Stores the data shared between coroutines
Manages the execution order of coroutines
What is the primary risk associated with using the !! operator in Kotlin?
!!
It makes the code less readable.
It slows down the execution of the program.
It can lead to NullPointerExceptions if the variable is null.
It can lead to memory leaks.
In Kotlin, what keyword is used to mark a class as inheritable?
open
inherit
derivable