Understanding Variables in Programming

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

About This Worksheet

This worksheet introduces the concept of variables in programming. You will learn how to identify, assign, and use variables in code.

Worksheet Preview

Full preview • 11 questions

Understanding Variables in Programming

Subject: Computer ScienceGrade: Year 9
Name:
Date:
TeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizzTeachWhizz

Untitled Worksheet

Grade Year 9
A

Questions

This worksheet introduces the concept of variables in programming. You will learn how to identify, assign, and use variables in code.

Answer all questions in the spaces provided.
1.
Explain what a variable is in programming and give an example of a variable name you might use for storing a student's score.
[4 marks]
2.
Write a line of code in a programming language of your choice to create a variable called 'total' and assign it the value 50.
[3 marks]
3.
Describe what happens when the following code runs: 'x = 10; x = x + 5'. What is the final value of x?
[4 marks]
4.
Identify the mistake in this code snippet: 'name = John'. How should it be corrected?
[3 marks]
5.
In a programming language you know, write a line that creates a variable called 'age' and sets it to 12.
[3 marks]
6.
Complete the following statement by filling in the missing word: 'Variables are used to store ____ in a program.'
[2 marks]
7.
Draw a diagram showing how a variable stores data in a computer's memory. Label the variable name and the stored value clearly.
[5 marks]
Drawing / Sketch space
8.
Describe what the following code does: 'height = 150; height = height + 20'. What is the new value of 'height'?
[4 marks]
9.
Write a short program snippet that creates a variable called 'name' and assigns your own name to it.
[3 marks]
10.
In your own words, explain why variables are important when writing a program.
[4 marks]
11.
Draw a flowchart showing the steps to assign a value to a variable and then use that variable in a calculation.
[6 marks]
Drawing / Sketch space

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