Chapter 8 Flashcards
What is a control structure?
A control statement and the statements whose execution are controlled
What is the most important design question for control structures?
Should a control structure have multiple entries
What does a selection statement provide?
A choice between 2+ execution paths
What are the 2 categories for selection statements?
2 way selectors and Multiple way selectors.
What is the general form of a 2 way selection statements
if then else
How are compound statements usually delimited as?
Square braces
Are statement sequences contained in blocks?
No.
To disambiguate nested selectors:
Match else with nearest if.
Force semantics ({})
What are the design issues with multiple way selectors?
What is the control expression’s form and type.
How are selectable segments specified.
Is execution in structure only a single selection
How are case values specified
How are unrepresented expression values handled
(switch case in c c++ Java and JS)
Can a if statement be a multiple way selector?
Yes. if elif elif elif …
What are the 2 types of iterative statements?
Iteration
Recursion
What are the design issues for iterative statements?
How are the iterations controlled
Where is the control mechanism in the loop
What do Counting iterative statement have?
Loop variable.
variables intial, terminal and stepsize values
What is the design issues for counter controlled loops design issues?
Type + scope of loop variable
Can loop variable be changed in loop body.
Should the loop parameters be evaluated only once?
What is the loop variable after the loop
What is logically controlled loops?
Repetition control using Boolean expressions