Vidyalelo
Computer Science · Q146

Kotlin Programming MCQ for Competitive Exams, Interviews, and Certifications

Engineering and GATE · Computer Science · question 146

Q146

You are attempting to assign an integer variable to a long variable, but Kotlin compiler flags it as an error. Why?

A.
You must wrap all implicit conversion in a try/catch block
B.
You can only assign Long to an Int, not the other way around
C.
There is no implicit conversion from Int to Long
Answer
D.
All integers in Kotlin are of type Long

Answer: Option C

Solution

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