Loop provides a compact way to iterate over a specific range of values.
What is a for loop?
100
WHITE BOARD: The shortcut operator(s) that makes this code more concise.
count = count + 1;
What is count++;
100
The value of count at the end of the code segment.
int count = 0, int x=0;
while(x!=10){
x++;
count++;
}
What is 10?
100
int count = 1;
while (count < 11)
System.out.println("Count is: " + count);
count++;
What is missing brackets?
200
Controls a loop.
What is a condition or Boolean value?
200
This loop continually executes a block of statements as long as particular condition is true. Typically used when you do not know how many times the loop will run.
What is a while loop?
200
WHITE BOARD: The shortcut operator(s) that makes this code more concise.
count = count + 2;
What is count+=2;
200
The value of count at the end of the code segment.
int count=0;
for(int x=1; x<=20; x++;){
count = x;
}
What is 21?
200
for(i=10; i>=1; i--) {
System.out.print(i+" ");
}
What is missing declaration?
300
The keyword that can be used to stop a loop from running.
What is break?
300
A loop that will run the body of the loop before the condition is tested.
What is a do/do-while loop?
300
WHITE BOARD: The shortcut operator(s) that makes this code more concise.
count = (count/100)*10;
What is count/=10;
300
The value of count at the end of the code segment.
int count=0;
for(int x=1; x<20; x+=2;){
count++;
}
What is 10?
300
int count = 1;
do {
System.out.println("Count is: " + count);
count++;
} while (count < 11)
What is missing a semicolon?
400
A loop that runs indefinitely.
What is an infinite loop?
400
This loop is typically used when reading input from a file.
What is a while loop?
400
WHITE BOARD: The shortcut operator(s) that makes this code more concise.
count = count * (count+1);
What is count *= count++;
400
The value of count at the end of the code segment.
int count;
for(int x=0; x<20; x++;){
for(int y=1; y<=5; y++;){
count++;
}