Chapter 4 Loops Flashcards

1
Q

Each time a loop is executed is called an ___.

A

iteration

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

While loop syntax

A

syntax:

//initialization
while (//condition>) {
//statements
//update
}
ex:
int j=0;
while (j <= 5){
System.out.println(j);
j++;
}

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

Return a random int between 0 & 9

A

(int)(Math.random() * 10)

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

Sentinel value definition

A

a specific input value to signify the end of the loop.

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

What type of value do you avoid using in loops for equality checking

A

Floating point values

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