🎯

Kotlin Essentials

42 cards · 🇺🇸 English

Core Kotlin syntax, null safety, and Android-friendly language features.

Study all 42 cards for free

Flashcards, quizzes, pixel-art games and a daily review that remembers for you.

Study this deck free

Try the first 10 cards

1 / 10
Question

Kotlin

Knew itLearning

Tap the card for the answer · swipe right if you knew it, left if not

Already have an account? Sign in

Cards

  1. 1Kotlin
    A cross-platform, statically typed, general-purpose high-level programming language with type inference, designed to interoperate fully with Java
  2. 2Origin of the name 'Kotlin'
    It's named after Kotlin Island, a Russian island in the Gulf of Finland near Saint Petersburg
  3. 3What platforms can Kotlin target?
    JVM, Android, iOS, JavaScript, WebAssembly, and native code via LLVM (Kotlin/Native)
  4. 4Are semicolons required in Kotlin?
    No, semicolons are optional as statement terminators; in most cases a newline is sufficient
  5. 5Where do data types appear in Kotlin variable declarations?
    After the variable name, separated by a colon (similar to TypeScript, Pascal, and Rust)
  6. 6What keyword declares a mutable variable in Kotlin?
    var
  7. 7What keyword declares an immutable variable in Kotlin?
    val
  8. 8Are Kotlin classes open for inheritance by default?
    No, all classes are public and final (non-inheritable) by default
  9. 9What keyword is needed to make a Kotlin class inheritable?
    open
  10. 10Are abstract classes in Kotlin open by default?
    Yes, abstract classes are open by default
  11. 11Default visibility modifier for Kotlin classes and members
    public
  12. 12Four visibility modifiers in Kotlin
    public, internal, protected, and private
  13. 13'internal' visibility modifier
    Visible within a module
  14. 14Entry point function name in a Kotlin program
    main
  15. 15Does Kotlin's main function require parameters?
    No, parameters are optional since Kotlin 1.3
  16. 16What symbol is used for string interpolation in Kotlin?
    $ (dollar sign), e.g., "Hello, $name!"
  17. 17Extension functions in Kotlin
    Functions that can be added to any class without creating a derived class, appearing exactly like a function of the class
  18. 18How many scope functions does Kotlin have, and what are they?
    Five: let, run, with, apply, and also
  19. 19What operator unpacks an array's contents as individual arguments in Kotlin?
    The spread operator asterisk (*)
  20. 20Destructuring declarations in Kotlin
    A feature that decomposes an object into multiple variables at once, e.g., for ((key, value) in map)
  21. 21Can you declare local functions inside other functions in Kotlin?
    Yes, Kotlin allows local functions to be declared inside of other functions or methods
  22. 22Sealed class in Kotlin
    A class that restricts subclass hierarchies, where all subclasses must be defined at compile time
  23. 23Data class in Kotlin
    A class whose primary purpose is storing data, with automatically generated equals, hashCode, and toString methods
  24. 24How does Kotlin handle nullable types?
    By making a distinction between nullable and non-nullable data types, with nullable objects declared with a '?' postfix
  25. 25Safe navigation operator in Kotlin
    ?. - used to safely access a method or property of a possibly null object (returns null if the object is null)
  26. 26Elvis operator in Kotlin
    ?: - a binary operator that returns the first operand if non-null, else the second operand
  27. 27Does Kotlin support higher-order functions?
    Yes, Kotlin provides support for higher-order functions and anonymous functions (lambdas)
  28. 28How are lambda expressions declared in Kotlin?
    Using braces { }, with parameters declared within the braces followed by the -> operator
  29. 29Three main compile targets for Kotlin code
    Kotlin/JVM (Java bytecode), Kotlin/JS (JavaScript), and Kotlin/Native (native code via LLVM)
  30. 30What Java bytecode version does the Kotlin/JVM compiler produce by default?
    Java 8 compatible bytecode

And 12 more cards. Study the whole deck free

Articles about this deck

More Programming decks

See all
Study all 42 cards free