Introduction
Here is a list of the top 25 Kotlin programming interview questions and answers.
Q1. What is Kotlin Programming?
Kotlin is a general-purpose, statically typed and open-source programming language. It runs on JVM and can be used anywhere where Java is used today. It is used to develop Android mobile apps.
Kotlin was developed by JetBrains and its team. Kotlin project was started in 2010 and it was developed under the Apache 2.0 license.
Q2. What is the current version of Kotlin?
The current version of Kotlin 1.3.61
Q3. How do you declare variables in Kotlin?
Kotlin variable is declared using keywords Var and Val.
We can declare variables in Kotlin with two ways,
1. var language="Java" // var is a string type declare variables
2. val salary= 30000 // and val is a Int type declare variables
Learn more, Variables and Statements in Kotlin
Q4. What is the difference between var and val variables?
Var – Variable – A multi-purpose variable that stores a value but the type of the variable or the value can be changed. A different data type can be stored in the same variable.
Val – Value – The value type variable can store the type of the value that was put away in val, but couldn't shift in time. When alloted, just the val gets read, similar to a consistent in Java Programming language. The properties of the article (as Val) could be changed, yet the item itself is perused only.
Allot and change estimation of Var for an essential information type
Q5. What’s Null Safety in kotlin
Invalid Safety in Kotlin is to dispose of the danger of the event of NullPointerException continuously. On the off chance that you are a Java designer, you may have unquestionably run over the barbarities of NullPointerException it makes during constant.
Q6. what is the difference between print() and println().
The difference between print() and println():-
1. print() in this method used to print valus provided inside the method"()".
2. println() mehtod is used to print values provided inside the method "()" and moves cursor to the beginning of next line.
Q7. How many types are used in kotlin?
there are to type function used in kotlin:
1. Standard library function
2. User-defined function
Q8. What is the Standard library function and User-defined function?
1. A standard library function is built-in library functions that are implicitly present in the library and available for use.
2. A user-defined function is a function that is created by the user. User-defined function takes the parameters(s), perform an action and return the result of that action as a value
Q9. What is the Inline Function in Kotlin?
An inline function is declared with a keyword inline. The use of inline function enhances the performance of higher-order functions. The inline function tells the compiler to copy parameters and functions to the call site.
Q10. What are the features you think are there in Kotlin but not in Java?
Kotlin has a lot of highlights that Java doesn't.
1.Coroutines
2.Companion Objects
3.Data classes
4.Operator Overloading
5.Range expressions
6.Smart casts

Rathrola Prem KumarPosted Jan 27, 2020, 6:23 PM
thanks for sharing