Program Control Structures: Repetition Control Structures Flashcards

1
Q

are used when a program needs to repeatedly process one or more instructions until some condition is met, at which time the loop ends.

A

Repetition structures, or loops,

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

The process of performing the same task over and over again is called iteration, and C++ provides built

A

Iteration

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

C++ provides three different forms of repetition statements:

A

While Structure
For Structure
Do-While Structure

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

If the test occurs at the beginning of the loop, the type of loop is called

A

pre test loop or entrance
controlled loop.

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

If the test occurs at the end of the loop, the type of loop is called

A

post test loop or exit controlled loop.

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

is used for repeating a statement
or series of statements as long as a given conditional expression evaluates to true

A

for statement

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

what is an example of pre-test loop

A

for and while statement

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

what is an example of a post-test loop

A

do-while statement

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

The condition may be any expression, and true is any non-zero value.

A

True

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

In do-while, statements in the loop are executed first at least once

A

True

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

A __________ statement causes execution to skip to the next iteration of the loop

A

continue statement

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

When a continue statement is encountered inside a loop, control jumps to the beginning of the loop for next iteration, skipping the execution of statements inside the body of loop for the current iteration.

A

True

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

In for loop, initialization happens first and only once

A

True

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

When the condition is tested and the result is false, the loop body will be skipped and the first statement after the while loop will be executed.

A

True

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

When does the code block following while(x<100) execute?

A

When x is less than 100

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

Each pass through a loop is called a/an ______

A

iteration

17
Q

Values that are used to end loops are referred to as _____ values.

A

Sentinel Values

18
Q

The destination point is identified by a label, which is then used as an argument for the goto instruction.

A

True