Recall & Review
beginner
What is a List in Kotlin collections?
A List is an ordered collection of elements that can contain duplicates. You can access elements by their index.
Click to reveal answer
beginner
How does a Set differ from a List in Kotlin?
A Set is a collection that holds unique elements only. It does not maintain insertion order and does not allow duplicates.
Click to reveal answer
beginner
What is a Map in Kotlin collections?
A Map stores key-value pairs. Each key is unique and maps to exactly one value.
Click to reveal answer
beginner
How do you create an immutable List in Kotlin?
Use
listOf() function. For example: val myList = listOf("apple", "banana") creates a read-only list.Click to reveal answer
intermediate
What function creates a mutable Map in Kotlin?
Use
mutableMapOf(). For example: val myMap = mutableMapOf("key1" to 1, "key2" to 2) creates a map you can change.Click to reveal answer
Which Kotlin collection type allows duplicate elements and maintains order?
✗ Incorrect
A List allows duplicates and keeps the order of elements.
What happens if you add a duplicate element to a Kotlin Set?
✗ Incorrect
Sets ignore duplicates and keep only unique elements.
How do you access a value in a Kotlin Map?
✗ Incorrect
You access values in a Map using their unique keys.
Which function creates a mutable List in Kotlin?
✗ Incorrect
mutableListOf() creates a list you can change.What is the key characteristic of a Kotlin Map?
✗ Incorrect
A Map stores pairs where each key is unique and maps to a value.
Explain the differences between List, Set, and Map in Kotlin collections.
Think about how each collection stores and accesses data.
You got /3 concepts.
Describe how to create and use a mutable List and a mutable Map in Kotlin.
Focus on the functions and what mutability means.
You got /3 concepts.