Variables & Types interview questions

18 real Variables & Types questions from the Kotlin bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

1. What is val?

Junior
  1. A.the compiler's ability to deduce a declaration's type from its initializer without an explicit annotation
  2. B.a read-only declaration that can be assigned exactly once and cannot be reassigned afterward
  3. C.the root supertype from which every non-nullable type ultimately descends
  4. D.an automatic conversion to a more specific type after a check, letting later code use it without manual casting
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Junior
  1. A.val — the root supertype from which every non-nullable type ultimately descends
  2. B.val — a read-only declaration that can be assigned exactly once and cannot be reassigned afterward
  3. C.val — the type with a single value returned by functions that produce no meaningful result
  4. D.val — the compiler's ability to deduce a declaration's type from its initializer without an explicit annotation
Reveal the answer + AI explanation — free account

4. What is var?

Junior
  1. A.the type with a single value returned by functions that produce no meaningful result
  2. B.a read-only declaration that can be assigned exactly once and cannot be reassigned afterward
  3. C.the root supertype from which every non-nullable type ultimately descends
  4. D.a mutable declaration whose binding can be reassigned multiple times
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Junior
  1. A.var — an automatic conversion to a more specific type after a check, letting later code use it without manual casting
  2. B.var — the type with a single value returned by functions that produce no meaningful result
  3. C.var — a read-only declaration that can be assigned exactly once and cannot be reassigned afterward
  4. D.var — a mutable declaration whose binding can be reassigned multiple times
Reveal the answer + AI explanation — free account

7. What is Type inference?

Junior
  1. A.a mutable declaration whose binding can be reassigned multiple times
  2. B.a read-only declaration that can be assigned exactly once and cannot be reassigned afterward
  3. C.the type with a single value returned by functions that produce no meaningful result
  4. D.the compiler's ability to deduce a declaration's type from its initializer without an explicit annotation
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Junior
  1. A.Type inference — an automatic conversion to a more specific type after a check, letting later code use it without manual casting
  2. B.Type inference — a read-only declaration that can be assigned exactly once and cannot be reassigned afterward
  3. C.Type inference — the compiler's ability to deduce a declaration's type from its initializer without an explicit annotation
  4. D.Type inference — the root supertype from which every non-nullable type ultimately descends
Reveal the answer + AI explanation — free account

10. What is Smart cast?

Mid
  1. A.the root supertype from which every non-nullable type ultimately descends
  2. B.the type with a single value returned by functions that produce no meaningful result
  3. C.a read-only declaration that can be assigned exactly once and cannot be reassigned afterward
  4. D.an automatic conversion to a more specific type after a check, letting later code use it without manual casting
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Mid
  1. A.Smart cast — an automatic conversion to a more specific type after a check, letting later code use it without manual casting
  2. B.Smart cast — the compiler's ability to deduce a declaration's type from its initializer without an explicit annotation
  3. C.Smart cast — the root supertype from which every non-nullable type ultimately descends
  4. D.Smart cast — a read-only declaration that can be assigned exactly once and cannot be reassigned afterward
Reveal the answer + AI explanation — free account

13. What is Any?

Mid
  1. A.the root supertype from which every non-nullable type ultimately descends
  2. B.a read-only declaration that can be assigned exactly once and cannot be reassigned afterward
  3. C.the compiler's ability to deduce a declaration's type from its initializer without an explicit annotation
  4. D.an automatic conversion to a more specific type after a check, letting later code use it without manual casting
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Mid
  1. A.Any — the compiler's ability to deduce a declaration's type from its initializer without an explicit annotation
  2. B.Any — the root supertype from which every non-nullable type ultimately descends
  3. C.Any — the type with a single value returned by functions that produce no meaningful result
  4. D.Any — a mutable declaration whose binding can be reassigned multiple times
Reveal the answer + AI explanation — free account

16. What is Unit?

Mid
  1. A.the type with a single value returned by functions that produce no meaningful result
  2. B.a mutable declaration whose binding can be reassigned multiple times
  3. C.the compiler's ability to deduce a declaration's type from its initializer without an explicit annotation
  4. D.an automatic conversion to a more specific type after a check, letting later code use it without manual casting
Reveal the answer + AI explanation — free account

18. Which statement is correct?

Mid
  1. A.Unit — an automatic conversion to a more specific type after a check, letting later code use it without manual casting
  2. B.Unit — the type with a single value returned by functions that produce no meaningful result
  3. C.Unit — a mutable declaration whose binding can be reassigned multiple times
  4. D.Unit — the compiler's ability to deduce a declaration's type from its initializer without an explicit annotation
Reveal the answer + AI explanation — free account

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice Variables & Types free