Chapter 4 Flashcards

1
Q

Repetition structure

A

Makes computer repeat code as necessary. Includes condition-controlled loops and count-controlled loops.

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

while loop

A

while condition is true, do something. a while condition is a condition-controlled loop. A condition is tested for true or false. The loop will continue as long as the condition is true.

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

Iteration

A

One execution of the body of the loop.

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

Infinite loop

A

Loop that does not have a way of stopping.

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

for loop

A

The for loop is a count-controlled loop. The for loop iterates a specific number of times. It’s designed to work with a sequence of data items. It will iterate once for each item in the sequence.

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

Target variable

A

The variable which is the target of the assignment at the beginning of each iteration.

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

Iterable

A

Contains a sequence of values that can be iterated over.

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

Augmented assignment operators

A

Special set of operators. Examples

\+= 
-=
*=
/=
%=
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Sentinel

A

Special value that marks the end of a sequence of items.

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

Input validation

A

Inspecting input before it is being processed by the program.

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

Nested loop

A

Loop that is contained inside another loop.

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

Loop control variable

A

The variable that has its value tested in a loop (and thus controls the number of iterations).

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

List the five elements of a loop.

A
  1. Initialization. Set up the proper conditions for the start of the loop, including identifying a loop control variable.
  2. Loop test. Specify the conditions that must be satisfied for the body of the loop to be executed.
  3. Main work. Statements to be executed during each iteration of the loop.
  4. Update. The value of the loop control variable should be changed inside the body of the loop. The pattern of changes must be such that the loop eventually terminates.
  5. Finalization (optional). Add any final statements to properly wrap things up.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Show an operator precedence table, including relational and logical operators.

A
()
**
* / // %
\+ - 
<   >=   >   <=    !=   ==
not
and 
or
How well did you know this?
1
Not at all
2
3
4
5
Perfectly