while and do while Loop

Quiz
•
Computers
•
10th Grade
•
Hard
Neeraj Kumar
Used 59+ times
FREE Resource
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In a While loop a code will be repeated until the condition becomes
FALSE
TRUE
User choice
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Print i as long as i is less than 6.
What will be the code?
i = 1
while i < 6:
print(i)
i += 1
i = 1
when i < 6;
print(i)
i += 1
i = 1
i < 6:
print(i)
i += 1
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which is the correct format of a do-while loop?
do-while(condition);
{
//code
}
do{
//code
}while(condition);
do-while(condition)
{
//code
}
do{
//code
}while(condition)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
14) What is the output of the below Java program?
int a=1;
while(a<4)
{
System.out.print(a + " ");
a++;
}
1 2 3 4
1 2 3
6
Compiler error
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the below Java program with a decrement operator and WHILE-loop?
int a=4;
while(a>0)
{
System.out.print(a + " ");
a--;
}
4 3 2 1
3 2 1
Compiler error
None
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main difference between a WHILE and a DO-WHILE loop in Java?
WHILE loop executes the statements inside of it at least once even if the condition is false.
DO-WHILE loop executes the statements inside of it at least once even if the condition is false.
WHILE loop is fast.
DO-WHILE loop is fast.
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
CP M4 Repetition & Loops

Quiz
•
9th - 12th Grade
14 questions
New year 10 Python Quiz

Quiz
•
10th Grade
11 questions
C Language

Quiz
•
10th Grade - University
16 questions
Python Beginner

Quiz
•
9th - 10th Grade
12 questions
Loops

Quiz
•
9th - 12th Grade
15 questions
Input Commands Quiz

Quiz
•
10th Grade
15 questions
JAVA: Level-1

Quiz
•
5th - 12th Grade
13 questions
KS4 Python While Loops and For Loops

Quiz
•
9th - 11th Grade
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade