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 &&
Using single & which is a bitwise operator
✗ Incorrect
The && operator checks if both conditions are true.
2fill in blank
mediumComplete the code to check if either 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 ||
Using single & which is a bitwise operator
✗ Incorrect
The || operator checks if at least one 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 bitwise complement operator ~ which is for integers
✗ Incorrect
The ! operator negates a boolean value in C#.
4fill in blank
hardFill all three blanks to check if number is between 10 and 20 inclusive.
C Sharp (C#)
bool inRange = (num [1] 10) [2] (num [3] 20);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using || instead of && which allows numbers outside the range
Using > or < instead of >= or <=
✗ Incorrect
The code checks if num is greater than or equal to 10 and less than or equal to 20 using &&.
5fill in blank
hardFill all three blanks to check if a character is a vowel (a, e, i, o, u).
C Sharp (C#)
bool isVowel = (ch == 'a') [1] (ch == 'e') [2] (ch == 'i') [3] (ch == 'o') || (ch == 'u');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using && which requires all conditions to be true (impossible here)
Mixing && and || operators incorrectly
✗ Incorrect
Use || to check if ch equals any vowel character.