0% found this document useful (0 votes)
268 views

ICT Grade 7 Worksheet Chapter 3 -Answer Key

Uploaded by

Hasan Hfny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
268 views

ICT Grade 7 Worksheet Chapter 3 -Answer Key

Uploaded by

Hasan Hfny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

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 3 -Answer Key


LESSON -3.1

Question 1: Choose the correct answer from the options given:


1. What is the purpose of the 'Event' block in a Scratch program?

a) To start the program


b) To store user inputs
c) To display outputs
d) To create variables

2. What is the first block in a Scratch program?

a) An 'Event' block
b) A variable block
c) An operator block
d) A say block

3. What is an interface in programming?

a) A way for users to interact with the program


b) A type of variable
c) A programming language
d) A method to store values

4. What are the four arithmetic operators commonly used in programming?


a) Add, Subtract, Multiply, Divide
b) Add, Subtract, Combine, Separate
c) Add, Multiply, Divide, Modulo
d) Multiply, Divide, Concatenate, Add
1
5. What block should be used in Scratch to start a program?
a) "Control" block
b) "When green flag clicked" block
c) "When this sprite clicked" block
d) "Operator" 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

8. In Scratch, what variable can store the user's input?

a) result
b) answer
c) number 1
d) number 2

9. Which block in Scratch is used to get user input?

a) when this sprite clicked


b) ask
c) say
d) answer

2
10. Scratch provides two ready-made Variables are

a) result and answer


b) answer and my variable
c) score and result
d) my variable and score

Question 2: State whether the following statements are true or false:

1. The Scratch programming language allows users to create colorful interfaces. True
2. An algorithm is a plan to solve a problem. True
3. Variables in Scratch cannot store values. False
4. The program starts when the user clicks on Green Flag in Scratch. True
5. The 'my variable' in Scratch is an event block. False

Question 3: Fill in the blank with the correct words.

Algorithm Arithmetic operators Interface Program Requirement


Stage Variable Sprite Variable Name

1. Arithmetic Operators are symbols and terms used in programming and used to perform
mathematical calculations.

2. Algorithm is a plan to solve a problem.

3. Interface is how a user interacts with the program.

4. Stage is the background area where sprites move and interact.

5. Variable is used to store a value that can change.

6. Sprite is the character or object in your scratch project.

7. Program Requirement tells you what the program must do.

8. Variable Name 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.

Event blocks are used to start actions or sequences in a Scratch program.


They detect and respond to specific events, such as clicking the green flag or a sprite.
Event blocks enable interaction between the user and the program.

2. What are the methods to enter input to programs?


1. Using keyboard inputs (e.g., typing text or numbers).
2. Using mouse clicks or movements.
3. Through touch input on touchscreens.

3. What are the methods to get output in a program?


1. Screen display, including words and colors
2. Sounds, including spoken words and sound effect
3. Movements of objects

4. Explain the concept of a variable in programming.


A variable is a named storage location in a computer's memory that can hold a value.
This value can change during the execution of a program.
Variables are used to store data temporarily, such as numbers, text, or other information.

5. What is the role of a sprite in a Scratch program?


A sprite is a character or object in a Scratch project. It can be a person, an animal, a thing, or a
shape. Sprites can move around the stage, change costumes, say things, and play sounds.
Sprites execute scripts attached to them, making the program dynamic.

6. How can you use the 'ask' block to get user input in Scratch?
The 'ask' block is used to display a question to the user.
It pauses the program and waits for the user to type an answer.
The user's response is stored in the "answer" variable.
This response can be used in subsequent parts of the program.

7. What is the difference between an algorithm and a program?


An algorithm is a step-by-step procedure for solving a problem. It's a logical sequence of
instructions. A program is the implementation of an algorithm in a specific programming
language. It's the code that a computer can understand and execute.

8. Write an algorithm to subtract two given numbers.


Step 1: Start.
Step 2: Input the first number (Number1).
Step 3: Input the second number (Number2).
Step 4: Subtract Number2 from Number1 and store the result in a variable (Result).
Step 5: Output the Result.
Step 6: End.
4
LESSON -3.2
Question 1: Choose the correct answer from the options given:

1. What does the prompt in the function “input “do?

a) It stores the user input.


b) It tells the user what to input.
c) It displays the output.
d) It creates a variable.

2. What symbol is used to assign a value to a variable in Python?

a) +
b) -
c) =
d) *

3. Which Python command is used to get user input?


a) print()
b) input()
c) ask()
d) scan()

4. How do you display output in Python?


a) display()
b) output()
c) print()
d) show()

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?".
5
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

7. What is the Python Shell?


a) A physical device used to run Python programs
b) A window where you can enter and execute Python commands
c) A type of programming error
d) A graphical programming environment

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!")

9. What is the purpose of the input() function in Python?


a) To display text on the screen
b) To perform mathematical calculations
c) To get input from the user
d) To create a new variable

10. Which of the following is a common error in Python programming?


a) Using uppercase letters for variable names
b) Forgetting to indent code blocks
c) Using quotation marks to enclose numbers
d) All of the above

6
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

