Kotlin Program - Study Mode

[#66] What is the syntax for defining a secondary constructor in Kotlin?
Correct Answer

(D) fun constructor(val name: String)

[#67] How can you call a primary constructor from a secondary constructor in Kotlin?
Correct Answer

(A) by using the this keyword

[#68] How can you pass parameters to a primary constructor in Kotlin?
Correct Answer

(B) by using the val keyword

[#69] What is the syntax for defining a constructor with default values in Kotlin?
Correct Answer

(B) constructor(val name: String = "default")

[#70] Kotlin has two equality operators, == and ===. What is the difference?
Correct Answer

(D) == determines if two objects have the same value. === determines if two references point to the same object