
Python Loops Quiz
Quiz
•
Computers
•
9th Grade
•
Practice Problem
•
Hard
Alexandra Solomon
Used 1+ times
FREE Resource
Enhance your content in a minute
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code snippet? ```python for i in range(5): print(i) ```
0 1 2 3 4 5
0 1 2 3 4
1 2 3 4 5
Error
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is used to exit a loop prematurely?
pass
continue
break
exit
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the `continue` statement do in a loop?
Exits the loop
Skips the rest of the code inside the loop for the current iteration
Pauses the loop
None of the above
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many times does the following loop run? ```python for i in range(2, 10, 2): print(i) ```
3
4
5
6
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code snippet? ```python i = 5 while i > 0: i -= 1 if i == 2: break print(i) ```
4 3 2 1 0
4 3 2
4 3
5 4 3 2 1
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which loop is best when the number of iterations is known?
for loop
while loop
do-while loop
Infinite loop
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code snippet? ```python x = 0 while x < 4: x += 1 if x == 2: continue print(x) ```
1 2 3 4
1 3 4
2 3 4
1 2 3
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
20 questions
End of year quiz: Python
Quiz
•
9th Grade
20 questions
IPST_SE
Quiz
•
9th - 10th Grade
10 questions
Year 8 - Unit 2: Small Basic Programming Terminology
Quiz
•
9th Grade
10 questions
CyberCrime
Quiz
•
5th Grade - Professio...
18 questions
STEM Fundamentals
Quiz
•
9th - 12th Grade
15 questions
J808 LO1 and LO2 planning project keywords / terms
Quiz
•
9th - 11th Grade
10 questions
Year 8 - Progress Check 1 (Python Turtle Shapes)
Quiz
•
8th - 9th Grade
15 questions
Cyber Security Homework 1
Quiz
•
7th - 9th 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
