Use of Data Types

Click to see the rest of the programming section :

One of the fundamentals of understanding how program code works is understanding the use of data types when declaring variables.

data types - GCSE Computer science

You may also see the term data types used when discussing databases, and it’s important to remember that some of the names for data types differ between the two topics.

In programming theory, there are five major data types that you will need to be able to identify and use in your programs:

  • Char
  • String
  • Integer
  • Real
  • Boolean

Char

A char is a single character. Characters can be alphabetical, numeric, or symbols and are generally from the ASCII character set (or Unicode for more complex programs).

Using a char data type is useful when each character of a word or phrase needs to be checked. For example when calculating the strength of a password, or checking that an email address meets the required pattern.

String

A string is a combination of characters in a word or phrase. In some older programming languages strings are declared as arrays of characters. Strings are one of the most common data types in programming and for some languages, all user input is initially treated as a string.

String manipulation is the process of analysing or changing string variables and is a large part of the programming topic.

 

Integer

You may recognise the term integer from your maths lessons, and in Computer Science it means exactly the same thing – data that is a whole number. When asked to define an integer in your exam, it is important to clearly state that the number is whole as just stating number is not specific enough.

Real

A real number is the technical term for a decimal number in Computer Science. You may have seen them referred to as a float in programming languages – this is also a correct term in many languages.

Real numbers often need to be rounded or truncated (cut off) before they are output to the screen as a real number may contain an infinate number of numbers after the decimal point.

 

Boolean

A boolean data type holds either a True or False value. The unusual name comes from the British mathematician, George Boole who developed the concept of reducing all logic down to a simple true or false value.

You’ll come across this in action in the Boolean Logic topic.

More For Members

Lesson Plan

Coming Soon!

Presentation

Coming Soon!

Homework

Click to download

Students

Click to Revise (interactive programming challenges)

Not a member yet? Sign Up Here

Sign Up For Membership Today

Individual Student

Individual Site License
Topic Introduction Pages
Additional Revision Resources
Revision Videos
Exam Question Walkthroughs
Discounted Group Lessons
£2.50 per Month. After your initial payment, your first payment is Free.

Whole School

Whole School Site License (teacher access)
Up to 50 student accounts (£3 per student, per annum for additional students)
Online Topic Lesson Plans
Differentiated Homework Tasks
Monthly Bundle of Downloadable Resources
Discounted Live Lessons
£12.50 per Month.
Number of courses 30
Getting Started with LESS
Improve Your CSS Workflow with SASS
Easy Zurb Foundation
GET IT NOW GET IT NOW

Find this page helpful? Share the love on your social media mentioning @TeachAllAboutIT and we’ll enter you in our monthly draw to win a gift voucher for any product on the site!

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on reddit