Kotlin MCQs with answers Page - 1

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 • 799.53K Points
Coach

Q. What is Kotlin primarily used for?

  • (A) System-level programming
  • (B) Game development only
  • (C) Android app development
  • (D) Hardware programming

A

Admin • 799.53K Points
Coach

Q. Who developed Kotlin?

  • (A) Google
  • (B) JetBrains
  • (C) Oracle
  • (D) IBM

A

Admin • 799.53K Points
Coach

Q. Which of the following is the correct way to declare a variable in Kotlin?

  • (A) int a = 10;
  • (B) var a = 10
  • (C) val a : int = 10
  • (D) a := 10

A

Admin • 799.53K Points
Coach

Q. What is the difference between 'val' and 'var' in Kotlin?

  • (A) val is mutable, var is immutable
  • (B) val is a function, var is a keyword
  • (C) val is immutable, var is mutable
  • (D) Both are same

A

Admin • 799.53K Points
Coach

Q. Which of these is used to define a function in Kotlin?

  • (A) function
  • (B) fun
  • (C) def
  • (D) func

A

Admin • 799.53K Points
Coach

Q. What is a nullable type in Kotlin?

  • (A) A type that is a number
  • (B) A type that can hold a null value
  • (C) A type that holds boolean only
  • (D) A function type

A

Admin • 799.53K Points
Coach

Q. How do you declare a nullable variable of type String?

  • (A) val name: String
  • (B) val name: String?
  • (C) String name = null
  • (D) nullable String name

A

Admin • 799.53K Points
Coach

Q. Which Kotlin feature allows you to handle null values safely?

  • (A) if-else
  • (B) safe call operator
  • (C) try-catch
  • (D) when

A

Admin • 799.53K Points
Coach

Q. What will 'val x: Int? = null' do?

  • (A) Throws an error
  • (B) Creates a non-nullable integer
  • (C) Creates a nullable integer that is null
  • (D) Creates a float

A

Admin • 799.53K Points
Coach

Q. Which keyword is used to create a class in Kotlin?

  • (A) class
  • (B) struct
  • (C) object
  • (D) type