Variables and Logic Gates in Programming

Computer Science
Year 9
11 questions
~22 mins
0 views0 downloads

About This Worksheet

This worksheet focuses on understanding variables and basic logic gates in programming. Complete the tasks to demonstrate your knowledge.

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 focuses on understanding variables and basic logic gates in programming. Complete the tasks to demonstrate your knowledge.

Answer all questions in the spaces provided.
1.
Define a variable in programming and give an example of how it might be used in a program.
[4 marks]
2.
Write a simple line of code in a programming language of your choice that creates a variable called 'score' and assigns it the value 100.
[3 marks]
3.
Explain the difference between an integer variable and a string variable with examples.
[4 marks]
4.
Describe what a Boolean variable is and provide an example of its use in a program.
[4 marks]
5.
Complete the truth table for the AND logic gate with inputs A and B (columns for A, B, and Output).
[6 marks]
ABOutput
00
01
10
11
6.
Complete the truth table for the OR logic gate with inputs A and B.
[6 marks]
ABOutput
00
01
10
11
7.
Draw a logic circuit that represents an AND gate with two inputs, A and B.
[8 marks]
Drawing / Sketch space
8.
Sketch a simple flowchart that uses a variable 'isRaining' to decide whether to take an umbrella. Use 'Yes' and 'No' branches.
[8 marks]
Drawing / Sketch space
9.
Write a short pseudocode snippet that checks if a variable 'score' is greater than 50 and prints 'Pass' if true.
[5 marks]
10.
Identify and explain the purpose of the 'else' part in an if-else statement.
[4 marks]
11.
Create a variable in your preferred programming language called 'isStudent' and set it to true. Write a conditional statement that prints 'Welcome student!' if 'isStudent' is true.
[6 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