Bird
0
0

Identify the error in the following Kotlin code snippet:

medium📝 Debug Q14 of 15
Kotlin - Basics and JVM Runtime
Identify the error in the following Kotlin code snippet:
fun main() {
    /* This is a comment
    println("Hello")
}
ANo error, code runs fine
BIncorrect single-line comment syntax
CMissing quotation marks in println
DMissing closing */ for multi-line comment
Step-by-Step Solution
Solution:
  1. Step 1: Check multi-line comment syntax

    The comment starts with /* but does not have a closing */.
  2. Step 2: Understand impact of missing closing comment

    Without closing */, the compiler treats the rest as comment, causing syntax error.
  3. Final Answer:

    Missing closing */ for multi-line comment -> Option D
  4. Quick Check:

    Multi-line comments must close with */ [OK]
Quick Trick: Always close multi-line comments with */ [OK]
Common Mistakes:
MISTAKES
  • Forgetting to close multi-line comments
  • Confusing single-line and multi-line comment syntax
  • Assuming code inside unclosed comment runs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes