Kotlin - Basics and JVM RuntimeWhy does Kotlin's main function usually have a return type of Unit instead of Int like in some other languages?ABecause Kotlin uses exceptions to signal program termination.BBecause Kotlin does not support returning values from functions.CBecause Kotlin programs do not return exit codes by default.DBecause main functions must always be void in all languages.Check Answer
Step-by-Step SolutionSolution:Step 1: Understand Kotlin main function return typeKotlin's main returns Unit, meaning no value, unlike C/C++ where main returns Int exit code.Step 2: Reason why Kotlin uses UnitKotlin programs do not return exit codes by default; the OS assumes success unless exceptions occur.Final Answer:Because Kotlin programs do not return exit codes by default. -> Option CQuick Check:Main return type Unit means no exit code [OK]Quick Trick: Kotlin main returns Unit; exit codes not returned by default [OK]Common Mistakes:MISTAKESThinking Kotlin disallows return valuesAssuming all languages require void mainBelieving exceptions replace all returns
Master "Basics and JVM Runtime" in Kotlin9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Kotlin Quizzes Collections Fundamentals - Array creation and usage - Quiz 14medium Collections Fundamentals - Why immutable collections are default - Quiz 14medium Data Types - Type conversion is always explicit - Quiz 8hard Functions - Unit return type - Quiz 14medium Loops and Ranges - Repeat function for simple repetition - Quiz 10hard Null Safety - Safe casts with as? - Quiz 8hard Null Safety - Nullable types with ? suffix - Quiz 9hard Operators and Expressions - Arithmetic operators - Quiz 5medium Operators and Expressions - Equality (== structural vs === referential) - Quiz 4medium Variables and Type System - Val for immutable references - Quiz 7medium