Kotlin Variables and Data Types
Kotlin Variables and Data Types - Important Points
11. | Which of the following is a valid Kotlin variable declaration for a nullable String? |
---|
A. var name: String = null
B. var name: String? = null
C. var name = null
D. var name: Nullable
Answer: option b
Explanation:
12. | What is the output of the following Kotlin code? fun main() { |
---|
A. 2.5
B. 2
C. 2
D. 2.5f
View Answer Discuss Work SpaceAnswer: option b
Explanation:
13. | What is the output of the following Kotlin code? fun main() { |
---|
A. 2.5
B. 2
C. 2
D. 2.5f
View Answer Discuss Work SpaceAnswer: option a
Explanation:
14. | Which of the following is a valid Kotlin variable declaration for a list of strings? |
---|
A. val names: ArrayList
B. val names = ["John", "Jane"]
C. val names: List
D. val names = arrayListOf("John", "Jane")
View Answer Discuss Work SpaceAnswer: option c
Explanation:
15. | What is the output of the following Kotlin code? fun main() { |
---|
A. 510
B. 15
C. 510
D. 15
View Answer Discuss Work SpaceAnswer: option b
Explanation: