Data Types (Cambridge (CIE) O Level Computer Science)
Revision Note
![Robert Hampton](https://www.savemyexams.com/cdn-cgi/image/f=auto,width=3840/https://cdn.savemyexams.com/uploads/2024/01/robert-hampton-computer-science-expert-save-my-exams.jpg)
Author
Robert HamptonExpertise
Computer Science Content Creator
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 | INTEGER | 10, -5, 0 |
Real | Numbers with a fractional part (decimal) | REAL | 3.14, -2.5, 0.0 |
Character | Single character | CHAR | 'a', 'B', '6', '£' |
String | Sequence of characters | STRING | "Hello world", "ABC", "@#!%" |
Boolean | True or false values | BOOLEAN | True, False |
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 | Python |
---|---|---|
Integer |
|
|
Real |
|
|
Character |
|
|
String |
|
|
Boolean |
|
|
Worked Example
Name and describe the most appropriate programming data type for each of the examples of data given. Each data type must be different
[6]
Data: 83
Data: [email protected]
Data: True
Answers
Data type name: Integer [1]
Data type description: The number is a whole number [1]Data type name: String [1]
Data type description: It is a group of characters [1]Data type name: Boolean [1]
Data type description: The value is True (or could be False) [1]
You've read 0 of your 0 free revision notes
Get unlimited access
to absolutely everything:
- Downloadable PDFs
- Unlimited Revision Notes
- Topic Questions
- Past Papers
- Model Answers
- Videos (Maths and Science)
Did this page help you?