M6 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 builtin iteration functionality

A

Repetition control structures, or loops

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

A

pre-test loop or entrancecontrolled 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

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

The for statement

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

condition is tested first (pre-test loop)

A

for and while statements

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

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

A

while statement

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

Sentinel variable tested in condition; loop ends when

A

sentinel encountered

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

executes a statement or
statements then repeats the execution as long as a given
conditional expression evaluates to true.

A

do..while statement

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

Statements in the loop are executed first at least once,

and condition is tested last (post-test loop)

A

do..while statement

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

is used inside loops

A

continue statement

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

It is used to come out of the loop instantly.

A

break statement

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

the
control directly comes out of loop and the loop gets
terminated when encountered

A

break statement

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

It is used with if statement, whenever

used inside loop.

A

break statement

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

It allows making an absolute jump to another point in the

program.

A

goto statement

17
Q

You should use this feature carefully since its

execution ignores any type of nesting limitation.

A

goto statement

18
Q

The destination point is identified by a X, which is

then used as an argument for the goto instruction.

A

label

19
Q

A label is made of a valid identifier followed by a

A

colon

(:). i.e. Here:

20
Q

number of loops when

relational operator is <=,>=

A

no. of loops = |TV – IV| + 1

21
Q

number of loops when

relational operator is

A

no. of loops = |TV – IV|

22
Q

A loop becomes infinite loop if a

A

condition never

becomes false.

23
Q

The

number of loops depend on the complexity of a problem.

A

nested loop