-
Hajipur, Bihar, 844101
Hajipur, Bihar, 844101
Difficulty Level: medium
Q1: What is a for loop used for in Python? (1 points)
Q2: What is the output of this code? (1 points)
for i in range(3):
print("Hello")
Q3: Which of the following is a valid Python for loop syntax? (1 points)
Q4: What does the range(5) function return? (1 points)
Q5: What will be printed? (1 points)
for i in range(2, 6):
print(i)
Q6: How many times will this loop run? (1 points)
for i in range(1, 10, 2):
print(i)
Q7: What will this code print? (1 points)
for letter in "PYTHON":
print(letter)
Q8: Which statement stops a loop prematurely? (1 points)
Q9: Which keyword skips the current iteration and continues to the next? (1 points)
Q10: What is the output of this code? (1 points)
for i in range(3):
for j in range(2):
print(i, j)
Q11: What will this code print? (1 points)
for i in range(5):
if i == 3:
break
print(i)
else:
print("Completed")
Q12: What will this code output? (1 points)
for i in range(5):
if i == 2:
continue
print(i)
else:
print("Done")
Q13: What is the result of this loop? (1 points)
sum = 0
for i in range(1, 6):
sum += i
print(sum)
Q14: What happens if the sequence inside a for loop is empty? (1 points)
for item in []:
print(item)
else:
print("No items")
Q15: What will this code print? (1 points)
for i in range(1, 4):
for j in range(1, 3):
print(i * j, end=" ")
Welcome to the Python For Loop Quiz.
This quiz is designed to test your understanding of Python’s for loop, iteration flow and common looping patterns. Please read the instructions before you begin.
Quiz Format
Total Questions: 15
Difficulty Level: Medium
Question Type: Multiple Choice
Each question has one correct answer.
Timing
You will get a total of 10 minutes to complete the quiz.
Manage your time well and move through each question steadily.
Scoring
Each correct answer = +1 point
No negative marking
Maximum Score = 15 points
How to Play
Read each question carefully.
Understand how the for loop runs, iterates and processes sequences.
Select the option you think is correct.
Once you go to the next question, you cannot return to the previous one.
Rules
Do not refresh or close the quiz page while attempting the test.
Avoid using external help or online searches.
Keep an eye on the timer to stay within the limit.
Before You Start
Learn Python for loop Tutorial here: Free Python For Loop Tutorial
After Submission
Your score will be shown instantly.
You can review the correct answers to learn and improve.
