What building blocks do we combine in a high-level language to make a program work?
Computational constructs: assignment, arithmetic, comparison and logical operators, concatenation, predefined functions, and the control structures of selection and iteration (fixed and conditional).
An SQA National 5 Computing Science answer on computational constructs, covering assignment, arithmetic, comparison and logical operators, string concatenation, predefined functions, and the control structures of selection (IF) and iteration (fixed and conditional loops) used to build programs in a high-level language.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this key area is asking
The SQA wants you to read and write programs in a high-level language using the core computational constructs: assignment, the arithmetic, comparison and logical operators, string concatenation, predefined functions, and the two control structures of selection and iteration.
Assignment and operators
Programs combine values using three families of operator:
- Arithmetic operators do calculations: add
+, subtract-, multiply*, divide/, raise to a power (^or**), and modulo (the remainder after division, oftenMODor%). Modulo is useful for tests like "is this number even?" (number MOD 2 = 0). - Comparison operators compare two values and give a Boolean result: equal to
=, less than<, greater than>, less than or equal<=, greater than or equal>=, and not equal to<>. They are used in conditions. - Logical operators combine Boolean values: AND (true only if both sides are true), OR (true if either side is true), and NOT (reverses true and false). They build more complex conditions, such as
age >= 13 AND age <= 19.
Concatenation and predefined functions
Concatenation is how programs build messages from fixed text and variable values. Predefined functions cover common jobs: a random-number function for games, a length function to count characters, or a rounding function to control decimal places in output.
Selection: choosing a path
Selection lets a program behave differently in different situations: charge a child a lower price, display "Pass" or "Fail", or warn the user that input was invalid. The condition is built from comparison and logical operators.
Iteration: repeating steps
Iteration (looping) repeats statements so you do not have to write them many times. National 5 distinguishes two kinds.
Choosing the right loop is itself examined: a fixed loop when the count is known (process every pupil in a class of 30), a conditional loop when it depends on what happens (keep asking for a password until it is correct).
Putting constructs together
Real programs combine all of these: a loop (iteration) that contains an IF (selection) whose condition uses comparison and logical operators, building output by concatenation and using a predefined function for a calculation. Reading code in the exam means tracing it construct by construct; writing code means choosing the right construct for each part of the task.
How this key area is examined
Questions ask you to read code and state its output, or write code in a high-level language you have studied to meet a description. Expect to choose between a fixed and a conditional loop, build a condition from comparison and logical operators, use selection for different cases, and concatenate strings for output. Syntax must match the language you quote, but the marks centre on choosing the right construct for each part of the task.
For the official course specification
The SQA publishes the full National 5 Computing Science course specification, specimen question papers and coursework tasks at sqa.org.uk. Always revise from the current specification and SQA past papers, because question style and terminology are board-specific.
Exam-style practice questions
Practice questions written in the style of SQA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
SQA N5 style4 marksUsing a high-level language you have studied, write code that displays the numbers from 1 to 10, each on a new line.Show worked answer →
Four marks for a correct fixed loop that runs the right number of times and outputs each value.
Example (Python):
for number in range(1, 11):
print(number)
Markers reward a fixed (count-controlled) loop, the correct range so it runs ten times (1 to 10 inclusive), outputting the loop variable each pass, and correct syntax for the language quoted. The key idea is choosing a fixed loop because the number of repetitions is known in advance.
SQA N5 style3 marksA leisure centre charges 5 pounds entry, but children under 16 pay 3 pounds. Write code that reads an age and displays the correct charge.Show worked answer →
Three marks for the input, the correct condition, and the two outcomes.
Example (Python):
age = int(input("Enter age: "))
if age < 16:
print("Charge is 3 pounds")
else:
print("Charge is 5 pounds")
Markers reward reading the age as a number, a correct comparison (age < 16), and selection that outputs 3 pounds for under-16s and 5 pounds otherwise. This tests selection (IF/ELSE) with a comparison operator.
Related dot points
- Data types and structures: variables holding character, string, numeric (integer and real) and Boolean values, and the 1-D array as a structure for holding many values of the same type under one name.
An SQA National 5 Computing Science answer on data types and structures, covering the variable types of character, string, integer, real and Boolean, when each is chosen, and how a one-dimensional array stores many values of the same type under a single name accessed by an index.
- Standard algorithms: input validation, running total within a loop, and traversing a 1-D array, each as a reusable pattern built from selection and iteration.
An SQA National 5 Computing Science answer on the three standard algorithms, covering input validation with a conditional loop, keeping a running total inside a loop, and traversing a one-dimensional array with a fixed loop, with worked code-style examples of each reusable pattern.
- Design techniques: representing a program design with structure diagrams, flowcharts and pseudocode, and designing the user interface with a wireframe.
An SQA National 5 Computing Science answer on design techniques, covering how developers plan a program using structure diagrams, flowcharts and pseudocode, how to read and write each notation, and how a wireframe is used to design the layout of a user interface before coding begins.
- The iterative software development process: analysis, design, implementation, testing, documentation and evaluation, and why the process is iterative rather than strictly linear.
An SQA National 5 Computing Science answer on the software development process, covering the six stages of analysis, design, implementation, testing, documentation and evaluation, what is produced at each stage, and why the process is iterative so that developers loop back to earlier stages when problems are found.
- Testing with normal, extreme and exceptional test data; the three kinds of error (syntax, execution and logic); and evaluating software for fitness for purpose, efficiency, robustness and readability.
An SQA National 5 Computing Science answer on testing and evaluation, covering the three categories of test data (normal, extreme and exceptional), the three kinds of error (syntax, execution and logic), and the four criteria for evaluating software: fitness for purpose, efficiency, robustness and readability.