Grade VIII • Computer Science

Python Loops Worksheet

Loops • Iterative Statements • The 'for' Loop • The 'while' Loop • Infinite Loop • Using 'else' in Loops

Maximum Marks: 20

Student Information

Name:
Class & Section:
Roll No.:
Date:

General Instructions

  1. Read each question carefully before answering.
  2. Attempt all questions.
  3. Write Python keywords and syntax correctly.
  4. Maintain proper indentation in Python programs.
  5. Use suitable examples wherever required.
  6. The worksheet carries a total of 20 marks.

Topics Covered

  • Loops
  • Iterative Statements
  • The for Loop
  • The while Loop
  • Infinite Loop
  • Using else in Loops

Section A – Objective Type Questions 5 Marks

1. Multiple Choice Questions

Questions 1–2: 1 × 2 = 2 Marks

1. Which loop is generally used when the number of iterations is known or when we want to iterate over a sequence?

  • ☐ a) if
  • ☐ b) for
  • ☐ c) else
  • ☐ d) print()

2. Which keyword is used to immediately terminate a loop?

  • ☐ a) stop
  • ☐ b) exit
  • ☐ c) break
  • ☐ d) terminate

2. Fill in the Blanks

Questions 3–4: 1 × 2 = 2 Marks

3. A statement that repeatedly executes a block of code is called an statement.

4. A loop that continues executing because its terminating condition never becomes false is called an loop.

3. True / False

Questions 5a–5b: 0.5 × 2 = 1 Mark

5a. The while loop continues executing as long as its condition remains true.

Answer: ☐ True     ☐ False

5b. An infinite loop always stops automatically after one iteration.

Answer: ☐ True     ☐ False

Section A Total: 5 Marks

Section B – Short Answer Type Questions 6 Marks

Questions 6–8: 2 × 3 = 6 Marks

6. What are loops or iterative statements? Why are they used in Python programs?

7. Differentiate between the for loop and while loop in Python.

8. What is an infinite loop? State one possible cause of an infinite loop in a while loop.

Section B Total: 6 Marks

Section C – Long Answer Type Questions 9 Marks

Questions 9–11: 3 × 3 = 9 Marks

9. Explain the working of the for loop in Python. Write a program using a for loop to display the numbers from 1 to 10.

10. Explain the working of the while loop. Write a Python program using a while loop to display the first five natural numbers.

11. Explain how the else clause can be used with a Python loop. Also explain what happens when a loop is terminated using break.

Section C Total: 9 Marks

Python Syntax Reminder

for Loop

for i in range(1, 6): print(i)

while Loop

i = 1 while i <= 5: print(i) i += 1

else with a Loop

for i in range(3): print(i) else: print("Loop completed")

Concept Reminders

Concept Purpose
Loop Repeats a block of statements.
Iterative Statement Allows a program to execute statements repeatedly.
for Loop Iterates over a sequence or a range of values.
while Loop Repeats a block while a condition is true.
Infinite Loop A loop that does not reach its terminating condition.
break Terminates the loop immediately.
else in a Loop Executes when the loop finishes normally without being terminated by break.

Assessment Blueprint

Section Question Type Question Numbers Marks per Question Total Marks
A MCQ 1–2 1 × 2 2
A Fill in the Blanks 3–4 1 × 2 2
A True / False 5a–5b 0.5 × 2 1
B Short Answer 6–8 2 × 3 6
C Long Answer 9–11 3 × 3 9
Grand Total 20

Self-Check

Before submitting your worksheet:

  • Have you attempted all 11 questions?
  • Can you explain why loops are useful?
  • Can you distinguish between for and while loops?
  • Have you checked the condition in your while loop?
  • Can you identify a possible infinite loop?
  • Do you understand when the else clause of a loop executes?
  • Have you maintained proper Python indentation?