Kotlin - Data TypesWhy does Kotlin not allow implicit widening conversions like Int to Long, requiring explicit conversion instead?ATo make code shorter and simplerBTo prevent accidental data loss and make conversions clearCBecause Kotlin does not support Long typeDBecause implicit conversions are slowerCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand Kotlin's design philosophyKotlin emphasizes safety and clarity by requiring explicit conversions.Step 2: Reason about implicit conversionsImplicit widening conversions can hide bugs or data issues, so Kotlin disallows them.Final Answer:To prevent accidental data loss and make conversions clear -> Option BQuick Check:Explicit conversion = Safety and clarity [OK]Quick Trick: Explicit conversions prevent hidden bugs [OK]Common Mistakes:MISTAKESThinking Kotlin lacks Long typeBelieving implicit conversions improve speedAssuming implicit conversions make code simpler
Master "Data Types" in Kotlin9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Kotlin Quizzes Data Types - String type and immutability - Quiz 9hard Functions - Function declaration syntax - Quiz 13medium Functions - Vararg parameters - Quiz 11easy Kotlin Basics and JVM Runtime - Project structure and build basics - Quiz 1easy Kotlin Basics and JVM Runtime - What is Kotlin - Quiz 9hard Null Safety - Nullable types with ? suffix - Quiz 15hard Null Safety - Non-nullable types by default - Quiz 12easy Operators and Expressions - Range operator (..) and in operator - Quiz 7medium Operators and Expressions - Logical operators (&&, ||, !) - Quiz 14medium Variables and Type System - Type inference by the compiler - Quiz 5medium