
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
DBI LO
Quiz
•
7th - 12th Grade
16 questions
Bài tập Tin 9-Tiết 25
Quiz
•
9th Grade
10 questions
Email Quiz - PWHS
Quiz
•
1st - 12th Grade
11 questions
Програмне забезпечення та операційна система
Quiz
•
9th Grade
10 questions
Cutting - Edge Technology
Quiz
•
7th - 10th Grade
12 questions
HTML & Java
Quiz
•
9th Grade
20 questions
BÀI KTTX SỐ 2
Quiz
•
9th Grade
10 questions
Image Representation Lesson 2
Quiz
•
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
