Chapter 8 Flashcards

Statement-Level Control

1
Q

Control Statements provide three primary capabilities. What are they?

A

1) Sequence
2) Selection
3) Iteration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the four categories of control statements?

A

1) selection
2) multiple selection
3) iterative
4) unconditional branching

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A ___ statement provides the means of choosing between two or more execution paths in a program.

A

selection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Selection statements fall into two categories: ___-___ & ___-___

A

two-way & n-way

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

General design of two-way selection statement is

A

if (expression)
then
else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A ___ ___ is a control statement and the collection of statements whose execution it controls.

A

control structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the one design issue that is relevant to all of the selection and iteration control statements?

A

Should the control structure have multiple entries?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the three design issues for two-way selectors?

A

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?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The ___ - ___ statement allows the selection of one of any number of statements or statement groups.q

A

multiple-selection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the design issues associated with n-way selection statements? (5)

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the common example of an n-way selection statement?

A
switch/case
of
if 
elseif
else
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

An ___ statement is one that causes a statement or collection of statement to be executed zero, one or more times.

A

iterative

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The ___ of an iterative statment is the collection of statements whose execution is controlled by the iteration statement.

A

body

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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.

A

pretest, posttest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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 ____.

A

loop, initial, terminal, stepsize

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The initial, terminal and stepsize specifications of a loop are called the loop ___.

A

parameters

17
Q

What are the four design issues with iterative counter-controlled statements?

A

1) What are the type and scope of the loop variable
2) Should it be legal for the loop variable or loop parameters to be changed in the loop, and if so, does the change affect loop control?
3) Should the loop parameters be evaluated only once, or once for every iteration?
4) What is the value of the loop variable after loop termination?

18
Q

What are the design issues for logically controlled loops (2)?

A

1) Should the control be pretest or posttest (Top or bottom)

2) Should the logically controlled loop be a special form of a counting loop or a separate statement

19
Q

What are the design issues for user-located loop control mechanisms? (2)

A

1) Should the conditional mechanism be an integral part of the exit?
2) Should only one loop body be exited, or can enclosing loops also be exited?

20
Q

An ___ ___ statement transfers execution control to a specified location ion the program.

A

unconditional branch

21
Q

In some languages, each line in the selection statement, consisting of a Boolean expression and a statement or statement sequence is called a ___ ___.

A

guarded command

22
Q

According to Bohm and Jacopini, the theoretical resultat that only ___, ___, and ___ ___ ___ are absolutely required to express computations.

A

sequence, selection, and pretest logical loops

23
Q

What is the obvious misues of the Bohm and jacopini result?

A

To argue against the inclusion of any control structures beyond selection and pretest logical loops.