Free revision guides

Choosing the most suitable data type

National 5 Computing Science: Software design and development

"State the most suitable data type" is one of the commonest 1-mark questions in National 5 Computing Science. The word that matters is most suitable, and the examiners' reports for 2023 and 2025 show where pupils slip.

The five data types

Data typeHoldsExamples
integerwhole numbersnumber of tickets: 4; age: 15
realnumbers that can have a decimal pointprice: 9.50; time: 12.85 seconds
characterexactly one letter, digit or symbolanswer: Y; grade: B
stringtext: any number of charactersname: Eilidh; postcode: IV2 3AB
Booleanone of two values: true or falseis a member: TRUE

The traps

  • A single letter is a character, not a string. "Y or N" is a character.
  • Phone numbers are strings. They are made of digits, but they can start with 0 and contain spaces, and you never do arithmetic with them. The same goes for postcodes and card numbers.
  • Real only when a decimal point is possible. A number of tickets is an integer; a price is real.
  • Dividing gives a real. In SET average TO total / 4, the average is real even if total is an integer.
  • Use the proper names. "Number", "text" and "yes/no" do not gain the mark.
Lists of values

For a list of values the question may ask for the data structure and the data type separately. Thirty pupils' test scores are an array (the structure) of integers (the type).

The same idea in databases

If you study database design, the field types have different names (text, number, date, time, Boolean), but the phone number trap is the same: it is stored as text.

Try two exam-style questions

Choose an answer, say how sure you are, then press Check. Every wrong answer tells you why it is wrong.

The Choose the data type simulation
In the course: Choose the data type. Sort real-world values into the right data type, with feedback on every choice.

The full course covers every topic like this. Every topic in National 5 Computing Science has a short note, a simulation to try and a practice quiz with feedback on every answer, plus coding lessons, a full mock exam and a progress report for parents.

Create an accountTry more for freeAbout the course

More guides

This site is independent: it is not connected to the SQA or Qualifications Scotland. Points from the examiners' course reports are given in our own words.