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

Logical patterns (and, or, not) in C Sharp (C#) - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the and logical pattern check in C#?
The and pattern checks if both conditions are true. It returns true only if all parts are true.
Click to reveal answer
beginner
How does the or logical pattern work in C#?
The or pattern returns true if at least one of the conditions is true. It only returns false if all parts are false.
Click to reveal answer
beginner
What is the purpose of the not logical pattern in C#?
The not pattern reverses the condition. If the condition is true, not makes it false, and vice versa.
Click to reveal answer
beginner
Given bool a = true; and bool b = false;, what is the result of a and b?
The result is false because and requires both to be true, but b is false.
Click to reveal answer
beginner
Explain the difference between and and or logical patterns.
and requires all conditions to be true to return true. or requires only one condition to be true to return true.
Click to reveal answer
What does the and logical pattern return if one condition is false?
ATrue
BDepends on the other condition
CFalse
DThrows an error
Which logical pattern returns true if at least one condition is true?
Anot
Bor
Cand
Dxor
What does the not logical pattern do to a true condition?
AChanges it to false
BThrows an error
CKeeps it true
DIgnores it
If a = true and b = false, what is the result of a or b?
AError
BFalse
CNull
DTrue
Which logical pattern would you use to check if both conditions are true?
Aand
Bxor
Cnot
Dor
Describe how the logical patterns and, or, and not work in C#.
Think about when each pattern returns true or false.
You got /3 concepts.
    Give an example of using and and or logical patterns in a simple C# if statement.
    Use variables with true/false values.
    You got /4 concepts.