Not another Interviews’ article: Kotlin Questions

Image result for kotlin code
From: https://android.jlelse.eu/writing-java-friendly-kotlin-code-c408b24fb4e (btw also check this out as it is an very nice article)

[Previous Chapter — Java/Android Questions]| Next Chapter — Aftermath]

I’ve explained in the previous article why I share a lot of the questions I normally use during an interview. Also how I structure the interview, so let’s jump right ahead…


Theoretical questions

Junior SE Questions

Kotlin

  1. What’s the difference between val and var? What about const and val? Which are mutable and immutable?
  2. What is companion object?
  3. What is the lateinit modifier for?
  4. What are the access modifiers you know? What does each one do? public, internal, protected, private?
  5. How do you declare a variable as volatile in Kotlin ?
  6. Which is the default modifier for a function: open, final?
  7. What is the init block?
  8. What the Java equivalent of static in Kotlin? If you are integrating with Java code do you have to do anything specific?
  9. What’s a data class? What about an object?
  10. Does you class compile if the package is wrong? Why?
  11. What’s the difference between == and === ?
  12. What do we mean when we say Kotlin is a null safety language?
  13. What types of constructors are there in Kotlin?
  14. What’s the type of arguments inside a constructor? Why do you think they are val unless explicitly set to var?
  15. What’s the equivalent of Java’s switch? What are the differences?
  16. Can when statement in Kotlin be used without passing any argument ?
  17. What is the difference between a member function and extension function in Kotlin?
  18. Does Kotlin support Checked Exceptions like in Java?
  19. Does Kotlin support both Explicit conversion and Implicit conversions?
  20. What is Elvis Expression in Kotlin?
  21. What are primitive Data Types in kotlin?
  22. Can we pass a different number of arguments to the same Function in Kotlin?
  23. What is the difference between Return Type Unit and Return Type Nothing in Kotlin?
  24. What is keyword vararg in Kotlin used for?
  25. What is spread operator / *(sterik) in Kotlin?
  26. What are inline functions in Kotlin?
  27. What is .. operator in Kotlin? What’s the advantage of using Ranges?
  28. How is !! different from ?. in unwrapping the nullable values? Is there any other way to unwrap nullable values safely?
  29. How does string interpolation work in Kotlin?
  30. What’s the type of the following Array?
    val arr = arrayOf(1, 2, 3);
  31. Do you have a Ternary Conditional Operator in Kotlin ? How do you do it then?
  32. What is the use of function extension ?
  33. Does Kotlin allows you to have field variables in interfaces?
  34. What is Kotlin String Interpolation ?
  35. What’s the difference between .run and .apply?
  36. What’s is .let for? What’s the difference between ?.let and .let?

Mid SE Questions

Kotlin

  1. What are High Level Functions in Kotlin?
  2. What is the difference between object { } block and companion object { } code block in Kotlin?
  3. What are destructuring declarations in Kotlin?
  4. What are the Strings available in Kotlin ? What’s the difference between a raw String and escaped String?
  5. What’s the difference between inline and infix functions?
  6. What are Coroutines?
  7. What the difference between RxJava and Coroutines? Can we do the same with both?

I’m still constructing this part.. so check this article regularly as I add more questions!


So… after seeing all this how can you beat someone at his “own game”?

Well, I was going to write a bit more about how to address a question and answer “properly”. But I found someone who already did, so no need to repeat. Read this, and then come back.

Breath in, breath out…

This is not the end!

You shouldn’t definitely skip the last part, let’s proceed…

[Next Chapter — Aftermath]