M5S1 Flashcards
X refers to the order in which a
program’s statements are executed
Flow of control
Any algorithm can be built using combinations of
four standardized flow of control structures:
sequential
selection
repetition
invocation
Normal flow of control for all programs is X
sequential
X is used to select which statements are
performed next based on a condition
Selection
X is used to repeat a set of statements
Repetition
X is used to invoke a sequence of
instructions using a single statement, as in
calling a function
Invocation
An expression created using a relational operator.
relational expression
Relational expressions are also known as X
conditions
The expression in a relational expression is interpreted as either X
true (non-zero) or false (0).
grade >= 70
point out the operand and the relational operator
operand:
grade and 70
relational operator:
>=
More complex conditions can be created using the X
logical operations AND (&&), OR (||), and NOT (!)
grade >= 70 && grade < 80
point out the operand, logical operator, and the relational operator
operands:
grade, 70, geade, 80
relational operator:
>=, <
logical operator:
&&
allows you to control if a program
enters a section of code or not based on whether a given
condition is true or false
if statement
The structure of an if statement:
single statement
compound statement
X means an if or ifelse statement inside
another if statement
Nested if statements
The if statements are executed from the top down. As soon as one of the conditions controlling the if is true, the statement associated with that if is executed, and the rest of the ladder is X. If none of the conditions is true, then the final else statement will be X.
bypassed
executed