Bird
0
0

Which of the following is the correct way to start a Kotlin program?

easy📝 Syntax Q3 of 15
Kotlin - Basics and JVM Runtime
Which of the following is the correct way to start a Kotlin program?
Afunction main() { console.log("Hello") }
Bpublic static void main(String[] args) { System.out.println("Hello"); }
Cdef main(): print("Hello")
Dfun main() { println("Hello") }
Step-by-Step Solution
Solution:
  1. Step 1: Recognize Kotlin syntax

    Kotlin uses 'fun' keyword to declare functions and 'main' is the entry point.
  2. Step 2: Identify other languages' syntax

    function main() { console.log("Hello") } is JavaScript, C is Python, D is Java syntax.
  3. Final Answer:

    fun main() { println("Hello") } -> Option D
  4. Quick Check:

    Kotlin main function syntax = fun main() [OK]
Quick Trick: Kotlin functions start with 'fun' keyword [OK]
Common Mistakes:
MISTAKES
  • Confusing Kotlin with Java or Python syntax
  • Using 'function' instead of 'fun'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes