Free revision guides

Concatenation: joining strings for the mark

National 5 Computing Science: Software design and development

Concatenation is one of the shortest topics in National 5 Computing Science, and one of the easiest marks to lose. The 2025 examiners' report found that many candidates could not describe concatenation, or even use the word, when a question asked for it.

What it means

Concatenation means joining strings together to make one longer string. In SQA reference language the joining operator is &. In Python it is +.

SET firstName TO "Callum"
SET town TO "Stornoway"
SET message TO firstName & " lives in " & town
SEND message TO DISPLAY

This displays Callum lives in Stornoway. Notice the spaces: they are inside the middle string, " lives in ". The computer never adds a space for you.

The same program in Python:

first_name = "Callum"
town = "Stornoway"
message = first_name + " lives in " + town
print(message)
What gains the mark
  • "Concatenation": using the word, when the question asks you to name the technique.
  • "Two strings are joined together to make one string": a description of what happens.
  • "The strings are added together." Adding is arithmetic. Strings are joined, not added, so this does not gain the mark.
  • "It puts the words together." Too vague: say that strings are joined into one string.

Joining a number

Reference language lets you join a number into a message directly:

SET seats TO 4
SEND "There are " & seats & " seats free" TO DISPLAY

This displays There are 4 seats free. In Python, a number has to be turned into a string first with str(), or Python stops with an error:

seats = 4
print("There are " + str(seats) + " seats free")

Mistakes that lose the mark

  • Putting variable names in quotes. "town" is the word town, not what the variable holds.
  • Forgetting the joining operator between two parts, or putting a dash outside the quotes: town & - & seat does not work, town & "-" & seat does.
  • Missing spaces. "Fort" & "William" displays FortWilliam. If the question shows a space, put it inside a string.

Concatenation often appears inside a bigger program, for example to build the final message after a running total. For which data types can be joined, see choosing the most suitable data type.

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 Joining text simulation
In the course: Joining text. Join strings and variables together and see exactly what each line displays, spaces and all.

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.