Variables and Constants Flashcards

1️⃣ Familiarise yourself with the flashcards:

  • Look through all the flashcards to see what's on both sides.
  • Make sure you understand the information on each card. If something's unclear, click the link to the revision notes at the bottom of the page for more details.

2️⃣ Test yourself:

  • Look at the question or prompt on each card and try to remember the answer before flipping it over.
  • Check the answer and make a note of any cards you find challenging and need to go over more.

3️⃣ Consistently Review and Practice:

  • Use spaced repetition: spend more time on the cards you struggle with and go over them more often.
  • Regularly review all the flashcards to help you better understand and retain the information over time.

Note: We may include questions that have multiple correct answers. It's useful to remember specific examples to understand these concepts better.

PERSONALISED 1-TO-1 TUTORING

Need more help on this topic? Get 1-to-1 support

Get support with clear explanations, practice and feedback (Ages 5 to 16).

  • DBS-checked tutors
  • Flexible times
  • Parents can be updated

Want an ad-free experience? Subscribe to remove ads

What is a variable in programming?

A named place in memory that holds a value which can change while the program runs.

What is a constant?

A named value that does not change while the program runs.

How is a variable different from a constant?

A variable can change during the run. A constant stays the same.

Why use a constant instead of repeating a value?

It makes code clear, avoids repeats, and lets you update it in one place.

What does it mean to initialise a variable?

Give the variable its first value before you use it.

What might happen if you use a variable before initialising it?

It can cause an error or a wrong result, so set it first.

What does 'assign a value to a variable' mean?

Store a value in the variable, for example set score to 0.

Can you change a variable's value after it is set?

Yes. You can give it a new value later in the program.

Should you change a constant after you set it?

No. A constant must not change while the program runs.

Give one example of a variable and one of a constant.

Variable: score or temperature. Constant: PI, VAT rate, or school name.

What is a literal value compared to a constant?

A literal is written straight in code, like 10 or 'red'. A constant is a named fixed value.

Where is a variable stored?

In the computer's memory, such as RAM.