Correct Answer: Val name: String? = null
Explanation:
Note: This Question is unanswered, help us to find answer for this one
Kotlin Skill Assessment
Your Skill Level: Poor
Retake Quizzes to improve it
More Kotlin MCQ Questions
Which line of code is a shorter, more idiomatic version of the displayed snippet? val len: Int = if (x != null) x.length else -1
The Kotlin .. operator can be written as which function?
In this code snippet, why does the compiler not allow the value of y to change? For(y in 1..100) y+=2
This code snippet compiles without error, but never prints the results when executed. What could be wrong? Val result = generateSequence(1) { it + 1 }.toList(); Println(result)
You would like to group a list of students by last name and get the total number of groups. Which line of code accomplishes this, assuming you have a list of the Student data class? Data class Student(val firstName: String, val lastName: String)
What is the correct way to initialize a nullable variable?
You would like to know each time a class property is updated. Which code snippet shows a built-in delegated property that can accomplish this?
You have an enum class Signal that represents the state of a network connection. You want to print the position number of the SENDING enum. Which line of code does that?
Which snippet correctly shows setting the variable max to whichever variable holds the greatest value, a or b, using idiomatic Kotlin?
Kotlin has two equality operators, == and ===. What is the difference?