Kotlin MCQs with answers Page - 8

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. How do you declare a block of code that executes only once in Kotlin?

  • (A) block()
  • (B) once()
  • (C) object
  • (D) init

A

Admin • 828.03K Points
Coach

Q. Which of these types is used to represent a value that may or may not exist?

  • (A) Optional
  • (B) Nullable
  • (C) Maybe
  • (D) Unknown

A

Admin • 828.03K Points
Coach

Q. How do you define a multiline string in Kotlin?

  • (A) Using '''
  • (B) Using """
  • (C) Using \n
  • (D) Using +

A

Admin • 828.03K Points
Coach

Q. Which Kotlin keyword is used to implement a delegate property?

  • (A) by
  • (B) as
  • (C) with
  • (D) to

A

Admin • 828.03K Points
Coach

Q. What does 'lateinit' mean in Kotlin?

  • (A) Property is static
  • (B) Property is initialized later
  • (C) Property cannot be null
  • (D) Property is a function

A

Admin • 828.03K Points
Coach

Q. Which class is used to define exceptions in Kotlin?

  • (A) Throwable
  • (B) Error
  • (C) RuntimeError
  • (D) Exception

A

Admin • 828.03K Points
Coach

Q. Which of these is true about Kotlin interfaces?

  • (A) They can have default method implementations
  • (B) They cannot have properties
  • (C) They must be abstract
  • (D) They cannot be implemented

A

Admin • 828.03K Points
Coach

Q. Which annotation is used to tell Kotlin to treat a function as Java static?

  • (A) @JvmStatic
  • (B) @Static
  • (C) @JavaStatic
  • (D) @KtStatic

A

Admin • 828.03K Points
Coach

Q. Which function in Kotlin returns the last element of a list?

  • (A) tail()
  • (B) last()
  • (C) end()
  • (D) final()

A

Admin • 828.03K Points
Coach

Q. Which Kotlin function can be used to repeat a task N times?

  • (A) repeat()
  • (B) loop()
  • (C) forEach()
  • (D) doRepeat()

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