Python Loops Quiz (for loop and while loop)
Quiz
•
Computers
•
10th Grade
•
Practice Problem
•
Hard
Tempa Rinchen
Used 3+ times
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 a while loop in Python?
To iterate over a sequence of items
To define a function
To execute a set of statements as long as a condition is true
To create a list
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will happen if you forget to increment the variable in a while loop?
The loop will continue forever
The loop will execute twice
The loop will execute only once
The program will crash
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the break statement do in a loop?
It pauses the loop
It skips the current iteration
It stops the loop immediately
It restarts the loop
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the continue statement in a loop?
To skip the current iteration and continue with the next
To stop the loop completely
To exit the loop if a condition is met
To restart the loop from the beginning
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is NOT a type of loop in Python?
while loop
for loop
nested loop
do-while loop
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you define a for loop in Python?
for each item in sequence:
for item = sequence:
for (item in sequence):
for item in sequence:
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following code print? fruits = ['apple', 'banana', 'cherry']; for x in fruits: print(x)
apple banana cherry
banana cherry apple
cherry banana apple
apple, banana, cherry
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
Gathering Evidence
Quiz
•
9th - 12th Grade
11 questions
Social Engineering
Quiz
•
10th Grade
10 questions
Spring MVC
Quiz
•
10th Grade
10 questions
LO1.3 Select appropriate tools and materials to...
Quiz
•
10th Grade
10 questions
JSPS Competition Hackathon - Scratch Language - Grade 1
Quiz
•
2nd Grade - University
10 questions
1.3 The Internet
Quiz
•
10th Grade
10 questions
IGCSE Computer Science - Input Devices
Quiz
•
9th - 11th Grade
10 questions
QBASIC Programming
Quiz
•
5th - 10th Grade
Popular Resources on Wayground
8 questions
2 Step Word Problems
Quiz
•
KG - University
20 questions
Comparing Fractions
Quiz
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Latin Bases claus(clois,clos, clud, clus) and ped
Quiz
•
6th - 8th Grade
22 questions
fractions
Quiz
•
3rd Grade
7 questions
The Story of Books
Quiz
•
6th - 8th Grade
