Chapter 8 Flashcards
Statement-Level Control
Control Statements provide three primary capabilities. What are they?
1) Sequence
2) Selection
3) Iteration
What are the four categories of control statements?
1) selection
2) multiple selection
3) iterative
4) unconditional branching
A ___ statement provides the means of choosing between two or more execution paths in a program.
selection
Selection statements fall into two categories: ___-___ & ___-___
two-way & n-way
General design of two-way selection statement is
if (expression)
then
else
A ___ ___ is a control statement and the collection of statements whose execution it controls.
control structure
What is the one design issue that is relevant to all of the selection and iteration control statements?
Should the control structure have multiple entries?
What are the three design issues for two-way selectors?
1) What is the foe form and type of the expression that controls the selection
2) How are the then and else clauses specified
3) How should the meaning of nested selectors be specified?
The ___ - ___ statement allows the selection of one of any number of statements or statement groups.q
multiple-selection
What are the design issues associated with n-way selection statements? (5)
1) What is the form and type of the expression that controls the selection
2) How are the selectable segments specified
3) Is execution flow through the structure restricted to include just a single selectable segment
4) How are the case values specified
5) How should unrepresented selector expression values be handled, if at all
What is the common example of an n-way selection statement?
switch/case of if elseif else
An ___ statement is one that causes a statement or collection of statement to be executed zero, one or more times.
iterative
The ___ of an iterative statment is the collection of statements whose execution is controlled by the iteration statement.
body
We use the term ___ to mean that the test for loop completion occurs before the loop body is executed and ___ to mean that it occurs after the loop body is executed.
pretest, posttest
A counting iterative control statement has a variable, called the ___ variable, in which the count value is maintained. It also includes some means of specifying the ___ and ___ values of the loop variable, and the difference between sequential loop variable values, often called the ____.
loop, initial, terminal, stepsize