What is the purpose of the withContext function in Kotlin coroutines?
withContext
Launches a new coroutine on the main thread.
Cancels all coroutines within a specific scope.
Creates a new CoroutineScope.
CoroutineScope
Executes a block of code with a specified CoroutineContext.
CoroutineContext
Which keyword is used to implement an interface in Kotlin?
uses
extends
implements
inherits
Which of the following is a valid way to define an extension function for the String class in Kotlin?
extension fun String.newMethod() {}
String.fun newMethod() {}
fun newMethod(str: String) {}
fun String.newMethod() {}
Which keyword is used to declare a custom exception class in Kotlin?
exception
throw
try
customException
Which of the following is NOT a characteristic of an abstract class in Kotlin?
It can have non-abstract methods with implementation.
It cannot be instantiated.
It cannot have properties.
It can have abstract methods without implementation.
What is destructuring in Kotlin, particularly in the context of data classes?
Converting a data class to a different data type.
Breaking down a data class instance into its constituent properties.
Destructuring is not relevant to data classes.
Deleting specific properties from a data class instance.
What is a potential risk of using recursion without a proper base case?
It can lead to an infinite loop and a StackOverflowError.
It prevents the function from returning any value.
It forces the use of tail recursion optimization.
It makes the code less readable and harder to understand.
Which of the following is NOT a standard coroutine scope in Kotlin?
viewModelScope
GlobalScope
lifecycleScope
What is the purpose of the StringBuilder class in Kotlin?
StringBuilder
To efficiently build mutable strings.
To perform regular expression matching.
To convert between different string encodings.
To create immutable strings.
Which of the following is NOT a standard coroutine builder in Kotlin?
repeat
launch
async
runBlocking