Java Tutorial #9 Quiz

Q1: Which of the following evaluates to true?

Q2: = is the symbol used in Java to see if two values are equal.

Q3: Counter variable, condition statement and what are the 3 main components of a for loop?

Q4: Java requires you to use i or x as your counter variable in for loops.

Q5: What does adding two plus symbols after a variable tell Java to do with that variable?

Q6: For loops run while the condition statement is true.

Q7: In a for loop, the incrementer variable is evaluated at the end of each run through the loop.

Q8: Given the following for loop, how many times would the loop run?
for(int i=1; i<3; i++){
System.out.print(i);
}

Q9: Given the following for loop, what would the output be?
for(int i=10; i<=20; i+=5){
System.out.print(i+" ");
}

Q10: Given the following for loop, how many times would the loop run?
for(int i=10; i<5; i++){
System.out.print(i);
}

Did you find our site helpful? Consider donating to help us provide more quality content.