Loading...
QUIZ

Certification Test

 
Que No. 1 ) What is the purpose of the Kotlin sealed modifier for classes?

A.) To indicate that a class is abstract
B.) To indicate that a class can be inherited
C.) To restrict the inheritance of a class to a predefined set of subclasses
D.) To define a final class


Que No. 2 ) How do you create an extension function in Kotlin?

A.) By declaring it inside a class
B.) By using the extension keyword
C.) By creating a new file with the extension function's name
D.) By declaring it outside the class using the fun keyword


Que No. 3 ) In Kotlin, which operator is used for safe type casting?

A.) as
B.) is
C.) cast
D.) to


Que No. 4 ) What is Kotlin's equivalent of a try-catch block in Java?

A.) try-except
B.) try-catch
C.) try-catch-finally
D.) try-exception


Que No. 5 ) In Kotlin, how do you define a class that cannot be instantiated directly?

A.) By using the abstract keyword
B.) By using the final keyword
C.) By using the sealed keyword
D.) By using the object keyword


Que No. 6 ) What is the primary purpose of the coroutineScope function in Kotlin?

A.) To define a coroutine
B.) To create a new thread
C.) To create a coroutine context
D.) To suspend execution of a coroutine until its scope is complete


Que No. 7 ) Which Kotlin keyword is used for defining a package-level function?

A.) global
B.) package
C.) function
D.) top-level


Que No. 8 ) What is Kotlin's equivalent of a switch-case statement in other programming languages?

A.) switch-case
B.) select-case
C.) when
D.) match


Que No. 9 ) What is the purpose of the by keyword in Kotlin when working with delegated properties?

A.) To create a new property
B.) To delegate property access and modification to another object
C.) To define a getter method
D.) To specify the visibility of a property


Que No. 10 ) What is the Kotlin lazy property delegate used for?

A.) Creating a property that cannot be modified
B.) Initializing a property lazily, only when it's accessed for the first time
C.) Defining a constant property
D.) Creating a property that can be modified asynchronously