Kotlin MCQ

Kotlin MCQ

  • Sharad Jaiswal
  • 23rd Nov, 2021

We have listed here the best Kotlin MCQ Questions for your basic knowledge of Kotlin. This Kotlin MCQ Test contains 25+ Kotlin Multiple Choice Questions. You have to select the right answer to every question to check your final preparation for Kotlin MCQ Interview, Exam, or Placement drives.

Practice Best Kotlin MCQ Questions

1) Kotlin is developed by?

  • A. Adobe
  • B.Google
  • C.JetBrains
  • D.Microsoft

2) What is the default behavior of Kotlin classes?

  • A. All classes are sealed
  • B.All classes are public
  • C.All classes are abstract
  • D.All classes are final

3) Which of the following is true for Kotlin variables?

  • A. var can't be changed
  • B.val corresponds to final variable in Java
  • C.val can be changed
  • D.All variables are immutable by default

4) What is an immutable variable?

  • A. A variable that can't change, read-only
  • B.A variable that can be changed
  • C.A variable used for string interpolation
  • D.None of the above

5) Identify the correct way to create an arraylist in Kotlin?

  • A. val list = arrayListOf(1, 2, 3)
  • B.val map = hashMapOf(1 to "one", 2 to "two", 3 to "three")
  • C.val set = hashSetOf(1, 2, 3)
  • D.enum class Color {RED, GREEN, BLUE}

6) Which of follwing targets currently not supported by Kotlin?

  • A. .NET CLR
  • B.LLVM
  • C.Javascript
  • D.None of the above

7) Which of the following open source license is Kotlin released under?

  • A. FreeBSD License (BSD-2-Clause)
  • B.MIT License (MIT)
  • C.Apache License 2.0 (Apache 2.0)
  • D.GNU General Public License (GPL)

8) Does Kotlin work only for Java?

  • A. Yes
  • B.No

9) Is Kotlin backward-compatible?

  • A. Yes
  • B.No

10) Does Kotlin allow macros?

  • A. Yes
  • B.No

11) How do you get the length of a string in Kotlin?

  • A. str.lengthOf
  • B.str.length
  • C.str.lengthOf
  • D.None of these

12) How to make a multi lined comment in Kotlin?

  • A. / multi line comment /
  • B.//
  • C./* */
  • D.None of these

13) Which file extension is used to save Kotlin files.

  • A. .kot
  • B..java
  • C..andriod
  • D..kt or .kts

14) Kotlin was developed under the which license?

  • A. Apache 1.0
  • B.Apache 1.1
  • C.Apache 2.0
  • D.None of the above

15) Which of the following is not a way for creating a comment in kotlin?

  • A. Use /* to start a comment that is one line long.
  • B.Use // to turn the rest of a function into a comment.
  • C.Put /* or /** to start a block comment, and end it with */.
  • D.Add // at the beginning of or inside a line and anything after that // is considered a comment.

16) Which file extension is used to save kotlin files?

  • A. .kot
  • B..java
  • C..andriod
  • D..kt or .kts

17) Which of these is used to handle null exceptions in kotlin?

  • A. Range
  • B.Sealed Class
  • C.Elvis Operator
  • D.Lambda function

18) What is correct way to create an arraylist in kotlin?

  • A. val set = hashSetOf(1, 2, 3)
  • B.val list = arrayListOf(1, 2, 3)
  • C.enum class Color {RED, GREEN, BLUE}
  • D.val map = hashMapOf(1 to “one”, 2 to “two”, 3 to “three”)

19) A Java file with extension ‘.class’ contains............

  • A. HTML tags
  • B.Java Byte code
  • C.Java source code
  • D.A program file written in Java programming language

20) What is the correct way to create an arraylist in kotlin?

  • A. val list = arrayListOf(1, 2, 3)
  • B.val set = hashSetOf(1, 2, 3)
  • C.enum class Color {RED, GREEN, BLUE}
  • D.val map = hashMapOf(1 to "one", 2 to "two", 3 to "three")

21) An activity can be thought of as corresponding to what?

  • A. A Java class
  • B.A Java project
  • C.A method call
  • D.An object field

22) Which of the following is used to make an abstract class?

  • A. Declaring it abstract using virtual keyword.
  • B.Declaring it abstract using static keyword.
  • C.Making at least one member function as virtual function.
  • D.Making at least one member function as pure virtual function.

23) Kotlin is a .................... programming language, specially designed for developing mobile applications.

  • A. cross platform
  • B.statically typed
  • C.general-purpose
  • D.All of the above

24) Kotlin does not allow internal conversion of different data types.

  • A. True
  • B.False

25) Kotlin have ............. types of constructors.

  • A. 2
  • B.3
  • C.4
  • D.6

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.