Primitive Data Types (SQA National 5 Computing Science): Revision Note
Exam code: X816 75
Primitive data types
What is a data type?
A data type is a classification of data into groups according to the kind of data they represent
Computers use different data types to represent different types of data in a program
The basic data types include:
Data type | Used for | Pseudocode | Example |
|---|---|---|---|
Integer | Whole numbers |
|
|
Real | Numbers with a fractional part (decimal) |
|
|
Character | Single character |
|
|
String | Sequence of characters |
|
|
Boolean | True or false values |
|
|
It is important to choose the correct data type for a given situation to ensure accuracy and efficiency in the program
Data types can be changed within a program, this is called casting
Programming data types
Data type | Pseudocode (SQA style) | Python |
|---|---|---|
Integer |
|
|
Real |
|
|
Character |
|
|
String |
|
|
Boolean |
|
|
Worked Example
A sports shop requires a program to store information about football boots.
Complete the table below to state which types of variable should be used.
[3]
Variable | Type of variable |
|---|---|
| |
| |
|
Answer
Variable | Type of variable |
|---|---|
| String [1 mark] |
| Boolean [1 mark] |
| Integer [1 mark] |
Unlock more, it's free!
Was this revision note helpful?