top of page

Kotlin Interview Questions and Answers
Top 100 Kotlin Interview Questions for Freshers
Here’s the revised version tailored for Machine Learning:
Machine Learning is one of the most in-demand skills in top tech companies, including IDM TechPark. Mastering concepts like supervised and unsupervised learning, deep learning, model evaluation, and deployment strategies makes a Machine Learning Engineer a valuable asset in modern AI-driven software development.
To secure a Machine Learning Engineer role at IDM TechPark, candidates must be proficient in technologies such as Python, TensorFlow, Scikit-Learn, SQL, cloud services, and MLOps, as well as be prepared to tackle both the Machine Learning Online Assessment and Technical Interview Round.
To help you succeed, we have compiled a list of the Top 100 Machine Learning Interview Questions along with their answers. Mastering these will give you a strong edge in cracking Machine Learning interviews at IDM TechPark.
​
-
What is Kotlin?
Answer: Kotlin is a statically typed, modern programming language that runs on the JVM and is officially supported for Android development by Google. It is concise, safe, and interoperable with Java. -
What are the advantages of Kotlin over Java?
Answer:-
Concise syntax
-
Null safety
-
Extension functions
-
Coroutines for asynchronous programming
-
Interoperability with Java
-
-
What is the difference between val and var in Kotlin?
Answer:-
val (immutable): Read-only variable (like final in Java).
-
var (mutable): Can be reassigned.
-
-
What is a data class in Kotlin?
Answer: A data class is a class used to hold data. It automatically provides equals(), hashCode(), copy(), and toString().data class User(val name: String, val age: Int)
-
What is the difference between == and === in Kotlin?
Answer:-
== checks structural equality (equivalent to .equals()).
-
=== checks referential equality (whether they point to the same object).
-
-
What is an extension function in Kotlin?
Answer: A function that extends a class without modifying its source code.fun String.hello() = "Hello, $this"
-
What is the primary constructor in Kotlin?
Answer: A constructor declared in the class header.class Person(val name: String, val age: Int)
-
What is the difference between an open class and a final class?
Answer:-
open: Can be inherited.
-
final (default in Kotlin): Cannot be inherited.
-
-
What is an object declaration in Kotlin?
Answer: Used to create a singleton.object Singleton { fun show() = "I am a singleton" }
-
What are sealed classes in Kotlin?
Answer: A restricted class hierarchy used for representing restricted types.sealed class Result { class Success(val data: String) : Result() class Error(val message: String) : Result() }
-
How does Kotlin handle null safety?
Answer: By using nullable (?) and non-nullable (!) types.var name: String? = null // Nullable
-
What is the Elvis operator (?:) in Kotlin?
Answer: Provides a default value when encountering null.val length = name?.length ?: 0
-
What are Kotlin collections, and how do they differ from Java?
Answer:-
Kotlin has mutable (MutableList, MutableSet, MutableMap) and immutable collections (List, Set, Map).
-
-
How do you filter a list in Kotlin?
Answer:val numbers = listOf(1, 2, 3, 4, 5) val even = numbers.filter { it % 2 == 0 }
-
How do you convert a list to a mutable list in Kotlin?
Answer:val mutableList = listOf(1, 2, 3).toMutableList()
-
What are coroutines in Kotlin?
Answer: Lightweight threads that help in asynchronous programming. -
What is suspend in Kotlin?
Answer: Used to define a coroutine function that can be paused and resumed.suspend fun fetchData() { /* ... */ }
-
What is a higher-order function?
Answer: A function that takes another function as a parameter or returns a function.fun operation(a: Int, b: Int, action: (Int, Int) -> Int): Int { return action(a, b) }
-
What are inline functions in Kotlin?
Answer: Functions that are expanded at the call site, reducing overhead.inline fun greet(name: String) = "Hello, $name"
-
What is the difference between launch and async in coroutines?
Answer:-
launch: Starts a coroutine that does not return a result.
-
async: Starts a coroutine that returns a result (Deferred).
-
-
How is Kotlin interoperable with Java?
Answer:-
Call Java from Kotlin and vice versa.
-
Use @JvmStatic, @JvmOverloads, and @JvmField for smooth interop.
-
-
How do you call a Kotlin function from Java?
Answer: Use static methods via companion objects or top-level functions. -
What are Android KTX extensions?
Answer: Kotlin extensions that simplify Android development. -
What is lateinit in Kotlin?
Answer: Allows a non-null variable to be initialized later.lateinit var name: String
-
What is by lazy in Kotlin?
Answer: Delayed initialization until first use.val data: String by lazy { "Hello, World!" }
​
bottom of page