Variables and Logic Gates in Programming
Computer Science
Year 9
11 questions
~22 mins
0 views0 downloads
About This Worksheet
This worksheet explores the use of variables in programming and the basics of logic gates. Complete the tasks to strengthen your understanding.
Worksheet Preview
Full preview • 11 questions
Variables and Logic Gates in Programming
Subject: Computer ScienceGrade: Year 9
Name:
Date:
TeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizz
Untitled Worksheet
Grade Year 9
A
Questions
This worksheet explores the use of variables in programming and the basics of logic gates. Complete the tasks to strengthen your understanding.
Answer all questions in the spaces provided.
1.
Define what a variable is in programming and give an example of how it might be used in a simple program.
[4 marks]2.
Write a short pseudocode snippet that assigns the value 10 to a variable named 'counter' and then increases it by 1.
[3 marks]3.
Explain the difference between a variable's name and its value.
[3 marks]4.
Describe a scenario in a game where you might use a variable.
[3 marks]5.
Complete the truth table for the AND logic gate with inputs A and B, and output C. Fill in the output column for all combinations of A and B where 0 represents false and 1 represents true.
[4 marks]| A | B | Output |
|---|---|---|
| 0 | 0 | |
| 0 | 1 | |
| 1 | 0 | |
| 1 | 1 |
6.
Complete the truth table for the OR logic gate with inputs A and B, and output C. Fill in the output for all combinations.
[4 marks]| A | B | Output |
|---|---|---|
| 0 | 0 | |
| 0 | 1 | |
| 1 | 0 | |
| 1 | 1 |
7.
Draw a logic circuit diagram that uses two AND gates and one OR gate to produce a specific output. Label each gate and show how the inputs are connected.
[2 marks]Drawing / Sketch space
8.
Sketch a simple flowchart that uses variables to decide if a person is eligible to vote. The decision is based on whether their age is 18 or above.
[2 marks]Drawing / Sketch space
9.
Explain why variables are important in programming when creating a calculator that adds two numbers.
[3 marks]10.
Describe what the output would be if the following pseudocode is run:
Set x to 5
Set y to 10
Set total to x + y
[3 marks]11.
Write a pseudocode statement that checks if a variable 'score' is greater than 50 and prints 'Pass' if true, or 'Fail' if false.
[4 marks]Quick Actions
What is Remix?
Create a new worksheet based on this one. Change the grade level, topic, number of questions, or difficulty - then generate a fresh version.
- • Change grade level (Grade 6 → Grade 7)
- • Swap topics (Harry Potter → Macbeth)
- • Add more questions (10 → 15)
- • Adjust difficulty
Details
- Created
- 1/2/2026
- Updated
- 1/2/2026
- Type
- worksheet