Vidyalelo
Computer Science · Q281

Kotlin Programming MCQ for Competitive Exams, Interviews, and Certifications

Engineering and GATE · Computer Science · question 281

Q281

You have written a snippet of code to display the results of the roll of a six-sided die. When the die displays from 3 to 6 inclusive, you want to display a special message. Using a Kotlin range, what code should you add? when (die) 1 -> println("die is 1") 2 -> println("die is 2") ___ -> printlin("die is between 3 and 6") else -> printlin("dies is unknown")

A.
3,4,5,6
B.
in 3..6
Answer
C.
03:06
D.
{3,4,5,6}

Answer: Option B

Solution

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