PF Python Loops
Interactive Video
•
Information Technology (IT)
•
9th - 12th Grade
•
Hard
Amy Austin
FREE Resource
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A Python `while` loop is initialized with `value = 1` and the condition `while value < 10:`. Inside the loop, `value` is printed, and then incremented by 1. What numbers will be printed?
1, 2, 3, 4, 5, 6, 7, 8, 9
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
0, 1, 2, 3, 4, 5, 6, 7, 8
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A `while` loop is set up to print numbers starting from 1, incrementing by 1, as long as the value is less than or equal to 10. If a `break` statement is added inside the loop, triggered when the value equals 5, what will be the final output?
1, 2, 3, 4
1, 2, 3, 4, 5
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
An infinite loop
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In a `while` loop, if a `continue` statement is encountered when a specific condition is met, what is the immediate effect on the loop's execution?
The loop terminates completely.
The program exits.
The current iteration is skipped, and the loop proceeds to the next iteration.
The loop restarts from the beginning with the initial condition.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider a Python list `names = ["Dave", "Sara", "John"]`. If a `for` loop iterates through this list using `for x in names: print(x)`, what will be the output?
"Dave", "Sara", "John" printed on a single line.
"Dave", "Sara", "John" each printed on a new line.
Only "Dave" will be printed.
An error will occur because `x` is not defined.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider a Python for loop iterating through names = ["Dave", "Sara", "John"]. If the current name is "Sara", the loop executes a break statement. A print(x) statement is placed after the if condition. What will be the output?
Dave
Dave, Sara
Dave, Sara, John
Dave, John
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider a Python for loop iterating through names = ["Dave", "Sara", "John"]. If the current name is "Sara", the loop executes a continue statement. A print(x) statement is placed after the if condition. What will be the output?
Dave
Dave, Sara
Dave, Sara, John
Dave, John
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What numbers will be printed by the Python code for x in range(2, 5): print(x)?
0, 1, 2, 3, 4
2, 3, 4
2, 3, 4, 5
0, 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?
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Information Technology (IT)
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
10 questions
Understanding Meiosis
Interactive video
•
6th - 10th Grade
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
15 questions
Christmas Song Emoji Pictionary
Quiz
•
7th - 12th Grade
20 questions
Christmas Movies
Quiz
•
1st - 12th Grade
10 questions
Exploring Christmas Traditions Through Cartoons
Interactive video
•
6th - 10th Grade
55 questions
CHS Holiday Trivia
Quiz
•
12th Grade
20 questions
Christmas Movie Trivia
Quiz
•
9th - 12th Grade