Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to check if both conditions are true.
C Sharp (C#)
bool result = (a > 5) [1] (b < 10);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using || instead of && causes the condition to be true if either side is true.
✗ Incorrect
The && operator checks if both conditions are true.
2fill in blank
mediumComplete the code to check if at least one condition is true.
C Sharp (C#)
bool result = (x == 0) [1] (y == 1);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using && instead of || causes the condition to require both sides true.
✗ Incorrect
The || operator returns true if either condition is true.
3fill in blank
hardFix the error in the code to negate the condition.
C Sharp (C#)
bool isFalse = [1](flag); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'not' keyword which is not valid in C#.
Using double exclamation marks (!!) which is invalid syntax.
✗ Incorrect
The ! operator negates a boolean value in C#.
4fill in blank
hardFill both blanks to create a condition that is true only if a is true and b is false.
C Sharp (C#)
bool result = (a [1] true) [2] (b [3] false);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using || instead of && changes the logic to 'or' instead of 'and'.
Using != instead of == for comparisons causes wrong results.
✗ Incorrect
Use == to compare values, && to combine conditions with 'and', and != to check inequality.
5fill in blank
hardFill all three blanks to create a condition that is true if x is greater than 10 or y is less than 5 and z is not equal to 0.
C Sharp (C#)
bool check = (x [1] 10) [2] (y [3] 5) && (z != 0);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using && instead of || changes the logic to require both conditions true.
Using >= or <= instead of > or < changes the condition meaning.
✗ Incorrect
Use > to check if x is greater than 10, || for 'or', and < to check if y is less than 5.