
Python For Loops Quiz
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Medium
Haden Hiser
Used 5+ times
FREE Resource
Enhance your content in a minute
8 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of a for loop in Python?
To define a function
To create a class
To iterate over a sequence
To handle exceptions
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is NOT a valid iterable in a for loop?
Integer
Dictionary
Tuple
List
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? fruits = ["apple", "banana", "cherry"] for x in fruits: if x == "banana": break print(x)
banana
apple cherry
apple
apple banana
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the range() function do in a for loop?
Returns a sequence of numbers
Returns a list of strings
Returns a dictionary
Returns a set of tuples
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? for x in range(2, 6): print(x)
3 4 5 6
0 1 2 3 4 5
2 3 4 5 6
2 3 4 5
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the continue statement in a for loop?
To skip the current iteration and continue with the next
To stop the loop
To exit the loop
To repeat the current iteration
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? for x in range(6): if x == 3: break print(x) else: print("Finally finished!")
0 1 2
0 1 2 3
0 1 2 3 Finally finished!
0 1 2 Finally finished!
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
11 questions
2223_S4_ICT_1stExam_MCQ_Ex1
Quiz
•
9th - 12th Grade
10 questions
Star & Mesh Networks
Quiz
•
9th - 12th Grade
10 questions
Google Apps
Quiz
•
4th - 12th Grade
10 questions
Office 365
Quiz
•
12th Grade
13 questions
INTERNET CONNECTION
Quiz
•
12th Grade
10 questions
Impresa e siti web
Quiz
•
8th - 12th Grade
10 questions
12 CA One Mark 1-3
Quiz
•
12th Grade
10 questions
Documentos Comerciales
Quiz
•
1st - 12th 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
