Which of the following functions is NOT automatically generated for a data class in Kotlin?
toString()
equals()
run()
copy()
Which keyword is used to cancel an ongoing coroutine in Kotlin?
terminate
interrupt
stop
cancel
Which Kotlin function is used to combine elements of two collections into pairs?
pair()
zip()
merge()
combine()
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 memory leaks.
It can lead to NullPointerExceptions if the variable is null.
What happens when a suspending function calls another suspending function?
The calling function suspends until the called function completes
It creates a new thread for the nested function call
It throws a SuspendException
SuspendException
It executes the called function asynchronously using a callback
What role does a CoroutineScope play in managing coroutines?
CoroutineScope
Executes suspending functions synchronously.
Handles exceptions thrown within threads.
Defines the lifetime of a group of coroutines.
Converts blocking code to asynchronous operations.
What happens if you try to access a lateinit property before it has been initialized?
lateinit
An UninitializedPropertyAccessException is thrown.
A NullPointerException is thrown.
An IllegalArgumentException is thrown.
A KotlinNullPointerException is thrown.
What happens when a coroutine encounters a suspending function?
The coroutine suspends execution at the suspending function call, allowing other work to happen on the thread.
The suspending function is executed in a separate thread, running concurrently with the coroutine.
The coroutine throws an exception because suspending functions are not allowed.
The coroutine blocks the thread until the suspending function completes its operation.
How does the 'inline' keyword optimize function calls in Kotlin?
It converts the function into a lambda expression automatically.
It creates a separate thread for the function execution.
It replaces the function call with its actual code at compile time.
It disables null safety checks within the function.
In Kotlin, what keyword is used to mark a class as inheritable?
derivable
open
inherit
extends