Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to check if both conditions are true using the AND operator.
Kotlin
val a = true
val b = false
val result = a [1] b
println(result) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using || instead of &&
Using ! which negates a value
✗ Incorrect
The AND operator && returns true only if both sides are true.
2fill in blank
mediumComplete the code to check if at least one condition is true using the OR operator.
Kotlin
val x = false
val y = true
val result = x [1] y
println(result) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using && instead of ||
Using ! which negates a value
✗ Incorrect
The OR operator || returns true if at least one side is true.
3fill in blank
hardFix the error in the code by using the correct NOT operator.
Kotlin
val flag = true
val result = [1]flag
println(result) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using && or || instead of !
Using == which compares values
✗ Incorrect
The NOT operator ! negates the boolean value.
4fill in blank
hardFill both blanks to create a condition that is true only if a is true and b is false.
Kotlin
val a = true val b = false val result = a [1] [2]b println(result)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using || instead of &&
Not negating b with !
✗ Incorrect
Use && to require both conditions, and ! to negate b.
5fill in blank
hardFill all three blanks to create a condition that is true if either a is false, or both b and c are true.
Kotlin
val a = true val b = true val c = false val result = [1]a [2] (b [3] c) println(result)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up && and ||
Not negating a with !
✗ Incorrect
Use ! to negate a, || for OR, and && for AND inside parentheses.