The first statement inside the parenthesis of the for loop. (ie. for( ; ; ))
What is the initial value for the loop variable?
The statement inside of the parenthesis of a while loop. (ie. while( ___ ))
What is the loop condition?
The error(s) in the following code:
for(i = 0; i<20; i++);
System.out.println(i);
What is...
for(int i=0; i<20; i++) ;
System.out.println(i);
The second statement inside the parenthesis of the for loop. (ie. for( ; ; ))
What is the loop condition?
The location of the loop variable initialization:
1
while( 2 ){
3
}
4
What is: 1?
The error(s) in the following code:
While(i<100);
System.out.println(i);
What is...
int i=0;
while(i<100)_;_{
System.out.println(i);
i++;
}
The third statement inside the parenthesis of the for loop. (ie. for( ; ; ))
What is the action step? (or What is the increment/decrement to the loop variable?)
What happens if you don't have a way to stop a while loop
It will become an infinite loop
The error(s) in the following code:
for(int i=0; i<10; i++)
i+=3;
System.out.println(i);
What is...
for(int i=0; i<10; i++)
{
i+=3;
System.out.println(i);
}___
What is a way to increment the integer 'num' by 1
num++, num += 1, or num = num +1
The location of the loop variable action (increment/decrement).
1
while( 2 ){
3
}
4
What is: 3?
The error(s) in the following code:
int x = keyboard.nextInt();
while(5 < x < 20)
{
System.out.println(x)
x += 5;
}
What is...
int x = keyboard.nextInt();
while(5 < x && x < 20)
{
System.out.println(x);
x+=5;
}
Decrements the integer by 1
The output of:
int j = 3;
while ( j <= 11)
{
System.out.print(j + “ ”);
j+=2;
}
What is: "3 5 7 9 11"?
The error(s) in the following code:
int x = 0;
while(x < 100){
System.out.println(x);
}
What is...
int x= 0;
while(x<100){
System.out.println(x);
i++;
}
The output of:
for(int i=1;i<=10;i++)
{
System.out.print(i + " ");
}
What is: "1 2 3 4 5 6 7 8 9 10"?
The output of:
int n=0, count=0;
while(n<8) {
count += n;
n+=2;
}
System.out.print( count );
What is: 12?
The error(s) in the following code:
for(int i=3; i<0; i++)
System.out.println(i);
What is...
for(int i=3; i<0; i++)
System.out.println(i);
The output for:
int sum = 0;
for(int i = 0; i< 12; i+=2){
sum += i;
}
System.out.print(sum);
What is: 30?
Consider the following program segment.
int p = 2;
int q = 0;
while (q < 10) {
q += p;
p ++;
System.out.println(p + " " + q);
}
What is the last output when the program is executed?
5 9
The error(s) in the following code:
int i=-1;
while(i<0){
System.out.println(i);
i--;
}
What is...
int i=-1;
while(i<0){
System.out.println(i);
i++;
}