🎯

Kotlin MCQ

Test your Kotlin knowledge with 100 multiple choice questions covering fundamentals to advanced concepts, with instant feedback and explanations.

100 Questions 41 Beginner 40 Intermediate 19 Advanced
1

Which company developed the Kotlin programming language?

2

How do you declare an immutable variable in Kotlin?

3

What is the Kotlin keyword for declaring a nullable type?

4

What does the Elvis operator ?: do?

5

What is a data class in Kotlin?

6

How do you define a function in Kotlin?

7

What is a Kotlin object declaration?

8

What does the safe call operator ?. do?

9

What is a companion object in Kotlin?

10

What is a sealed class in Kotlin?

11

How do you declare a primary constructor in Kotlin?

12

What is string interpolation in Kotlin?

13

What is the difference between == and === in Kotlin?

14

Which keyword is used for type casting in Kotlin?

15

What is a lambda expression in Kotlin?

16

What does the when expression replace in Kotlin?

17

What is the Unit type in Kotlin?

18

How do you declare an interface in Kotlin?

19

What is an extension function in Kotlin?

20

What does the !! (not-null assertion) operator do?

21

What is the Kotlin equivalent of Java's static methods?

22

What is the difference between List and MutableList in Kotlin?

23

What does the init block do in a Kotlin class?

24

How do you declare default parameter values in Kotlin?

25

What is a Kotlin enum class?

26

What is the purpose of the open keyword in Kotlin?

27

What does the let scope function do?

28

What does the apply scope function return?

29

What is a higher-order function?

30

Which collection function transforms each element to a new value?

31

How does Kotlin handle null safety compared to Java?

32

What is a property in Kotlin?

33

What does @JvmStatic do on a companion object function?

34

What is the Nothing type in Kotlin?

35

How does Kotlin smart cast work?

36

What is the Kotlin Range operator ..?

37

What is the difference between var and val?

38

How do you iterate over a list in Kotlin?

39

What does the also scope function do?

40

What is the use of the @Suppress annotation?

41

What is a Pair in Kotlin?

1

What is a Kotlin coroutine?

2

What is the difference between suspend fun and a regular fun?

3

What is the difference between launch and async coroutine builders?

4

What does the inline keyword do for a higher-order function?

5

What is the purpose of reified type parameters?

6

What is delegation in Kotlin using the by keyword?

7

What is the lazy property delegate?

8

What does withContext(Dispatchers.IO) do in a coroutine?

9

What is a Flow in Kotlin coroutines?

10

What is the difference between StateFlow and SharedFlow?

11

What does structured concurrency mean in Kotlin?

12

What is the purpose of the operator keyword?

13

What is a destructuring declaration?

14

What does crossinline do in an inline function?

15

What is the difference between object and class in Kotlin?

16

How does Kotlin's type inference work?

17

What is a type alias in Kotlin?

18

What is a value class (inline class) in Kotlin?

19

What does the contract block in Kotlin allow?

20

What is vararg in Kotlin?

21

What is the spread operator * used for with vararg?

22

How do you handle exceptions in Kotlin?

23

What does the run scope function return?

24

What is the purpose of SupervisorJob in coroutines?

25

What is channel in Kotlin coroutines?

26

How does Kotlin support multiple interface implementation?

27

What is the difference between Dispatchers.Main and Dispatchers.IO?

28

What is kotlinx.coroutines.flow.catch operator used for?

29

What is the combine Flow operator?

30

What is the difference between flatMapConcat and flatMapMerge?

31

What does the Kotlin by lazy(LazyThreadSafetyMode.NONE) do?

32

What is Kotlin's type-safe builder pattern?

33

What is the with scope function?

34

What is the difference between coroutineScope and supervisorScope?

35

What is the purpose of Kotlin's @Volatile annotation?

36

What is Kotlin's @Synchronized annotation?

37

What is the difference between Kotlin's List and Array?

38

What is Kotlin's buildString function?

39

What is the Kotlin Coroutines CoroutineExceptionHandler?

40

What are Kotlin value classes used for instead of type aliases?