Vidyalelo
Computer Science · Q254

Kotlin Programming MCQ for Competitive Exams, Interviews, and Certifications

Engineering and GATE · Computer Science · question 254

Q254

How do you fill in the blank below to display all of the even numbers from 1 to 10 with least amount of code? for (_____) println("There are count butterflies.")

A.
count in 1..10
B.
count in 2..10 step 2
Answer
C.
count in 1..10 % 2
D.
var count=2; count <= 10; count+=2

Answer: Option B

Solution

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