Data Types (Cambridge (CIE) A Level Computer Science): Revision Note

Exam code: 9618

Robert Hampton

Written by: Robert Hampton

Reviewed by: James Woodhouse

Updated on

Primitive data types

What are data types?

  • 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:

    • Integer: used to represent whole numbers, either positive or negative

      • Examples: 10, -5, 0

    • Real: used to represent numbers with a fractional part, either positive or negative

      • Examples: 3.14, -2.5, 0.0

    • Char: used to represent a single character such as a letter, digit or symbol

      • Examples: 'a', 'B', '5', '$'

    • String: used to represent a sequence of alphanumerical characters

      • Examples: "Hello World", "1234", "@#$%"

    • Boolean: used to represent true or false values

      • Examples: True, False

    • Date: used to store a calendar date

      • Example: DD/MM/YY

  • It is important to choose the correct data type for a given situation to ensure accuracy and efficiency in the program

  • In pseudocode and some other programming languages, data types must be declared before they can be used

    • The data types are declared with each data item to be used

    • Each data item is given a unique name called an identifier

    • DECLARE <identifier> : <data type>

Data Type

Example Value

Pseudocode

Python

Java

VB.NET

Integer

10

DECLARE Age : INTEGER
Age ← 10

age = 10

int age = 10;

Dim age As Integer = 10

Real

3.14

DECLARE Temp : REAL
Temp ← 3.14

temp = 3.14

double temp = 3.14;

Dim temp As Double = 3.14

Char

'A'

DECLARE Grade : CHAR
Grade ← 'A'

grade = 'A'

char grade = 'A';

Dim grade As Char = "A"c

String

"Hello"

DECLARE Name : STRING
Name ← "Hello"

name = "Hello"

String name = "Hello";

Dim name As String = "Hello"

Boolean

TRUE

DECLARE LoggedIn : BOOLEAN
LoggedIn ← TRUE

logged_in = True

boolean loggedIn = true;

Dim loggedIn As Boolean = True

Date

24/04/2025

DECLARE DOB : DATE
DOB ← "24/04/2025"

dob = "24/04/2025" (string or datetime)

LocalDate dob = LocalDate.of(2025, 4, 24);

Dim dob As Date = #24/04/2025#

You've read 0 of your 5 free revision notes this week

Unlock more, it's free!

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Did this page help you?

Robert Hampton

Author: Robert Hampton

Expertise: Computer Science Content Creator

Rob has over 16 years' experience teaching Computer Science and ICT at KS3 & GCSE levels. Rob has demonstrated strong leadership as Head of Department since 2012 and previously supported teacher development as a Specialist Leader of Education, empowering departments to excel in Computer Science. Beyond his tech expertise, Robert embraces the virtual world as an avid gamer, conquering digital battlefields when he's not coding.

James Woodhouse

Reviewer: James Woodhouse

Expertise: Computer Science & English Subject Lead

James graduated from the University of Sunderland with a degree in ICT and Computing education. He has over 14 years of experience both teaching and leading in Computer Science, specialising in teaching GCSE and A-level. James has held various leadership roles, including Head of Computer Science and coordinator positions for Key Stage 3 and Key Stage 4. James has a keen interest in networking security and technologies aimed at preventing security breaches.