10.1 Data Types and Records

2026 Syllabus Objectives

By the end of this subtopic, you should be able to:

  • select and use appropriate data types for a problem solution
  • understand and use these data types: INTEGER, REAL, CHAR, STRING, BOOLEAN, DATE
  • know that pseudocode can also use ARRAY and FILE
  • explain the purpose of a record structure
  • understand that a record can hold a set of related data items of different data types under one identifier
  • write pseudocode to define a record structure
  • write pseudocode to save data to a record structure
  • write pseudocode to read data from a record structure

What is a data type?

A data type is a way of classifying data. In simple words, it tells the computer what kind of value is being stored in a variable, and what can be done with that value.

This is important because not all data is the same. A whole number is different from a word. A single letter is different from a date. A true/false value is different from a decimal number. If a programmer chooses the wrong data type, the program may give wrong results, waste memory, or be harder to understand.

For example, a student’s age should usually be stored as an INTEGER because age is normally a whole number. A temperature might be stored as a REAL because it can include decimal values such as 36.5.

So, when solving a problem, one of the first things a programmer must do is choose the most suitable data type for each piece of data.


Why choosing the correct data type matters

Choosing the correct data type helps in three main ways.

First, it improves accuracy. If you store a decimal number in an integer variable, the decimal part may be lost. For example, if a price is 12.99, using INTEGER would be wrong.

Second, it improves efficiency. The computer can store and process data better when the correct type is used.

Third, it improves clarity. When another programmer reads the code, the chosen data types help them understand what kind of information is being stored.

For example:

  • a person’s name should be a STRING
  • a test mark with no decimal places can be an INTEGER
  • a bank balance may be a REAL
  • a grade like A or B can be a CHAR
  • a value like true/false should be a BOOLEAN
  • a birthday should be a DATE

Sign in to view full notes