Data Types & Casting (AQA GCSE Computer Science)

Revision Note

James Woodhouse

Expertise

Computer Science

Data Types & Casting

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 Example
Integer Whole numbers 10, -5, 0
Real Numbers with a fractional part 3.14, -2.5, 0.0
Character  Single character 'a', 'B', '6', '£'
String Sequence of characters "Hello world", "ABC", "@#!%"
Boolean
True or false values 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 or String handling operations
  • You can read more about string handling operations and converting data types here

Worked example

Customers booking a holiday can choose between half board or all inclusive and a hotel star rating between 1 and 5

A typical booking record is shown in the table:

firstName Jacob
lastName Franks
boardType All inclusive
starRating 5
bookingComplete True

 State the most appropriate data type for the following fields [2]

boardType  
starRating  

 Give the name of one field that could be stored as a Boolean data type [1]

Answer

boardType String
starRating Integer

  • bookingComplete

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)

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

the (exam) results speak for themselves:

Did this page help you?

James Woodhouse

Author: James Woodhouse

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.