while and do while Loop

Quiz
•
Computers
•
10th Grade
•
Hard
Neeraj Kumar
Used 60+ 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
Hangman Game - Programming Questions

Quiz
•
7th - 11th Grade
12 questions
Loops

Quiz
•
9th - 12th Grade
8 questions
Roblox Lua Scripting Quiz

Quiz
•
1st - 12th Grade
10 questions
Pseudocode - Iteration

Quiz
•
7th - 11th Grade
10 questions
LOOPS IN C++

Quiz
•
10th Grade - University
16 questions
Python Beginner

Quiz
•
9th - 10th Grade
10 questions
Python Loops

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

Quiz
•
10th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
1.2 OSI & TCP IP Models Quiz

Quiz
•
10th Grade
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
20 questions
Hardware vs. Software Quiz

Quiz
•
7th - 10th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade
19 questions
AP CSP Unit 1 Review (code.org)

Quiz
•
10th - 12th Grade