ICT Grade 7 Worksheet Chapter 3
ICT Grade 7 Worksheet Chapter 3
ICT Grade 7 Worksheet Chapter 3
a) An 'Event' block
b) A variable block
c) An operator block
d) A say block
6. In the algorithm for adding two numbers, what are the key inputs?
a) Number 1 and Result
b) Number 2 and Operator
c) Number 1 and Number 2
d) Result and Input
7. An algorithm sets out the inputs and outputs of a program. What else does it set out?
a) The programming language
b) The hardware requirements
c) The processes to transform inputs into outputs
d) The cost of development
a) result
b) answer
c) number 1
d) number 2
2
10. Scratch provides two ready-made Variables are
8. ____________________ is used to remind you what value the variable will store.
3
Question 4: Answer the Following:
1. Explain the purpose of an event block from scratch.
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
4. Explain the concept of a variable in programming.
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
4
6. How can you use the 'ask' block to get user input in Scratch?
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
5
LESSON -3.2
Question 1: Choose the correct answer from the options given:
a) +
b) -
c) =
d) *
5. What does the following Python command do? name = input("What is your name? ")
a) It assigns "What is your name?" to the variable name.
b) It prints the question and stores the user's input in the variable name.
c) It prints the variable name.
d) It creates a variable with a default value of "What is your name?".
6
6. What is Python?
a) A type of computer hardware
b) A text-based programming language
c) A graphical user interface
d) A web browser
8. Which of the following is a correct way to assign the value "Hello, world!" to a variable
named greeting?
a) greeting = "Hello, world!"
b) "Hello, world!" = greeting
c) set greeting to "Hello, world!"
d) print("Hello, world!")
7
11. What should you do if you receive an error message in Python?
a) Ignore it and continue
b) Read it to understand the mistake and correct it
c) Restart the Python Shell
1. The text inside the brackets of the Input function is called the_____________
8
Question 4: Answer the Following:
1. How do you get user input in Python?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
2. What should you do if you make a mistake when typing a Python command?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
9
7. Write the Python command to create a variable called city with the value "Paris".
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
8. Write the Python command to ask the user "How old are you?", get their input, and
store it as the variable age.
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
9. Write a Python program that asks the user for their name and age. Then, print a
message that greets the user and tells them their age in 5 years
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
__________________________________________________________________________
10
LESSON -3.3
Question 1: Choose the correct answer from the options given:
1. What is the advantage of making a program file instead of typing commands in the
Python Shell?
2. Which menu do you use to create a new file in the Python Shell?
a) Edit
b) File
c) Run
3. What do different colors in the Python program file window help you identify?
4. What error message would you see if you forget to put quote marks around a text
string?
b) A text editor
c) A web browser
11
6. What does the error message "NameError: name 'variable' is not defined" mean?
8. Which menu option do you use in the Python Shell to create a new file?
9. What happens when you click on ‘Run Module’ in the Python IDE?
10. In the Python program file window, what color are text strings displayed?
a) Black
b) Purple
c) Green
12
11. Which of the following is the correct way to print "hello" in Python?
a) Print(hello)
b) print(hello)
c) print("hello")
A) Syntax highlighting
Question 2: State whether the following statements are true (T) or false (F):
1.In the Python program file window, variable names are displayed in green
2. Text strings in Python are shown in purple in the program file window
3. Errors in Python can prevent a program from running.
4. A program file in Python can be edited and saved multiple times.
5.The 'Print' command in Python should start with a capital letter.
EOL while
print Web page IDE File NameError scanning
string literal.
1. The software used to write and run programs in Python is called an ____________.
4. The __________ menu in the Python Shell is used to create and save new program files.
5. When you forget to put quote marks, the error message says__________
6. When you forget to close a string with a second set of quote marks, the error message
says __________.
13
Question 4: Answer the Following:
1. What should you do to fix the error in the command 'Print(hello)'?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
2. What is the advantage of making a program file instead of typing commands in the
Python Shell?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
3. What are the different colors used in the Python program file window, and what do they
represent?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
14
5. Explain two different ways you can find errors in your Python programs.
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
___________________________________________________________________________
____________________________________________________________________________
___________________________________________________________________________
____________________________________________________________________________
___________________________________________________________________________
6. Describe one difference between the IDE for Scratch and the IDE for Python.
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
___________________________________________________________________________
____________________________________________________________________________
___________________________________________________________________________
____________________________________________________________________________
___________________________________________________________________________
15
LESSON -3.4
Question 1: Choose the correct answer from the options given:
1. What is a data type in Python?
a) a way to organize your code
b) a category that defines how data is stored and used
c) a special keyword used in functions
6. Why did a python program output "8090" instead of the sum of 80 and 90?
a) forgot to add a print statement.
b) Input values are stored as strings by default in Python.
c) Python does not support addition of numbers entered as input.
16
7. Which Python function converts a string to an integer?
a) str()
b) int()
c) input()
8 .What will the following code output? print("Python" * 3)
a) "PythonPythonPython"
b) "Python 3"
c) "Python"
12. If you enter the command total = number1 + number2 in Python, what does it do?
b) It creates a variable called total and assigns it the sum of number1 and number2.
a) 170
b) 8090
c) Error
a) variable = str(variable)
b) variable = float(variable)
c) variable = int(variable)
a) String
b) Integer
c) Float
a) 1variable = 10
b) variable1 = 10
c) variable 1 = 10
18
Question 2: State whether the following statements are true or false:
1. A variable that stores a decimal number is typically of the ___________ data type.
19
Question 4: Answer the Following:
1. What are the different data types in Python?
________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
3. What are the steps to create a Python program that adds two numbers together?
_________________________________________________________________________________
___________________________________________________________________________________
___________________________________________________________________________________
_________________________________________________________________________________
4. Write a command to convert the points variable to any numerical data type (integer or float).
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
5. Write the Python command to assign value 9.99 to a variable called price.
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
20
6. Write a Python expression to calculate the area of a rectangle with width 5 and height 3.
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
_________________________________________________________________________________
________________________________________________________________________________
21