2.1.1

Variables & Constants

Test yourself on Variables & Constants

Test your knowledge with free interactive questions on Seneca — used by over 10 million students.

Variables and Constants

We may need to store data in the memory as part of our program.

The memory

The memory

  • The memory can be thought of as split up into 'blocks' called words.
  • Each word is usually 32 or 64 bits long.
  • To access a piece of memory, you have to use its memory address which looks something like 0x9FFF:000F.
Variables

Variables

  • To make life easier for programmers, we can give a memory location a symbolic name called an identifier.
  • The identifier is a word which describes what we will store in that memory location.
  • A variable is any part of the memory that we have named, and that we can change the value of while the program is running.
Constants

Constants

  • A constant is a named location in memory that can be used to store a value which does not change while the program is run.
Assignment

Assignment

  • The process of setting a value to a variable or a constant is known as assignment.
  • Assignment is usually shown using an equals sign, e.g:
    • height = 39.
Jump to other topics
1

Computational Thinking & Algorithms

2

Programming

3

Hardware & Software

4

Data

5

The Internet

6

Online Safety & Security

Practice questions on Variables & Constants

Can you answer these? Test yourself with free interactive practice on Seneca — used by over 10 million students.

  1. 1
  2. 2
    What is an identifier?Multiple choice
Answer all questions on Variables & Constants

Unlock your full potential with Seneca Premium

  • Unlimited access to 10,000+ open-ended exam questions

  • Mini-mock exams based on your study history

  • Unlock 800+ premium courses & e-books

Get started with Seneca Premium