Loops Flashcards

1
Q

What are the two types of loops

A

Counter-controlled repetition

Sentinel-controlled repetition

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

Counter-controlled repetition

A

Repetition exits after running a certain number of times

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

What does a counter-controlled repetition consist of

A

Control variable that acts as a counter
Control variable needs to be initialised before running the loop
Control variable should be modified each time through loop
The loop-continuation-condition determines if looping should continue.

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

Sentinel-controlled repetition

A

Loop that runs based on a sentinel/signal value which decides when to exit the loop.

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