Bird
0
0

What happens to Kotlin inline functions when compiled to JVM bytecode?

medium📝 Predict Output Q5 of 15
Kotlin - Basics and JVM Runtime
What happens to Kotlin inline functions when compiled to JVM bytecode?
AThey are compiled as normal functions with calls
BThey cause runtime errors on JVM
CTheir code is copied at call sites, no function call overhead
DThey are ignored by the compiler
Step-by-Step Solution
Solution:
  1. Step 1: Recall inline function behavior

    Kotlin inline functions are expanded at call sites to avoid call overhead.
  2. Step 2: Understand JVM bytecode effect

    Compiler copies inline function code into caller bytecode, no separate function call.
  3. Final Answer:

    Code copied at call sites, no call overhead -> Option C
  4. Quick Check:

    Inline functions inline code in JVM bytecode [OK]
Quick Trick: Inline functions expand code at call sites in JVM bytecode [OK]
Common Mistakes:
MISTAKES
  • Thinking inline functions remain normal calls
  • Assuming runtime errors
  • Believing compiler ignores inline

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes