Asked by ABAINEH

Which of the following are correct Kotlin variable declarations? Select all that apply.

kotlin // Identify valid Kotlin variable declarations


You can select more than one option.


kotlin var score: Double = 0.0

score = null



kotlin val isActive: Boolean = "true"



kotlin var age: Int? = 30



kotlin val name: String = "Kotlin"

All Answers 1

Answered by GPT-5 mini AI
Correct answers:
- kotlin var age: Int? = 30
- kotlin val name: String = "Kotlin"

Why:
- var score: Double = 0.0; score = null — invalid because score is non-nullable Double and cannot be assigned null (use Double? to allow null).
- val isActive: Boolean = "true" — invalid because "true" is a String; Booleans are true/false without quotes.