For Loops!
While Loops!
What's the error??
100

The first statement inside the parenthesis of the for loop. (ie. for(    ;    ;   ))

What is the initial value for the loop variable?

100

The statement inside of the parenthesis of a while loop. (ie. while( ___ ))

What is the loop condition?

100

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);

200

The second statement inside the parenthesis of the for loop. (ie. for(    ;    ;   ))

What is the loop condition?

200

The location of the loop variable initialization:

1

while( 2 ){

     3

}

4

What is: 1?

200

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++;

300

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?)

300

What happens if you don't have a way to stop a while loop

It will become an infinite loop

300

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);

}___

400

What is a way to increment the integer 'num' by 1


num++, num += 1, or num = num +1

400

The location of the loop variable action (increment/decrement).

1

while( 2 ){

    3

}

4

What is: 3?

400

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;

}

500
What does 'num--' do to the integer 'num'

Decrements the integer by 1

500

The output of:

int j = 3;

while ( j <= 11)

{

    System.out.print(j + “ ”);

    j+=2;

}

What is: "3 5 7 9 11"?

500

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++;

}

600

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"?

600

The output of:

int n=0, count=0;            

while(n<8) {                       

   count += n;        

   n+=2;               

}                  

System.out.print( count );

What is: 12?

600

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);

700

The output for:

int sum = 0;

for(int i = 0; i< 12; i+=2){

    sum += i;

}

System.out.print(sum);

What is: 30?

700

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

700

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++;

}

M
e
n
u