While Loop
Quiz by Rowell Marquina
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
- Q1
Which of these statements is categorized as an initialization in a loop?
counter++;
counter--;
while(counter<5)
counter = 0;
60s - Q2
counter++ is equivalent to the formula counter = counter + 1.
truefalseTrue or False60s - Q3
Which of these conditions is capable of displaying "I love MITIS!" 5 times if the counter is initialize at zero (counter=0)?
while (counter>4)
while (counter<6)
while (counter<5)
while (counter>5)
60s - Q4
How many times will this loop run?
counter =15;
while (counter>0)
{
System.out.println("I love MITIS!");
counter++;
}
It will display "I love MITIS!" 16 times.
It will display "I love MITIS!" infinitely.
It will not display "I love MITIS!" even once.
It will display "I love MITIS!" 15 times.
120s - Q5
If the condition is set at while(counter<4) and the counter is an incremental one, counter++, what number do I have to assign for the initial value of the counter to ensure that it will only run 2 times?
counter = 1
counter = 4
counter = 2
counter = 0
120s - Q6
Which of these conditions will display "I love MITIS!" 5 times if the initial value of the counter=10 and the counter is set at counter--?
while (counter>=5)
while (counter<5)
while (counter<=5)
while (counter>5)
120s - Q7
A counter++ type of counter is needed to ensure that "I love MITIS!" will be displayed 5 times if the condition is set at while(counter>5) and the initial value for counter is counter = 10;
falsetrueTrue or False120s - Q8
Which of these statements is considered as the counter of the loop?
while(counter>5)
counter=0;
counter++;
120s - Q9
This loop will run infinitely:
int counter=10;
while (counter>5)
{
System.out.println("I love MITIS!");
counter++;
}
truefalseTrue or False120s - Q10
When will the statement "END OF LOOP" be displayed on the screen using this WHILE LOOP?
int counter=0;
while (counter>5)
{
System.out.println("I love MITIS!");
counter++;
}
System.out.println("END OF LOOP"); }
Immediately, the statement "END OF LOOP" will be the only one shown on the screen.
Never, because the loop will run infinitely.
After displaying "I love MITIS" 4 times,
After displaying "I love MITIS" 5 times,
120s