Question 2:State whether the following statements are true or false:

1. In Python, a variable name can contain spaces. False


2. Error messages in Python help identify mistakes in your code. True
3. The print function in Python is used to get user input. False
4. In Python, a variable name should always start with a letter. True
5. Python is case-sensitive, meaning Print and print are treated as different True
commands.

Question 3: Fill in the blank with the correct words.

prompt Python Python Shell input() print

1. The text inside the brackets of the Input function is called the prompt

2. When you start Python, a window opens, this is called Python Shell

3. Python is a text-based programming language.

4. input() is a Python command is used to get user input.

5. print is used to produce output in python.

7
Question 4: Answer the Following:
1. How do you get user input in Python?
You use the input() function to get user input.
For example, name = input("Enter your name: ") prompts the user to enter their name and
stores it in the variable name.
The text inside the parentheses of input() is the prompt shown to the user.

2. What should you do if you make a mistake when typing a Python command?
Read the error message provided by Python to identify the issue.
Correct the mistake and retype the command.
Re-run your program: Test the corrected code to ensure it works as expected.

3. How do you set a variable's value in Python?


You assign a value to a variable using the assignment operator =.
For example, age = 25 assigns the value 25 to the variable age.

4. What is the purpose of the Python Shell?

The Python Shell is an interactive environment where you can execute Python code line by
line.
It allows you to quickly test small parts of code.
It provides immediate feedback, making it useful for debugging and learning Python

5. Explain how error messages help you to be a good programmer.

✓ Error messages identify mistakes in your code and provide information about what went
wrong.
✓ They often include the type of error and the line number where it occurred, helping you
pinpoint the issue.
✓ By learning from error messages, you improve your coding skills and avoid similar mistakes
in the future.

6. What are the basic rules for naming variables in Python?

• Start with a letter: Variable names must begin with a letter (uppercase or lowercase).
• Use only letters, numbers, and underscores: Avoid using special characters like $, %, or
@.
• Case-sensitive: myVariable and myvariable are different variables.
• No spaces: Use underscores to separate words in variable names (e.g., my_variable).
7. Write the Python command to create a variable called city with the value "Paris".

city = "Paris"

8
8. Write the Python command to ask the user "How old are you?", get their input, and
store it as the variable age.

age = input("How old are you? ")

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

name = input("What is your name? ")

age = int(input ("How old are you? "))

future_age = age + 5

print("Hello,", name)

print("In 5 years, you will be", future_age, "years old.")

9
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?

a) It saves typing effort and reduces the chance of errors.

b) It makes the program run faster.

c) It allows you to use more variables.

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?

a) Errors in the program

b) Different types of program content such as variables, symbols, and functions

c) The speed of the program

4. What error message would you see if you forget to put quote marks around a text
string?

a) NameError: name 'hello' is not defined

b) Syntax Error: invalid syntax

c) EOL while scanning string literal

5. What tool do you use to save Python commands as a program file?

a) The Python Shell

b) A text editor

c) A web browser

10
6. What does the error message "NameError: name 'variable' is not defined" mean?

a) You forgot to close the program file.


b) You used a reserved word as a variable name.
c) The variable doesn't exist in the program.

7. What is an IDE (Integrated Development Environment)?

a) A program that translates Python code to machine code.


b) A software environment for writing, editing, and running Python programs.
c) A library of pre-written Python code snippets.

8. Which menu option do you use in the Python Shell to create a new file?

a) Run → New File


b) File → Open
c) File → New File

9. What happens when you click on ‘Run Module’ in the Python IDE?

a) It saves the program file.


b) It highlights syntax errors in the program.
c) It executes all commands in the program file.

10. In the Python program file window, what color are text strings displayed?

a) Black

b) Purple

c) Green

11. Which of the following is the correct way to print "hello" in Python?

a) Print(hello)
b) print(hello)
c) print("hello")

11
12. Which of the following is NOT a feature of the Python IDE?

A) Syntax highlighting

B) Immediate command execution

C) Automatic error correction

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 F
2. Text strings in Python are shown in purple in the program file window F
3. Errors in Python can prevent a program from running. T
4. A program file in Python can be edited and saved multiple times. T
5.The 'Print' command in Python should start with a capital letter. F

Question 3: Fill in the blank with the correct words.

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 Integrated
Development Environment (IDE).

2. The command to display output in Python is print .

3. The IDE for Scratch is a Web page based programming environment.

4. The File 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 NameError.

6. When you forget to close a string with a second set of quote marks, the error message
says EOL while scanning string literal.

12
Question 4: Answer the Following:
1. What should you do to fix the error in the command 'Print(hello)'?

Change 'Print' to 'print' (since Python is case-sensitive).


Enclose "hello" in quotation marks to make it a string.
The corrected command would be:
print("hello")

2. What is the advantage of making a program file instead of typing commands in the
Python Shell?

it allows you to save and reuse your code. This saves time and effort, as you don't have to
retype the same commands each time you want to run the program. Additionally, it helps you
organize your code and makes it easier to debug and modify.

3. What are the different colors used in the Python program file window, and what do they
represent?

• Names of variables are shown in black.


