
Quiz on WHILE Loop in Programming
Quiz
•
Other
•
10th Grade
•
Practice Problem
•
Hard
Nguyễn Trang
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the `while` statement in programming?
Execute a block of code only once
Repeat a block of code a specified number of times
Repeat a block of code while the condition is true
Terminate the program
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the syntax of the `while` loop in Python?
while (condition) { statements }
while: condition { statements }
while condition:
while = condition:
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When does the `while` loop terminate?
When memory runs out
When the condition is false
When the user inputs 0
When the program crashes
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following code do? x = 1; while x < 5: print(x); x += 1
Prints numbers from 0 to 5
Prints numbers from 1 to 4
Prints numbers from 1 to 5
Infinite loop
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Why is it necessary to increment the variable `x` in the `while` loop?
To slow down the program
To avoid infinite looping
To print a character
To check syntax
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If the initial condition is `False` when using `while`, then:
The loop will not execute at all
The loop will still execute once
A syntax error occurs
The computer freezes
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Choose the correct code to calculate the sum from 1 to 5:
sum = 0; i = 1; while i < 6: sum += i; i += 1
sum = 0; i = 1; while i <= 5: i += 1; sum += i
sum = 0; i = 1; while i <= 5: sum += i
sum = 0; i = 1; while i <= 5: sum += i; i += 1
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
8 questions
Meme Quiz
Quiz
•
1st Grade - Professio...
11 questions
Hero Gayab Mode On
Quiz
•
6th - 12th Grade
12 questions
Mattei - Introduzione al diritto - Prima parte
Quiz
•
8th - 10th Grade
10 questions
sözcük türleri
Quiz
•
9th - 12th Grade
10 questions
Driving Theory Test: Alertness
Quiz
•
KG - Professional Dev...
15 questions
will be doing/will have done
Quiz
•
8th - 12th Grade
11 questions
Ecuador
Quiz
•
KG - 12th Grade
10 questions
My childhood
Quiz
•
7th - 10th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Other
20 questions
-AR -ER -IR present tense
Quiz
•
10th - 12th Grade
10 questions
Understanding Meiosis
Interactive video
•
6th - 10th Grade
15 questions
Main Idea and Supporting Details.
Quiz
•
4th - 11th Grade
20 questions
Cell Organelles
Quiz
•
10th Grade
25 questions
Complementary and Supplementary Angles
Quiz
•
7th - 10th Grade
12 questions
Add and Subtract Polynomials
Quiz
•
9th - 12th Grade
13 questions
Model Exponential Growth and Decay Scenarios
Quiz
•
9th - 12th Grade
10 questions
Exploring the Layers of the Earth
Interactive video
•
6th - 10th Grade
