Zum Inhalt springen
Brainlag

Design

Farbe

Data types, variables and operators

Informatik GCSE Updated Wed 7 Oct 2026

Every value in a program has a data type, which decides what you can do with it. Operators then do the work: arithmetic on numbers, comparisons that give true or false, and Boolean logic that combines conditions.

Part 1 of 3: Learn it

In short

  1. The main data types are integer, real (float), Boolean, character and string.
  2. DIV gives the whole-number part of a division; MOD gives the remainder.
  3. Casting converts a value from one type to another, such as a string "42" to the integer 42.

Where this is in your specification

Spec points: AQA 3.2.1 to 3.2.5, OCR 2.2.1 and 2.2.2, Edexcel Topic 6

BoardTopic: Programming in exam style
AQA 85253.2.1 to 3.2.11, 3.7.1
Edexcel 1CP2Topic 6 (and Topic 1 for trace tables)
OCR J2772.2.1 to 2.2.3, 2.3.1, 2.3.2
Eduqas C5007 Principles of programming; 10 Program construction
Cambridge IGCSE 04788 Programming
National 5 C816 75Software design and development: implementation, testing

Data types

TypeHoldsExample
Integerwhole numbers17, −3
Real (float)numbers with a decimal part3.75
Booleanone of two valuesTrue, False
Charactera single letter, digit or symbol'G'
Stringa sequence of characters"Year 11"

Variables and constants

A variable is a named store whose value can change while the program runs. A constant is given a value once and cannot be changed later, such as VAT_RATE = 0.2. Constants make code easier to read and update in one place. Assignment uses = (or ← in AQA pseudocode) to put a value in a variable.

Operators

KindOperatorsExample
Arithmetic+ − * /7 / 2 gives 3.5
Integer divisionDIV17 DIV 5 gives 3
RemainderMOD17 MOD 5 gives 2
Power^2 ^ 5 gives 32
Comparison== != < > <= >=4 != 5 gives True
BooleanAND OR NOTTrue AND False gives False

MOD is handy for testing whether a number is even: n MOD 2 is 0 for every even number.

Casting

Input from the keyboard usually arrives as a string. To do arithmetic with it, convert it: int("42") + 1 gives 43, while "42" + "1" joins the strings to make "421". str(), int(), float() and bool() are the usual casting functions.

Quick check

What is 29 MOD 4?

Show the answer

1 (29 = 7 × 4 + 1).

Part 2 of 3: See it worked

Worked examples

Example 1

A school has 230 students to put on minibuses of 16. Use DIV and MOD to find how many full buses there are and how many students are left over.

  1. 230 DIV 16 = 14 (14 × 16 = 224)
  2. 230 MOD 16 = 6

Answer: 14 full minibuses, with 6 students left over (so 15 buses are needed).

Example 2

x = 6 and y = 10. Evaluate (x > 5) AND NOT (y == 10).

  1. x > 5 is True
  2. y == 10 is True, so NOT (y == 10) is False
  3. True AND False

Answer: False.

Common mistakes

  • Mixing up DIV and MOD.
  • Storing a phone number or a postcode as an integer.
  • Using = to compare in languages that need ==.
  • Forgetting to cast input before doing arithmetic with it.
Quick check

Which data type would you use for whether a user is logged in?

Show the answer

Boolean.

Part 3 of 3: Test yourself

Check yourself

Answer each one in your head or on paper first, then open it to check.

What is 29 MOD 4?

1 (29 = 7 × 4 + 1).

Which data type would you use for whether a user is logged in?

Boolean.

What is the difference between a variable and a constant?

A variable's value can change while the program runs; a constant's value is fixed.

Jobs that use this

Each link opens the job profile on the National Careers Service (England). In the rest of the UK: My World of Work (Scotland), Careers Wales, nidirect careers (Northern Ireland).

Diese Lernzettel sind auf Englisch, weil sie britischen Prüfungslehrplänen folgen.

Full lessons and marked practice for this course are coming soon to Brainlag Learn. See courses