LOOPS Flashcards

1
Q

What does include a for loop ?

A

Includes an iterator variable that usually appears in all three expressions. The iterator variable is initialized, checked against the stopping condition, and assigned a new value on each loop iteration. Iterator variables can have any name, but it’s best practice to use a descriptive variable name.

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

What is an initialization in a FOR loop?

A

One of the three expressions of an iterator variable :
> that’s starts the loop and can also be used to declare the iterator variable.

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

What is a stopping condition in a FOR loop?

A

One of the three expressions of an iterator variable :
> is the condition that the iterator variable is evaluated against— if the condition evaluates to true the code block will run, and if it evaluates to false the code will stop.

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

What is an iteration statement in a FOR loop?

A

One of the three expressions of an iterator variable :
> used to update the iterator variable on each loop.

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

What does the iteration statement is counter++ means?

A

This means after each loop, the value of counter will increase by 1.

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

What do we call a loop running inside another loop?

A

We call that a nested loop

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

What is the difference between the while loop and the do… while?

A

Unlike the while loop, do…while will run at least once whether or not the condition evaluates to true.

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