4. Loops Flashcards

(6 cards)

1
Q

Loop

A
  • Program construct that repeatedly executes the loop’s statements (known as the loop body)
  • while the loop’s expression is true; when false, execution proceeds past the loop.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Iteration

A

Each time through a loop’s statements is called an iteration.

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

While Loop

A
  • Executes while the loop repeatedly executes the loop body while the loop’s expression evaluates to true
  • Exits loop when condition is false
  • When the number of iterations is not known
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

For Loop

A
  • Consisting of a loop variable initialization, a loop expression, and a loop variable update that typically describes iterating for a specific number of times.
  • When the number of iterations is known
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Nested Loop

A
  • A loop that appears in the body of another loop.
  • Referred to as the inner loop and outer loop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Do-while loop

A
  • First executes the loop body’s statements, then checks the loop condition.
  • When the loop should iterate at least once
How well did you know this?
1
Not at all
2
3
4
5
Perfectly