
for loop quiz

Quiz
•
Computers
•
University
•
Medium
thanga_palani_ thanga_palani_
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does a for loop do?
Repeats a block of code
Skips a line
Runs code once
Stops the program
Answer explanation
For loop repeats code for each item or number
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output?
for i in range(3):
print(i)
1 2 3
0 1 2
0 1 2 3
1 2
Answer explanation
range(3) goes from 0 to 2
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
for i in range(1, 4) will print:
1 2 3
0 1 2
1 2 3 4
2 3 4
Answer explanation
Starts at 1, stops before 4
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which is the correct for loop syntax?
for i in range(5):
for i = 5
for i -> 5
for in range(5)
Answer explanation
Python uses for variable in range():
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does range(2, 10, 2) do?
2 to 10
2, 4, 6, 8
2, 4, 6, 8, 10
1, 2, 3, 4
Answer explanation
Step of 2 means it skips numbers
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output?
for ch in "hi":
print(ch)
hi
h i
i h
Error
Answer explanation
Loops over each character
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What data type works with a for loop?
Only numbers
Strings, lists, ranges
Only strings
Only booleans
Answer explanation
Can loop over anything that’s a sequence
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Python-Grundlagen (IF Kl. 10)

Quiz
•
10th Grade - University
10 questions
basic programming quiz

Quiz
•
University
7 questions
Python Round 4

Quiz
•
University
15 questions
Java Quiz based on array

Quiz
•
University
12 questions
Python Quiz

Quiz
•
University
10 questions
QUIZ 2

Quiz
•
University
13 questions
Python Break and Continue

Quiz
•
University
10 questions
Unit 2 Python

Quiz
•
University
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
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University