Stay organized with collections Save and categorize content based on your preferences.

More Kotlin fundamentals

  1. Which of the following is a valid way to define a data class in Kotlin?
  2. When using a sealed class, all direct subclasses must be in the same package.
  3. When using generics, the generic data type goes inside ___.
  4. A(n) ___ class is useful when you have a fixed set of values.
  5. To create a list object that has the ability to change its size, you would call ___.
  6. Which of the following are higher-order functions?

    Choose as many answers as you see fit.

  7. Given the following line of code, which of the following commands will print Blue? (Hint: If you are not sure, try running the code in the Kotlin Playground.)
    val colors = listOf("Red", "Green", "Blue")

    Choose as many answers as you see fit.

  8. The programming concept of a class that has only one instance is called a ___.
  9. Which of the following statements is true regarding sets and maps?
  10. If you have a variable named records, which is a collection, to determine the number of items it contains, you can call ___.