Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to check if both conditions are true.
Go
if a > 0 [1] b < 10 { fmt.Println("Both conditions are true") }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
๐ก Hint
Common Mistakes
Using || instead of &&
Using ! which negates a condition
โ Incorrect
The && operator checks if both conditions are true.
2fill in blank
mediumComplete the code to check if at least one condition is true.
Go
if x == 5 [1] y == 10 { fmt.Println("At least one condition is true") }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
๐ก Hint
Common Mistakes
Using && which requires both conditions
Using == which compares equality
โ Incorrect
The || operator means 'or' and returns true if either condition is true.
3fill in blank
hardFix the error in the condition to negate the check.
Go
if [1] { fmt.Println("Flag is false") }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
๐ก Hint
Common Mistakes
Using assignment = instead of comparison
Not negating the flag
โ Incorrect
The !flag negates the boolean value of flag.
4fill in blank
hardFill both blanks to check if number is between 10 and 20 (inclusive).
Go
if num [1]= 10 [2] num <= 20 { fmt.Println("Number is between 10 and 20") }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
๐ก Hint
Common Mistakes
Using < instead of >
Using || instead of &&
โ Incorrect
Use num >= 10 and && to combine conditions.
5fill in blank
hardFill all three blanks to check if value is outside the range 1 to 5.
Go
if value [1] 1 [2] value [3] 5 { fmt.Println("Value is outside 1 to 5") }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
๐ก Hint
Common Mistakes
Using && which means both conditions must be true
Swapping < and > signs
โ Incorrect
Use value < 1 or value > 5 combined with || to check outside the range.