kotlin interview questions

Top Frequently Asked Kotlin Interview Questions

What is Kotlin ?

Kotlin is an open source programming language that combines object oriented programming and functional features.It is introduced by JetBrains and runs on JVM.

What are the advantage of using Kotlin ?

Advantages are followings.

  • Kotlin is a functional language and based on JVM, so remove lots of boiler plate code.
  • Kotlin is easy to learn because its syntax is similar to java.
  • It is expressive language so make code readable and understandable.
  • Its performance is good.
  • Its not replacement of java.Its an official language of android development.

Is there any disadvantage of Kotlin ?

Kotlin does not have static modifier which can be problem for some conventional java developer.

In Kotlin same function can be declared in many places of application.sometimes it is hard to understand which function is being called.

What is the extension of Kotlin file ?


How does interoperable feature work in Kotlin for java ?

Kotlin compiler creates byte code and byte code can run on the JVM.Whenever two byte coded file runs on same JVM then they can communicate.

How to declare variable in Kotlin ?

val my_varibale: Char

What is the difference between var and val ?

val is like a constant whose value can not be change once assigned while var value we can change.

What are the Strings available in Kotlin ?

  • raw String
  • escaped String

What is Ranges operator in Kotlin ?

Ranges operator helps to iterate through a range.Its operator forms is (..)).For Example

for (i in 1..4)


It will print from 1 to 4 in output.

How many constructors are available in Kotlin

  • Primary constructor : One Kotlin class have one primary constructor.
  • Secondary constructor : One Kotlin class have one or more secondary constructor

Why do we need write open before class name in Kotlin while working on inheritance ?

In Kotlin by default class is final so to make it enable for inheritance we need to write open before class because final class can not be inherited.Same for method if we want to override it into child class.

In Kotlin can interface have implemented method ?

Yes like java 8 it can have default method.

What are the modifier available in Kotlin ?

  • private
  • protected
  • interval
  • public

Mention few features that Kotlin provides but not java ?

  • Range Expression
  • Extension Function
  • Companion Object
  • Smart casts
  • Data Classes

What is the use of function extension ?

By this we will able to add or remove some method functionality without inheriting or modifying them.

What is data class in Kotlin ?

This class holds the basic data type.It does not contain any functionality.

How to make a class data class ?

By adding data at the beginning of the class.

Can we migrate code from java to Kotlin ?

Yes, JetBrains IDEA provides inbuilt tool.

When instruction in Kotlin are executed ?

Right after the primary constructor

What is Null Safety in Kotlin ?

It eliminates the risk of occurrence of NullPointerException.Kotlin eliminates the usage of NullPointerException,unless explicitly called.If a variable is allowed to store null then declare variable will (?).

How to declare volatile variable ?

@volatile var my_varibale: String? = null

Visit Others Links

Interview Questions Top Elasticsearch Interview Question
Top Kubernetes Interview Question
Top HTTP Interview Question
Top PouchDB Interview Question
Top Pivotal Cloud Foundry (pcf) Interview Question
Top Apache Camel Interview Question
Top Docker Interview Question
Top Gradle Interview Question
Top Generics Interview Questions In Java
Java 9 Interview Questions
Top Maven Interview Question
Top RabbitMQ Interview Question
Top Spring Batch Interview Question
Top Spring Boot Interview Question
Top Tika Interview Question
Top Kotlin Interview Question
Top OpenShift Interview Question
Top Polymer Interview Question
Top WebGL Interview Question
Top Continuous Integration Interview Question
Top Spring Cloud Interview Question
Top JOGL Interview Question
Top JFreeChart Interview Question
Java MultiThreading Interview Question
Top Spring ROO Interview Question
Top Seaborn Interview Question
Top TestRail Interview Question
Top LolCode Interview Question
Top Spring Transaction Management Interview Question
Top DynamoDB Interview Question
Top PySpark Interview Question
Top SaltStack Interview Question
Top Spring AOP Interview Question
© 2019 PreparationForInterview.com