Bird
0
0

What feature of Kotlin allows functions to be passed as arguments, returned from other functions, and assigned to variables?

easy📝 Conceptual Q1 of 15
Kotlin - Functions
What feature of Kotlin allows functions to be passed as arguments, returned from other functions, and assigned to variables?
AFunctions are inline only
BFunctions are first-class citizens
CFunctions must be inside classes
DFunctions cannot be stored in variables
Step-by-Step Solution
Solution:
  1. Step 1: Understand first-class functions

    First-class functions mean functions can be treated like any other variable.
  2. Step 2: Identify Kotlin's support

    Kotlin supports passing functions as parameters, returning them, and assigning them to variables.
  3. Final Answer:

    Functions are first-class citizens -> Option B
  4. Quick Check:

    Functions as values? Yes! [OK]
Quick Trick: First-class means functions behave like variables [OK]
Common Mistakes:
MISTAKES
  • Thinking functions must be inside classes
  • Confusing inline functions with first-class functions
  • Assuming functions cannot be assigned to variables

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes