levo

Programming

Variables, constants and data types

  • 3 things to know
  • AS Unit 1

Overview

Term variable, declaring a variable and variable and a constant.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

Define the term data type.

Key term

What is the danger of relying on global variables?

Key term

Define the term variable.

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    Define the term variable.

    Model answer

    A variable is a named storage location in memory whose contents can be changed while a program is running.

  2. 2

    What is meant by declaring a variable?

    Model answer

    Declaring a variable tells the translator its name and its data type, so that memory of the right size is reserved for it and every use of it can be checked.

  3. 3

    What happens when a value is assigned to a variable?

    Model answer

    Assignment stores the given value in the variable's memory location, replacing whatever value was held there before.

  4. 4

    Distinguish between a variable and a constant.

    Model answer

    A variable holds a value that the program is free to change as it runs, whereas a constant is given its value when the program is written and cannot be altered during execution.

  5. 5

    Give one reason for defining a constant rather than typing the same number in several places.

    Model answer

    A constant such as a rate of tax is defined in one place only, so when the rate changes a single line is edited and there is no risk of an occurrence being missed.

  6. 6

    Define the term data type.

    Model answer

    A data type states what kind of value a variable may hold, which operations may be carried out on it, and how much memory is reserved for it.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Systems Analysis and Development Approaches
Design, Development and Testing
Implementation and System Security
Programming

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A check requires a value.
presencerangeformat

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

ANormal data is 12, which should be accepted.
BBoundary data is 1 and 50, which should be accepted.
C0 and 51, just outside the limits, should be rejected.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

One byte is made up of 8 bits.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Programming, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.