WINTERNATIONAL SCHOOLS NATIONAL SCHOOLS
☒ AHIS – Khobar ☐ AHNS-Boys – Dammam
☐ OIS – Khobar ☐ AHNS-Girls – Dammam
☐ JIS – Jubail ☐ AHNS-Boys – Jubail
☐ AHIS – Riyadh ☐ AHNS-Girls – Jubail
☐ AHIGS – Aqrabia ☐ AHNS – Riyadh
☐ AHIS – Yanbu ☐ Ajyal – AHNS
Name:…………………………………… Grade: 7 Section:
ICT Worksheet Chapter 4 (2024-2025)
LESSON - (4.1)
Question 1: Choose the correct answer from the options given:
1. What is the purpose of a conditional structure in programming?
a) To perform a logical test
b) To create a loop
c) To define a variable
d) To store data
2. In Python, what keyword is used to start a conditional structure?
a) if
b) for
c) while
d) def
3. What happens if the logical test in an 'if' structure is False?
a) Commands inside the 'if' block are executed
b) Commands inside the 'if' block are skipped
c) The program terminates
d) The user is prompted again
4. What does the 'else' keyword do in a conditional structure?
a) It defines a variable
b) It provides an alternative action if the 'if' test is False
c) It ends the program
d) It creates a loop
1
5. What is a logical test in programming?
a) A comparison between two values.
b) A mathematical operation.
c) A string of characters.
d) A loop control statement.
6. Which of the following is a relational operator?
a) +
b) –
c) *
d) >
7. In Scratch, which block is used to create a conditional structure?
a) The green "if" block.
b) The orange "repeat" block.
c) The purple "forever" block.
d) The blue "ask" block.
8. What is a conditional structure also known as?
a) Loop structure
b) If structure
c) Sequential structure
d) None of the above
9. Which block starts with the logical test in Scratch?
a) Repeat block
b) Forever block
c) If block
d) Event block
2
10. In Python, which operator is used for the 'equal to' logical test?
a) =
b) = =
c) !=
d) <=
11. When using 'if...else' structures in Python, what must you put at the end of the
logical test?
a) semicolon (;)
b) colon (:)
c) comma (,)
d) period (.)
12. What is the purpose of relational operators in a conditional structure?
a) To loop through a set of commands
b) To compare two values and determine True or False
c) To assign values to variables
d) To output values
13. In Scratch, what happens if the user does not enter 'Y' when prompted in the
conditional structure?
a) The program will still add the numbers.
b) The program will subtract the numbers.
c) The computer will not carry out any commands inside the 'if' block.
d) The program will stop.
14. In Python, which operator is used for the 'not equal to' logical test?
a) =
b) ==
c) !=
d) <=
3
15. What does the following Python code do if the user enters 'Y'?
if answer == "Y":
result = number1 + number2
print(result)
a) It prints the result of subtracting number2 from number1.
b) It prints the result of adding number1 and number2.
c) It prints "Y".
d) It does nothing.
Question 2: State whether the following statements are true or false:
1. A conditional structure in programming is also called an 'if' structure. True
2. The result of a logical test can only be True. False
3. The commands inside the 'if' structure are executed only if the logical test is True. True
4. Indented commands in Python are only carried out if the logical test is True. True
5. A logical test can only result in "True" or "False". True
6. In Scratch, the "if" block can only have one condition. False
7. Indentation is important in Python to define code blocks. True
8. The else block is optional in a conditional structure. True
9. An if statement can only have one condition. False
10. Python uses blocks to define conditional structures. False
Question 3: Fill in the blanks with the correct words.
Conditional Logical test if Relational Operator key word
1. The structure begins with the word ‘if’ and then has a logical test.
2. The word if is a python conditional structure.
3. If is a conditional structure.
4. Logica test uses relational operators to compare the two values.
5. The word if is a Python key word.
4
Question 4: Answer the Following:
1. What is a conditional structure in programming, and how is it used in Scratch?
A conditional structure in programming allows the program to make decisions based on
specific conditions. If the condition evaluates to true, certain commands are executed;
otherwise, they are skipped.
In Scratch, conditional structures are implemented using blocks like the if and if...else
blocks. These blocks evaluate logical tests and execute the corresponding code blocks
based on the result.
2. What are relational operators, and how are they represented in Scratch?
▪ Relational operators are symbols used to compare values. In Scratch, they are
represented by green blocks with specific symbols:
▪ Equal to: =
▪ Not equal to: ≠
▪ Greater than: >
▪ Less than: <
▪ Greater than or equal to: ≥
▪ Less than or equal to: ≤
3. Describe the difference between the 'if' and 'if... else' structures in programming.
How are they implemented in Scratch?
▪ The if structure executes a block of code only if the condition is true.
▪ The if-else structure, on the other hand, provides an alternative action if the if
condition is false.
▪ In Scratch, you can add an "else" block to an "if" block to create an if-else
structure.
4. Write a Python conditional structure that checks if a number is greater than 10 and
prints a message if it is.
number = 15
if number > 10:
print ("The number is greater than 10.")
5
5. What is the purpose of the else block in a conditional structure?
The else block is executed when the if condition is false.
It provides a way to perform actions when the condition is not met.
6. How can you combine multiple conditions in a single if statement?
Multiple conditions can be combined using logical operators like and, or, and not.
7. What is the importance of indentation in Python?
Indentation in Python is essential for defining the structure and hierarchy of code blocks.
It indicates which statements belong to a particular control structure, such as an if or a
loop, ensuring proper execution and readability.
************************************
6
LESSON – (4.2)
Question 1: Choose the correct answer from the options given:
1. What is a counter loop also known as?
a) Fixed loop
b) Conditional loop
c) Forever loop
d) Infinite loop
2. In Python, what is the command to create a loop that repeats 10 times?
a) for i in range (10)
b) while i < 10
c) repeat 10 times
d) loop 10 times
3. What does the exit condition of a loop determine?
a) How many times the loop runs
b) When the loop will stop
c) What commands are inside the loop
d) The type of loop being used
4. In Scratch, what does the 'forever' loop do?
a) Repeats commands until the program stops
b) Repeats commands a fixed number of times
c) Runs commands only once
d) Does not execute any commands
5. What is a loop in programming?
a) A way to execute a block of code repeatedly.
b) A variable that stores a value.
c) A function that performs a specific task.
d) A conditional statement.
7
6. In Python, what keyword is used to create a counter loop?
a) while
b) if
c) for
d) loop
7. In Scratch, which block would you use for a counter loop that repeats 10 times?
a) Forever block
b) Repeat block
c) If block
d) Start block
8. Which of the following represents incrementing a variable in Python?
a) total = total + 1
b) total - total + 1
c) total = 1 + total
d) Both a and c
9. What is the purpose of an "exit condition" in a loop?
a) To start the loop
b) To stop the loop
c) To count the iterations
d) To initialize variables
10. What does the Python command int(number) do?
a) Initializes the variable number
b) Converts number to an integer
c) Outputs the value of number
d) Checks if number is an integer
8
Question 2: State whether the following statements are true or false:
1. A counter loop in programming repeats a set number of times and then stops. True
2. In Scratch, the 'forever' loop will repeat until the program stops. True
3. Python uses 'forever' loops as a standard looping structure... False
4. In Python, the commands inside a loop must be indented. True
5. A counter loop in Python always runs indefinitely. False
6. In Python, the variable used as a counter in a for loop must always be named False
i.
7. An exit condition is a logical test that determines when a loop stops. True
8. A loop counter can be used to control the number of iterations in a loop. True
9. The int() function converts a string to an integer in Python. True
10. In Python, all commands inside a loop must be indented. True
Question 3: Fill in the blanks with the correct words.
Conditional loop Fixed loop Loop Intended Repeat total=total+1
1. A Fixed loop repeats a set number of times and then stops.
2. Conditional loop is controlled by a logical test.
3. In Python, a counter loop is called a for Loop.
4. In Python, the command to increase the value of a variable called total by 1 is
total=total+1.
5. In Scratch, the Repeat block is used to repeat a set of commands a fixed number of
times.
6. The commands inside a Python loop must be indented to show they belong to the loop.
9
Question 4: Answer the Following:
1. What is a counter loop and how does it function in programming?
▪ A counter loop is a type of loop that repeats a set number of times.
▪ It is controlled by a counter variable that tracks how many times the loop has
executed.
▪ The loop runs for a fixed number of iterations, and after that, the program proceeds
to the next block of code.
▪ In programming languages like Python, a counter loop is typically created using a
for loop, where the number of iterations is defined by a range or sequence.
2. Explain the difference between a counter loop and a conditional loop.
Counter Loop:
• Repeats a fixed number of times.
• Controlled by a counter variable.
• Often used when you know the exact number of iterations in advance.
Conditional Loop:
• Repeats until a certain condition is met.
• Controlled by a logical expression.
• Often used when you don't know the exact number of iterations beforehand.
3. What is the purpose of the 'int()' function in Python when dealing with user input?
▪ The int() function in Python is used to convert a string (text) into an integer (whole
number). When you take input from the user, it is initially stored as a string.
▪ To perform mathematical operations, you need to convert it to an integer using the int()
function.
4. Write a Python program using a counter loop that adds 5 numbers entered by the user
and prints the total.
total = 0
for i in range(5):
number = int(input("Enter a number: "))
total += number
print("The total is:", total)
************************************
10
LESSON - (4.3)
Question 1: Choose the correct answer from the options given:
1. What is a conditional loop controlled by?
a) A fixed number of times
b) A logical test
c) User input
d) Random values
2. When does the loop in scratch stop repeating?
a) The test is False
b) The test is True
c) The user enters '0'
d) The program stops
3. In Python, what is the equivalent of a conditional loop?
a. For loop
b. Counter loop
c. While loop
d. Fixed loop
4. What happens if the condition in a conditional loop is FALSE?
a) The loop will stop
b) The loop will continue
c) The program will crash
d) The loop will restart
5. what keyword is used to start a conditional loop in Python?
a) for
b) while
c) if
d) else
11
6. What is a common mistake when writing a conditional loop in Python?
a) Not initializing the loop counter.
b) Using the wrong logical operator.
c) Not indenting the commands inside the loop.
d) All of the above.
7. What does the != operator mean in Python?
a) Equal to
b) Not equal to
c) Greater than
d) Less than
8. How can you prevent an infinite loop in a conditional loop?
a) Always use a fixed number of iterations.
b) Ensure the loop condition can eventually become false.
c) Ensure the loop condition can eventually become true.
d) Both a and c.
9. What is the key difference between a counter loop and a conditional loop?
a) Counter loops repeat indefinitely, conditional loops do not.
b) Conditional loops repeat a fixed number of times.
c) Counter loops repeat a set number of times, conditional loops rely on a logical
test.
d) Counter loops are faster than conditional loops.
10. In Scratch, what block is used to create a conditional loop?
a) Forever block
b) Repeat block
c) Repeat until block
d) If block
12
Question 2: State whether the following statements are true or false:
1. A conditional loop is controlled by a fixed number of repetitions. False
2. In Scratch, the loop will repeat until the logical test is True. False
3. In Python, the loop stops when the logical test is False. True
4. The logical test in a Scratch conditional loop must always use the = operator. False
5. A Python while loop requires a colon (:) at the end of the logical test. True
6. Indentation is not important in Python conditional loops. False
Question 3: Fill in the blank with the correct words.
Conditional loop Counter False while logical
1. In Python, The loop will repeat until the test is False.
2. In Python a Conditional Loop is called a while loop.
3. If you know exactly how many times you want to repeat the commands, use a Counter
loop.
4. In Python, the command to start a conditional loop is while.
5. A Python while loop checks the logical condition before each iteration
13
Question 4: Answer the Following:
1. Describe how a conditional loop is implemented in Scratch.
In Scratch, a conditional loop is implemented using the "repeat until" block. The loop
continues to execute until the specified condition becomes true. The condition is placed
inside the diamond-shaped slot of the block.
2. What mistake in this initial Python program, and how we can fix it?
✓ the initial mistake was not initializing the number variable before the loop.
✓ This led to a NameError because the variable was not defined.
✓ He fixed this by moving the initialization of number before the loop.
✓ Additionally, he forgot to update the number variable inside the loop, leading to
an infinite loop.
✓ He fixed this by adding the input and conversion steps inside the loop.
14
3. In your own words, explain when it is appropriate to use a conditional loop in
programming.
A conditional loop is appropriate when the number of iterations is not fixed and depends
on a condition being met. For example, it is useful when processing user input until they
enter a specific value or when repeating actions based on a logical test, like waiting for a
game score to reach a target.
4. What are the three key steps to make a Python program with a conditional loop?
✓ Start the loop with a logical test: Define the condition that will control the loop.
✓ Assign a starting value to the test variable: Initialize the variable used in the logical test
before the loop starts.
✓ Give the user a chance to change the test variable inside the loop: Update the variable
within the loop to ensure the condition can eventually become false and the loop
terminates.
5. Describe two common mistakes programmers make when using conditional loops
and how to avoid them.
✓ Infinite loops: This occurs when the loop condition never becomes false. To avoid this,
ensure that the condition will eventually change within the loop.
✓ Incorrect logical conditions: Using incorrect relational operators or logical expressions
can lead to unexpected behavior. Double-check the conditions to ensure they accurately
represent the desired behavior.
15
6. Write a Python program where a variable total is set to 100, and the user subtracts
numbers from it until they enter a value greater than 99.
total = 100
number = 0
while number <= 99:
number = int(input("Enter a number: "))
total = total - number
print("The final total is:", total)
7. Write a short Python program that asks the user for a number and continues to ask
for numbers until the user enters a negative value. The program should then print
the sum of all the entered numbers.
total = 0
number = 0
while number >= 0:
number = int(input("Enter a number: "))
total += number
print("The sum of the entered numbers is:", total)
************************************
16