Kotlin - Collections Fundamentals
You want to create a map that stores student names as keys and their scores as values. You also want to update scores later. Which Kotlin code snippet correctly achieves this?
mutableMapOf is required.scores["Alice"] = 95 correctly updates the value in a mutable map.put on immutable map, error. val scores = mutableMapOf("Alice" to 90, "Bob" to 85)
scores.add("Alice", 95) uses non-existent add method.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions