Kotlin MCQs with answers Page - 13

Here, you will find a collection of MCQ questions on Kotlin. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 828.03K Points
Coach

Q. Which function is used to iterate over a list in Kotlin?

  • (A) loop()
  • (B) each()
  • (C) forEach()
  • (D) iterate()

A

Admin • 828.03K Points
Coach

Q. Which class is used for lazy initialization in Kotlin?

  • (A) Lazy<T>
  • (B) Deferred<T>
  • (C) Delay<T>
  • (D) Postpone<T>

A

Admin • 828.03K Points
Coach

Q. Which type represents a value that never returns in Kotlin?

  • (A) Unit
  • (B) Nothing
  • (C) Null
  • (D) Void

A

Admin • 828.03K Points
Coach

Q. What is the keyword used to create an anonymous function in Kotlin?

  • (A) anonymous
  • (B) lambda
  • (C) fun
  • (D) def

A

Admin • 828.03K Points
Coach

Q. Which of the following keywords is used to declare an interface in Kotlin?

  • (A) interface
  • (B) trait
  • (C) implements
  • (D) protocol

A

Admin • 828.03K Points
Coach

Q. Which type in Kotlin can represent both a value and absence of value?

  • (A) Any
  • (B) Nothing
  • (C) Unit
  • (D) String?

A

Admin • 828.03K Points
Coach

Q. Which function is used to convert an integer to a string in Kotlin?

  • (A) toStr()
  • (B) toText()
  • (C) toString()
  • (D) asString()

A

Admin • 828.03K Points
Coach

Q. How do you define a function that accepts a lambda in Kotlin?

  • (A) fun test(lambda: function)
  • (B) fun test(lambda: () -> Unit)
  • (C) fun test(lambda: () => Void)
  • (D) fun test(lambda: lambda)

A

Admin • 828.03K Points
Coach

Q. Which function returns a random element from a list in Kotlin?

  • (A) pick()
  • (B) choose()
  • (C) random()
  • (D) select()

A

Admin • 828.03K Points
Coach

Q. Which operator is used to combine two collections?

  • (A) +
  • (B) &
  • (C) ++
  • (D) concat

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