Vidyalelo
Computer Science · Q267

Kotlin Programming MCQ for Competitive Exams, Interviews, and Certifications

Engineering and GATE · Computer Science · question 267

Q267

What is the output of the following code? val list : List = listof(1, 2, 3) list.add(4) print(list)

A.
It does not compile, as listof is not known
B.
[5, 6, 7]
C.
It does not compile as List has no add method
Answer
D.
[1, 2, 3, 4]

Answer: Option C

Solution

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