91. You are creating a Kotlin unit test library. What else should you add to make the following code compile without error?
fun String.shouldEqual(value: String) = this == value
fun main(){
val msg = "test message"
println(msg shouldEqual "test message")
}
fun String.shouldEqual(value: String) = this == value
fun main(){
val msg = "test message"
println(msg shouldEqual "test message")
}92. This function generates Fibonacci sequence. Which function is missing?
fun fibonacci() = sequence {
var params = Pair(0, 1)
while (true) {
___(params.first)
params = Pair(params.second, params.first + params.second)
}
}
fun fibonacci() = sequence {
var params = Pair(0, 1)
while (true) {
___(params.first)
params = Pair(params.second, params.first + params.second)
}
}Read More Section(Kotlin Program)
Each Section contains maximum 100 MCQs question on Kotlin Program. To get more questions visit other sections.
