Chapter 4 Control Structures Flashcards
1
Q
What is a switch statement?
A
A switch statement is an efficient way to select a code block to execute based on the value of a variable or expression.
2
Q
What is a conditional operator?
A
This is a ternary operator that evaluates a simple if..else statement.
3
Q
What are the different types of control? Define them.
A
Sequential (default), selection (conditionals), and repetition (loops).
4
Q
What are the logical operators?
A
Negation (!x), AND (&&), and OR (||).
5
Q
What is the conditional operator?
A
The testExpression ? ifTrue : ifFalse.
6
Q
What is a global variable?
A
Declared outside all the scopes and can be used anywhere with :: .