CIE AS & A Level Computer Science, section 10.1 (Data types and records)
Data types
A data type tells the computer what kind of value is stored and which operations are allowed. The pseudocode uses these types:
| Data type | Stores | Example |
|---|---|---|
INTEGER |
a whole number | 42, -7 |
REAL |
a number with a decimal part | 3.14, -0.5 |
CHAR |
a single character | 'A', '7' |
STRING |
a sequence of characters (text) | "Hello" |
BOOLEAN |
TRUE or FALSE |
TRUE |
DATE |
a date | 25/12/2025 |
Arrays and files are also available as data structures: ARRAY and FILE.
Choosing a data type
| Data | Type | Reason |
|---|---|---|
| Number of students | INTEGER | always whole |
| Price | REAL | has pence |
| Telephone number | STRING | not used in calculations, and may start with 0 |
| First initial | CHAR | one character |
| Is the account active? | BOOLEAN | two possible values |
| Date of birth | DATE | holds a date and allows date calculations |
A good rule: if you will do arithmetic with it, use a number type; if not, use STRING (for example a phone number or postcode).
Declaring in pseudocode
DECLARE Name : STRING
DECLARE Age : INTEGER
DECLARE Price : REAL
DECLARE Active : BOOLEAN
Python
age = 16 # int
price = 4.99 # float
initial = "A" # a one-character string
name = "Aisha" # str
active = True # bool
print(type(age), type(price), type(active))
Converting between types: int("42") gives 42, and str(42) gives "42".
Common mistake: storing a telephone number as an INTEGER, which loses a leading 0. Use STRING for data you do not calculate with. Also, a CHAR holds one character only, not a word.
Exam tip: when asked to select a data type, give the type and a reason linked to the data (whole number, decimals, text, two values). Mention whether calculations are needed.
Check yourself
Which data type is best for a student’s name?
STRING.
Which data type stores TRUE or FALSE?
BOOLEAN.
Why is a postcode stored as a STRING?
It contains letters and is not used in calculations.