Vidyalelo
Computer Science · Q290

Kotlin Programming MCQ for Competitive Exams, Interviews, and Certifications

Engineering and GATE · Computer Science · question 290

Q290

This code snippet compiles without error, but never prints the results when executed. What could be wrong? Val result = generateSequence(1) it + 1 .toList(); Println(result)

A.
The sequence lacks a terminal operation
Answer
B.
The sequence is infinite and lacks an intermediate operation to make it finite
C.
The expression should begin with generateSequence(0)
D.
The it parameter should be replaced with this

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board