
2.2.2 - 2.2.3 Iteration Extra Practice
Authored by Brandon Milam
Information Technology (IT)
10th Grade
Used 9+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
28 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main condition for a `while` loop to keep running?
As long as a list is not empty
As long as the condition is True
Until the function ends
As long as a variable is undefined
Answer explanation
A `while` loop continues to execute as long as its condition evaluates to True. This means that the loop will keep running until the condition becomes False, making 'As long as the condition is True' the correct choice.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What kind of loop runs indefinitely if the condition never becomes false?
Controlled loop
Break loop
Infinite loop
Timed loop
Answer explanation
An infinite loop occurs when the loop's condition never evaluates to false, causing it to run endlessly. This is in contrast to controlled, break, or timed loops, which have defined exit conditions.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will this code print? counter = 0 while counter < 3: print(counter) counter += 1
0 1 2
1 2 3
0 1 2 3
1 2
Answer explanation
The code initializes a counter at 0 and prints it while it is less than 3. It increments the counter after each print. Thus, it prints 0, 1, and 2 before the loop ends, making '0 1 2' the correct answer.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which operator is typically used to check a condition in a `while` loop?
+
==
=
%
Answer explanation
The '==' operator is used to compare values for equality in a condition. In a 'while' loop, it checks if the specified condition is true, allowing the loop to continue executing.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does a `for` loop iterate over?
Only strings
Only numbers
A sequence
A condition
Answer explanation
A `for` loop iterates over a sequence, which can include lists, strings, or other iterable objects. This allows it to process each element in the sequence, making 'A sequence' the correct choice.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which keyword is used to start a `for` loop in Python?
iterate
loop
for
range
Answer explanation
The keyword used to start a `for` loop in Python is 'for'. This keyword allows you to iterate over a sequence (like a list or a range) and execute a block of code for each item in that sequence.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct structure for a `for` loop?
for i = range(5)
for i in range(5):
loop i in range(5):
for (i in range 5)
Answer explanation
The correct structure for a `for` loop in Python is 'for i in range(5):'. This syntax correctly uses 'in' to iterate over the range and includes a colon at the end, which is required to define the loop block.
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
27 questions
AKK Kelas X
Quiz
•
10th Grade
30 questions
Teknologi Informatika 7A
Quiz
•
7th Grade - University
23 questions
Ôn Tập Buổi 6 IOT
Quiz
•
9th - 12th Grade
25 questions
ICT Skills Quiz
Quiz
•
10th Grade
26 questions
AAA Framework Quiz
Quiz
•
9th - 12th Grade
29 questions
Trắc Nghiệm Câu Lệnh if & for
Quiz
•
10th Grade
30 questions
AP Computer Science Principles Pre-Test
Quiz
•
10th Grade
25 questions
Code HS Computer SCi 114.1.1 JavaScript Final Exam Pt. 1
Quiz
•
9th - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
10 questions
Probability Practice
Quiz
•
4th Grade
15 questions
Probability on Number LIne
Quiz
•
4th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
6 questions
Appropriate Chromebook Usage
Lesson
•
7th Grade
10 questions
Greek Bases tele and phon
Quiz
•
6th - 8th Grade
Discover more resources for Information Technology (IT)
15 questions
Making Inferences
Quiz
•
7th - 12th Grade
23 questions
TSI Math Vocabulary
Quiz
•
10th - 12th Grade
20 questions
-AR -ER -IR present tense
Quiz
•
10th - 12th Grade
10 questions
Cell Organelles and Their Functions
Interactive video
•
6th - 10th Grade
10 questions
Plotting Points on a Coordinate Plane: Quadrant 1 Essentials
Interactive video
•
6th - 10th Grade
10 questions
Exploring Abiotic and Biotic Factors in Ecosystems
Interactive video
•
6th - 10th Grade
20 questions
SSS/SAS
Quiz
•
9th - 12th Grade
20 questions
Figurative Language Review
Quiz
•
10th Grade