Python Loops Quiz (for loop and while loop)

Quiz
•
Computers
•
10th Grade
•
Hard
Tempa Rinchen
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of a while loop in Python?
To iterate over a sequence of items
To define a function
To execute a set of statements as long as a condition is true
To create a list
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will happen if you forget to increment the variable in a while loop?
The loop will continue forever
The loop will execute twice
The loop will execute only once
The program will crash
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the break statement do in a loop?
It pauses the loop
It skips the current iteration
It stops the loop immediately
It restarts the loop
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the continue statement in a loop?
To skip the current iteration and continue with the next
To stop the loop completely
To exit the loop if a condition is met
To restart the loop from the beginning
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is NOT a type of loop in Python?
while loop
for loop
nested loop
do-while loop
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you define a for loop in Python?
for each item in sequence:
for item = sequence:
for (item in sequence):
for item in sequence:
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following code print? fruits = ['apple', 'banana', 'cherry']; for x in fruits: print(x)
apple banana cherry
banana cherry apple
cherry banana apple
apple, banana, cherry
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Module 09 - For Loops

Quiz
•
10th Grade
15 questions
Python CodeHS Standards: Number Guessing Game

Quiz
•
10th Grade
10 questions
ICT Grade 10 Final Exam Practice Test

Quiz
•
9th - 12th Grade
15 questions
Gateway Level 3 Python Quiz 3

Quiz
•
9th - 12th Grade
15 questions
Iteration

Quiz
•
9th - 12th Grade
10 questions
Python Basic files

Quiz
•
10th - 12th Grade
9 questions
9класс python

Quiz
•
9th - 10th Grade
10 questions
LO13_Lesson 5

Quiz
•
10th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
Proper Keyboarding Techniques

Interactive video
•
6th - 10th Grade
10 questions
Understanding Computers: Hardware, Software, and Operating Systems

Interactive video
•
7th - 12th Grade
29 questions
AP CSP Unit 2 Review (Code.org)

Quiz
•
10th - 12th Grade