Vidyalelo
Computer Science · Q250

Kotlin Programming MCQ for Competitive Exams, Interviews, and Certifications

Engineering and GATE · Computer Science · question 250

Q250

You would like to print each score on its own line with its cardinal position. Without using var or val, which method allows iteration with both the value and its position? fun main() val highScores = listOf(4000, 2000, 10200, 12000, 9030)

A.
.withIndex()
Answer
B.
.forEachIndexed()
C.
.forEach()
D.
.forIndexes()

Answer: Option A

Solution

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