Worksheet 1: Interactive Statements in Python
Student Name: ____________
Class: ____________
Date: ____________
A. Fill in the blanks:
1. In Python, the if statement is used for ____________.
2. The elif statement is used when there are ____________ conditions to check.
3. The while loop executes a block of code ____________ the condition remains true.
4. The for loop is used to iterate over ____________, such as lists and strings.
5. The break statement is used to ____________ a loop.
B. True or False:
1. The if statement in Python can work without an else statement. (True/False)
2. The while loop always executes at least once. (True/False)
3. The for loop is primarily used for fixed iterations. (True/False)
4. The continue statement immediately exits a loop. (True/False)
5. Python uses indentation to define blocks of code. (True/False)
C. Match the following:
Column A Column B
1. if statement a) Terminates the loop completely
2. else statement b) Executes code repeatedly while the condition is true
3. while loop c) Used when all if and elif conditions fail
4. break statement d) Executes a block only when a condition is true
5. for loop e) Iterates over a sequence like a list or string
D. Short Answer Questions:
1. What is an interactive statement in Python?
2. Write the syntax of an if-elif-else statement in Python.
3. What is the difference between a for loop and a while loop?
4. What does the break statement do in a loop?
5. Give an example of a Python program using an if statement.
E. Application-Based Questions:
1. Write a Python program to check if a number is even or odd.
2. Write a Python program using a while loop to print numbers from 1 to 5.
3. What will be the output of the following code?
4. for i in range(3):
5. print("Hello")
Answer Key - Worksheet 1
A. Fill in the blanks:
1. Decision making
2. Multiple
3. As long as
4. Sequences
5. Exit
B. True or False:
1. True
2. False
3. True
4. False
5. True
C. Match the following:
1 - d) Executes a block only when a condition is true
2 - c) Used when all if and elif conditions fail
3 - b) Executes code repeatedly while the condition is true
4 - a) Terminates the loop completely
5 - e) Iterates over a sequence like a list or string
D. Short Answer Questions:
1. An interactive statement allows the user to control the flow of a program using conditions
and loops.
2. if condition:
statement
elif condition:
statement
else:
statement
3. A for loop is used for fixed iterations, while a while loop continues execution as long as
a condition remains true.
4. The break statement exits a loop immediately.
5. num = 10
if num > 0:
print("Positive number")
E. Application-Based Questions:
1. num = int(input("Enter a number: "))
if num % 2 == 0:
print("Even number")
else:
print("Odd number")
2.
i = 1
while i <= 5:
print(i)
i += 1
3. Output:
Hello
Hello
Hello
Worksheet 2: Interactive Statements in Python
Student Name: ____________
Class: ____________
Date: ____________
A. Multiple Choice Questions (MCQs):
1. Which statement is used for decision-making in Python?
o a) for
o b) if
o c) while
o d) break
2. Which loop is best suited for iterating over a list?
o a) while
o b) for
o c) if
o d) elif
3. What will be the output of the following code?
x = 10
if x > 5:
print("Greater than 5")
else:
print("Less than or equal to 5")
o a) No output
o b) Greater than 5
o c) Less than or equal to 5
o d) Error
4. What does the continue statement do in a loop?
o a) Exits the loop
o b) Skips the current iteration and continues with the next one
o c) Repeats the loop from the beginning
o d) Stops execution of the program
5. Which statement is used to execute a block of code when all if and elif conditions
fail?
o a) break
o b) continue
o c) else
o d) while
B. Fill in the blanks:
1. The ____________ statement is used when a condition needs to be checked before
executing a block of code.
2. The ____________ loop is useful when the number of iterations is unknown.
3. The continue statement is used to ____________ the current iteration of a loop and
move to the next one.
4. The else statement in a loop executes only if the loop completes ____________.
5. The for loop is used to iterate over ____________ types such as lists, tuples, and strings.
C. Application-Based Questions:
1. Write a Python program to check if a number is positive, negative, or zero.
2. Write a Python program using a for loop to print numbers from 1 to 5.
3. What will be the output of the following code?
i = 1
while i <= 3:
if i == 2:
break
print(i)
i += 1
Answer Key - Worksheet 2
A. Multiple Choice Questions (MCQs):
1. b) if
2. b) for
3. b) Greater than 5
4. b) Skips the current iteration and continues with the next one
5. c) else
B. Fill in the blanks:
1. if
2. while
3. skip
4. successfully
5. sequence
C. Application-Based Questions:
1. num = int(input("Enter a number: "))
if num > 0:
print("Positive")
elif num < 0:
print("Negative")
else:
print("Zero")
2.
for i in range(1, 6):
print(i)
3. Output: