Vidyalelo
Computer Science · Q269

Kotlin Programming MCQ for Competitive Exams, Interviews, and Certifications

Engineering and GATE · Computer Science · question 269

Q269

What is the difference between the declarations of COLOR and SIZE? class Record companion object const val COLOR = "Red" val SIZE = "Large"

A.
Since COLOR and SIZE are both immutable, they are identical internally
B.
Both are immutable, but the use of the keyword const makes COLOR slower and less space efficient than SIZE
C.
const makes COLOR faster, but not compatible with Java. Without const, SIZE is still compatible with Java
D.
Both are immutable, but the use of the keyword const makes COLOR faster and more space efficient than SIZE
Answer

Answer: Option D

Solution

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