Q274
The code below is expected to display the numbers from 1 to 10, but it does not. Why? val seq = sequence yieldAll(1..20) .filter it < 11 println(seq)
A.
You cannot assign a sequence to a variable
B.
To produce result, a sequence must have terminal operation. In this case, it needs a .toList()
AnswerC.
The .filter{ it < 11 } should be .filter{ it > 11 }
D.
The yieldAll(1..20) should be yieldAll(1..10)
Answer: Option B
Solution
Answer: Option B
No explanation is given for this question Let's Discuss on Board