This computer science problem involves algorithmic thinking and programming concepts. The solution below explains the approach, logic, and implementation step by step.

ScanSolve AI Answer
Answer
kotlin var age: Int? = 30
Here are the correct Kotlin variable declarations:
kotlin var age: Int? = 30
This is a valid declaration. var indicates a mutable variable. Int? declares a nullable integer type, meaning it can hold an Int value or null. Assigning 30 (an Int) to it is perfectly fine.
kotlin val name: String = "Kotlin"
This is a valid declaration. val indicates an immutable (read-only) variable. String declares a string type. Assigning the string literal "Kotlin" to it is correct.
The other options are incorrect:
kotlin var score: Double = 0.0
score = null
The first line var score: Double = 0.0 is valid. However, the second line score = null is invalid because score is declared as Double (a non-nullable type), and you cannot assign null to a non-nullable type. To allow null, it should be declared as Double?.
kotlin val isActive: Boolean = "true"
This is invalid because "true" is a String literal, but the variable isActive is declared as Boolean. A Boolean variable must be assigned true or false (without quotes).
The final answers are and
Get instant step-by-step solutions to any question. Free to start.
Ask Your QuestionStill have questions?
kotlin var age: Int? = 30 This is a valid declaration. var indicates a mutable variable.
This computer science problem involves algorithmic thinking and programming concepts. The solution below explains the approach, logic, and implementation step by step.