Ch. 5.2: Introduction to Loops: The while Loop Flashcards

1
Q

What is a loop?

A

A loop is a control structure that causes a statement or group of statements to repeat.

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

What is a loop header?

A

It consists of the key word while followed by an expression enclosed in parentheses.

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

What is the body of the loop?

A

Is the conditionally executed statement, because it is executed only under the condition that the expression is true.

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

What is a while loop?

A

The while loop works like an if statement that executes over and over. As long as the expression inside the parenthesis is true, the conditionally executed statement or block will repeat.

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

What is an iteration?

A

Each repetition of a loop.

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

What is the loop control variable?

A

The variable that controls the number of times the loop iterates.

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

What is a pretest loop?

A

This means it tests its expression before each iteration.

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

What is an infinite loop?

A

An infinite loop continues to repeat until the program is interrupted.

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