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.
What is the primary purpose of using a data class in Kotlin?
To implement complex inheritance hierarchies.
To handle asynchronous operations efficiently.
To define reusable UI components.
To create classes specifically for holding data and providing automatic utility functions.
How do you replace all occurrences of a substring in a Kotlin String?
replaceAll()
switch()
replace()
substitute()
Which of the following functions is NOT automatically generated for a data class in Kotlin?
toString()
copy()
equals()
run()
Which of the following is a valid way to define an extension function for the String class in Kotlin?
extension fun String.newMethod() {}
fun newMethod(str: String) {}
String.fun newMethod() {}
fun String.newMethod() {}
What annotation must be added to a method in the superclass to allow it to be overridden in a subclass?
@Override
@Open
@Abstract
@Overrideable
What is the role of a CoroutineContext?
CoroutineContext
Provides information and settings for a coroutine
Manages the execution order of coroutines
Stores the data shared between coroutines
Handles exceptions thrown within a coroutine
In Kotlin, what keyword is used to mark a class as inheritable?
inherit
open
derivable
extends
What is the primary advantage of using coroutines in Kotlin?
Improved code readability with asynchronous operations.
Reduces memory consumption by eliminating objects.
Eliminates the need for error handling.
Direct replacement for traditional threads.
Which keyword is used to declare a custom exception class in Kotlin?
exception
customException
try
throw