ProgrammingTopic Summary

Knowledge Organiser: Variables and Constants

Part of Variables & Constants · GCSE GCSE Computer Science revision

This topic summary covers Knowledge Organiser: Variables and Constants within Variables & Constants for GCSE Computer Science. Revise Variables & Constants in Programming for GCSE Computer Science with 15 exam-style questions and 10 flashcards. This topic appears less often, but it can still be a useful differentiator on mixed-topic papers. It is section 7 of 7 in this topic. Use this topic summary to connect the idea to the wider topic before moving on to questions and flashcards.

Topic position

Section 7 of 7

Practice

15 questions

Recall

10 flashcards

Knowledge Organiser: Variables and Constants

Key Terms
  • Variable: A named memory location that stores a value which can change during the program
  • Constant: A named value that is set once and cannot be changed during the program
  • Assignment: Giving a value to a variable using = (e.g. score = 10)
  • Naming convention: Rules for how variable names should be formatted (camelCase, UPPER_CASE)
  • Reserved word: A keyword the language uses (if, while, for) — cannot be used as a variable name
Must-Know Facts
  • Variables can be reassigned; constants cannot change after being set
  • Variable names are case sensitive: Score and score are different
  • Names must start with a letter or underscore, not a number
  • No spaces in variable names — use camelCase or snake_case instead
  • Constants are often written in UPPER_CASE by convention (e.g. VAT_RATE)
  • Constants prevent accidental changes and make code easier to update
Key Concepts
  • Use variables for: scores, counters, user input — anything that changes
  • Use constants for: PI, tax rates, fixed limits — things that never change
  • Declare constant: const PI = 3.14159
  • Good name example: playerScore (meaningful) not x (meaningless)
Common Mistakes
  • Using meaningless variable names: Names like x, temp, or a are not acceptable in exam pseudocode — use meaningful names like playerScore or totalCost
  • Trying to change a constant's value: Constants cannot be reassigned after being set — attempting to do so is a logic/runtime error and defeats the purpose of using a constant
  • Starting a variable name with a number: Variable names must begin with a letter or underscore — 1score is invalid; score1 is valid
  • Putting spaces in variable names: Spaces are not allowed — use camelCase (playerScore) or underscores (player_score) instead of spaces
  • Using a reserved word as a variable name: Words like if, while, for, and print are reserved by the language and cannot be used as variable names

Keep building this topic

Read this section alongside the surrounding pages in Variables & Constants. That gives you the full topic sequence instead of a single isolated revision point.

Practice Questions for Variables & Constants

Which of the following best describes a variable in a program?

  • A. A named memory location whose value can be changed during execution
  • B. A named memory location whose value cannot be changed once set
  • C. A value that is hard-coded directly into the program instructions
  • D. A fixed mathematical value such as pi or the speed of light
1 markfoundation

Explain three reasons why using named constants is considered good programming practice.

3 marksstandard

Quick Recall Flashcards

What is a variable?
Named storage location whose value can change
What is a constant?
Named storage location whose value cannot change

15 questions on Variables & Constants — practise free

Instant marking, adaptive difficulty, and 10 spaced repetition flashcards. Free until your GCSEs.

Try PrepWise Free