0
0
C Sharp (C#)programming~10 mins

Boolean type behavior in C Sharp (C#) - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare a Boolean variable with the value true.

C Sharp (C#)
bool isActive = [1];
Drag options to blanks, or click blank then click option'
Atrue
BTrue
C1
D"true"
Attempts:
3 left
💡 Hint
Common Mistakes
Using capitalized True instead of lowercase true.
Using numeric values like 1 instead of Boolean literals.
Using string "true" instead of Boolean literal.
2fill in blank
medium

Complete the code to check if the Boolean variable is false.

C Sharp (C#)
if (isEnabled == [1]) {
    Console.WriteLine("Disabled");
}
Drag options to blanks, or click blank then click option'
A0
Bfalse
CFalse
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using capitalized False instead of lowercase false.
Using numeric 0 instead of Boolean literal.
Using True instead of false.
3fill in blank
hard

Fix the error in the code to correctly assign a Boolean value.

C Sharp (C#)
bool isReady = [1];
Drag options to blanks, or click blank then click option'
A"true"
BTrue
Ctrue
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using string "true" instead of Boolean literal.
Using capitalized True which is invalid in C#.
Using numeric 1 instead of Boolean literal.
4fill in blank
hard

Fill both blanks to create a Boolean expression that checks if x is greater than 10.

C Sharp (C#)
bool result = (x [1] 10) [2] true;
Drag options to blanks, or click blank then click option'
A>
B==
C<
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using < instead of > for greater than.
Using != instead of == for equality check.
Omitting the comparison to true.
5fill in blank
hard

Fill all three blanks to create a Boolean expression that checks if y is less than or equal to 5 and isActive is true.

C Sharp (C#)
bool check = (y [1] 5) [2] (isActive [3] true);
Drag options to blanks, or click blank then click option'
A<=
B&&
C==
D||
Attempts:
3 left
💡 Hint
Common Mistakes
Using < instead of <= for less than or equal.
Using || instead of && for logical AND.
Omitting == when comparing Boolean values.