Kotlin Test

Exam Type: Kotlin MCQ Skill Test
Questions Type: Multiple Choice Questions
Total Questions: 18
Time Limit: 30 Minutes
Last Update June, 2025

Pass Kotlin Exam

75%
Total time

1 minute 2 seconds

Total time

1 correct answers

Total time

6 incorrect answers

Total time

6 not attempted

Start

Kotlin Quiz

Question 1 of 18
30:00

Your function is passed a parameter obj of type Any. Which code snippet shows a way to retrieve the original type of obj, including package information?

The following code is occasionally throwing a null pointer exception (NPE). How can you change the code so it never throws an NPE?
 println("length of First Name = ${firstName!!.length}”)

You would like to know each time a class property is updated. Which code snippet shows a built-in delegated property that can accomplish this?

You want to know each time a class property is updated. If the new value is not within range, you want to stop the update. Which code snippet shows a built-in delegated property that can accomplish this?

Which line of code shows how to display a nullable string's length and shows 0 instead of null?

Your code needs to try casting an object. If the cast isn't possible, you don't want an exception generated. Instead you'd like null to be assigned. Which operator can safely cast a value?

In order to subclass the Person class, what is one thing you must do? Abstract class Person(val name: String) {abstract fun displayJob(description: String)}

You are upgrading a Java class to Kotlin. What should you use to replace the Java class’s static fields?

Kotlin has two equality operators, == and ===. What is the difference?

Which line of code defines a function that accepts an integer and a string as parameters and returns nothing?

Which function changes the value of the element at the current iterator location?

Which is the proper way to declare a singleton named DatabaseManager?

What is the preferred way to create an immutable variable of type long?

You have an enum class Signal that represents the state of a network connection. You want to print the position number of the SENDING enum. Which line of code does that? enum class Signal { OPEN, CLOSED, SENDING }

What is the entry point for a Kotlin application?

You have created a class that should be visible only to the other code in its module. Which modifier do you use?

Which snippet correctly shows setting the variable max to whichever variable holds the greatest value, a or b, using idiomatic Kotlin?

Inside an extension function, what is the name of the variable that corresponds to the receiver object?

Kotlin Test Explained

© 2025 Skill Test Answer. All Rights Reserved