Question 1
Topic: Lesson 1: Introduction to Kotlin
Skill tested: Select Kotlin type inference and mutability features for safely storing changing data.
A mobile team is writing a Kotlin utility that reads a user's planned delivery count, then updates that count after each successful order. The initial value comes from a function that returns an integer. The variable must be reassigned during execution, but the team wants Kotlin to infer its type without an explicit declaration. Which declaration best meets both requirements?
A `var` permits reassignment, and Kotlin infers its type from the initializer, which returns an integer. The inferred type is therefore `Int`. A `val` cannot be reassigned, so A and D fail the update requirement. C explicitly declares `String`, which conflicts with the integer-returning initializer and would not compile without conversion.