S11 - 55 iteration Flashcards

1
Q

how many iterative statements are there?

A

There are 3 iterative statements

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

what are the 3 iterative statements?

A

WHILE, REPEAT and FOR are all iterative statements

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

what is iteration?

A

The process of repeating steps

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

when is a for loop used?

A

For loops are used when the required number of iterations is known ahead of execution

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

How does a for loops work?

A

the for loop would repeat a line of code at a set amount of times.

The programmer can choose how many times iteration can occur.

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

when is a while loop used?

A

while loops are used when the number of iterations are not known.

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

why can a while loop not be used if the required iterations are not known?

A

Because the variable used to determine when the iteration ends is changing within the iteration itself

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

why are loops used?

A

to ensure the code keeps running only if the condition is met.

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

branching is another word for selection

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

what is nesting?

A

more than one loop is involved in a single decision.

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

what are the properties of a while - endwhile loop?

A

+ the expression controlling the repetition of the loop must be boolean (true or false)

+ this expression is tested at the start of the loop

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

what will happen if the boolean value is false in a while - endwhile loop

A

Since the boolean expression s false at the start the loop will not be executed, control will be passed onto the next statement after endwhile

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

how many types of loops are there?

A

there are 4 types of loops

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

name the types of loops

A

+ While…endwhile
+ repeat…until
+ for…next
+ nested loops

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

what are the properties of a repeat…until loop?

A

+ The boolean expression controlling the loop is written and tested at the end of the loop.

^^^ this means that the loop is always performed at least once

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

when is the for…next loop used?

A

the for…next loop is used to find out how many iterations need to be performed

16
Q

what is a nested loop?

A

when 2 loops are nested one inside another

17
Q

what are the 2 properties of a while…endwhile loop?

A

+ The expression is tested at the start of the loop

+ the expression controlling the repetition of the loop must be of type boolean (true or false)

18
Q

whats the difference between a repeat…until loop and a while…endwhile loop?

A

the boolean expression is tested at the end of the loop instead of the start