Quiz: Conditional Statements
Test your understanding of the concepts discussed in this chapter.
1
What is the output of the following code?
fun main() {
val superuser = true
val hasAccess: Boolean = if (superuser) {
println("Good morning, sir Admin")
true
} else {
false
}
println(hasAccess)
}
A)
The code will not compile.
B)
Good morning, sir Admin
false
C)
Good morning, sir Admin
true
D)
false
Question 1 of 50 attempted
Get hands-on with 1400+ tech skills courses.