Conditional/ Selection Structure Flashcards
an IF structure is what type of selection structure?
Single-Selection Structure
Is it necessary to use curly braces when using a single-selection structure?
No, but it is good coding style.
What is an example of a double-selection structure?
If-else
What is the final “else” called in a if-else-if structure?
A trailing else block
TRUE with the AND operator
All conditions must be true.
FALSE with the OR operator
All conditions must be false
What is the difference between ‘&’ operator and ‘&&’ operator?
‘&’ is bitwise and will do both comparisons no matter if the first is true or false. ‘&&’ is the logical AND and will stop testing if first condition is false.
What is the BANG operator?
NOT (!)
How do you get TRUE for the bitwise operator?
Returns TRUE if both values are different
What are the other ways to say bitwise operator?
Logical XOR, EXCLUSIVE OR, (^)
What is a switch statement able to evaluate for?
Equality (==)
What data type can a switch statement NOT evaluate?
Floating numbers (decimals)
Can a String be evaluated with a switch statement?
Yes
What is typically the final line in a switch statement?
Default
What keyword is needed to exit a switch when the matching value is found?
break