Question |
Good |
Fails |
Which of the following declares an unchangeable list of strings? |
2 |
0 |
What will be the output of the following code? |
2 |
0 |
The contains(element: String) function returns true if the string element is contained in the string it's called on. What will be the output of the following code?
val decorations = listOf ("rock", "pagoda", "plastic plant", "alligator", "flowerpot")
println(decorations.filter {it.contains('p')}) |
1 |
1 |
You can pass a regular named function (not the result of calling it) to another function. How would you pass increaseDirty( start: Int ) = start + 1 to updateDirty(dirty: Int, operation: (Int) -> Int)? |
1 |
1 |
Classes have a special method that serves as a blueprint for creating objects of that class. What is the method called? |
0 |
2 |
Which of the following statements about interfaces and abstract classes is NOT correct? |
0 |
2 |
Which of the following is NOT a Kotlin visibility modifier for properties, methods, etc.? |
2 |
0 |
Consider this data class:
data class Fish(val name: String, val species:String, val colors:String)
Which of the following is NOT valid code to create and destructure a Fish object? |
0 |
2 |
Let's say you own a zoo with lots of animals that all need to be taken care of. Which of the following would NOT be part of implementing caretaking? |
1 |
1 |
Which one of the following returns a copy of a list? |
2 |
0 |
Which one of these extension functions on class AquariumPlant(val color: String, val size: Int, private val cost: Double, val leafy: Boolean) will give a compiler error? |
2 |
0 |
Which one of the following is not a place where you can define constants with const val? |
0 |
2 |
Which of the following is the convention for naming a generic type? |
2 |
0 |
In Kotlin, SAM stands for: |
1 |
1 |
Labels in Kotlin are indicated with an identifier followed by: |
2 |
0 |