• Symbols such as commas and brackets are shown in black.
• Input and print functions are shown in purple.
• Text strings are shown in green.

4. Describe the purpose of the Integrated Development Environment (IDE) in Python


programming.

• IDE lets you enter and save program commands.


• It displays error messages.
• It runs the program.
• It lets the user enter the input and it shows the output.

5. Explain two different ways you can find errors in your Python programs.

• the color of the commands you type, help you find errors in your commands. The color

of the text shows you that the words are typed incorrectly. For example, Print (hello)

The word print should be purple. The word 'hello" should be green.

13
• Python provides detailed error messages when a program runs into issues. These

messages usually include:

• Type of Error: This tells you what kind of error has occurred (e.g., Syntax Error,

NameError, etc.). Location: The message often indicates the line number and the

specific part of the code where the error occurred. Description: A brief explanation of

why the error happened, which helps in understanding what needs to be fixed.

6. Describe one difference between the IDE for Scratch and the IDE for Python.

One difference between the IDE for Scratch and the Python IDE is that Scratch uses a visual
block-based programming interface, while Python IDEs typically use a text-based interface. This
means that in Scratch, you drag and drop blocks to create your program, while in Python, you
write code using text and specific syntax.

14
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

2. What data type is used to store whole numbers (without decimals)?


a) String
b) Integer
c) Float

3. What happens when you try to add two strings in Python?


a) You get an error message.
b) The strings are added together character by character.
c) The strings are converted to numbers and then added.

4. What Python function can be used to convert a string to an integer?


a) convert()
b) int()
c) change Type()

5. What is the purpose of the print() function in Python?


a) To store data in a variable
b) To perform calculations
c) To display output on the screen

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.
15
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"

9. Which data type can be used in mathematical calculations in Python?


a) String
b) Integer and Float
c) Boolean

10. What does the command number = float(number) do?


a) Converts a number to a string.
b) Converts a number to an integer.
c) Converts a number to a float.

11. What does the command number1 = 80 do in the Python Shell?

a) It prints the number 80.

b) It creates a variable called number1 and assigns it the value 80.

c) It deletes a variable called number1.

12. If you enter the command total = number1 + number2 in Python, what does it do?

a) It prints the values of number1 and number2.

b) It creates a variable called total and assigns it the sum of number1 and number2.

c) It multiplies number1 and number2.


16
13. What will be the output if you run the command print(total) after setting number1 = 80
and number2 = 90 in Python without converting their types?

a) 170

b) 8090

c) Error

14. How can you convert a string variable to an integer in Python?

a) variable = str(variable)

b) variable = float(variable)

c) variable = int(variable)

15. data type is used to represent whole numbers in Python?

a) String

b) Integer

c) Float

16. Which of the following is a valid way to declare a variable in Python?

a) 1variable = 10

b) variable1 = 10

c) variable 1 = 10

17
Question 2: State whether the following statements are true or false:

1. The int() function can be used to convert a float to an integer. True


2. The + operator can be used for both addition and string concatenation in Python. True
3. You can perform arithmetic operations directly on string variables in Python False
without any conversion.
4. The print () function can convert a string representation of a number into a float. False
5. In Python, user input is always stored as a string. True
6. Variables in Python are created automatically when a value is assigned to them True
7. String data can include any characters from the keyboard. True
8. The input function in Python stores user data as a float by default. False
9. All Arithmetic operators can add two string variables in Python. False
10. ASCII characters are stored as string data type in Python. True

Question 3: Fill in the blank with the correct words.

Input() float + string integer

1. A variable that stores a decimal number is typically of the float data type.

2. In Python, the function used to get user input is called Input().

3. In a String, the ____+______sign joins the strings together.

4. ASCII characters are stored as string data type.

5. Whole numbers are stored as integer data type.

18
Question 4: Answer the Following:

1. What are the different data types in Python?

1. Integer: Used to represent whole numbers.


2. Float: Used to represent numbers with decimal points.
3. String: Used to represent sequences of characters.
4. Boolean: Used to represent True or False values.

2. How can you convert a string to an integer in Python?

Use the int() function. For example:

number_str = "10"
number_int = int(number_str)

3. What are the steps to create a Python program that adds two numbers together?

1. Get input: Use the input () function to get two numbers from the user and store them in variables.

2. Convert to integers: Convert the input strings to integer data types using the int() function.

3. Perform addition: Add the two integers and store the result in a new variable.

4. Print the result: Use the print () function to display the calculated sum.

4. Write a command to convert the points variable to any numerical data type (integer or float).

If points is a string that represents a number, use:

points = int(points)

points = float(points)

19
5. Write the Python command to assign value 9.99 to a variable called price.

price = 9.99

6. Write a Python expression to calculate the area of a rectangle with width 5 and height 3.

area = 5 * 3

7. What will this Python command do? print("-" * 35)

This command will print a line of 35 dashes (-----------------------------------).

8. Write a Python program that:


1. Asks the user to input a number.
2. Outputs a line of dashes equal to the number entered.

Number1 = int(input("Enter a number: "))

print("-" * Number1)

20

You might also like