SDD  ·  Software Design & Development

SDD Past Paper Practice

Lesson 18 of 19 Approx 60–90 min Covers all 8 SQA SDD spec areas 🚀 Extension Studio

Questions 24–25 include practical PyCharm verification: create and continue in the same Python file, test the code, and record the outputs. These practical steps are unmarked extensions to the evaluation questions. These questions are written in the style of SQA N5 Computing Science past papers. They are grouped by specification area (1.1–1.8). Work through each section, write your answer, then reveal the marking notes. Use the score tracker to record your practice marks as you go. All local allocations are teacher-created practice marks, not SQA marking instructions.

Your teacher-created practice score
0 / 0

SQA reference language (read only)

SQA uses reference language in question papers. You need to be able to read it. You will never be asked to write it. Design answers below use structured-English pseudocode; implementation answers use Python.

Read and trace this supplied reference language. State the indices visited and the final displayed total. This is an unmarked reading check.

SET values TO [4, 7, 2]
SET total TO 0
FOR index FROM 0 TO 2 DO
    SET total TO total + values[index]
END FOR
SEND total TO DISPLAY

The indices are 0, 1, 2: reference-language TO includes its end value. The running totals are 4, 11, 13, so the displayed total is 13. The equivalent Python loop uses range(3), whose end value 3 is excluded.

1.1 Development methodologies
PP-style · Q1 1 mark 1.1

Name the iterative development process used at National 5 level and state how many stages it has.

Award 1 mark for: Iterative development process / software development process (accept "iterative" or "six-stage development process"). Must state 6 stages. Award 0 if only the name of one stage is given.

Example answer: The iterative development process — it has 6 stages: analysis, design, implementation, testing, documentation, and evaluation.

PP-style · Q2 2 marks 1.1

Explain what is meant by the term "iterative" in the context of the software development process.

Award 1 mark each for two of:

  • The process can repeat / go back to previous stages
  • If a problem is found (e.g. during testing), the developer returns to an earlier stage (e.g. design or implementation)
  • The process loops until the software meets all requirements
  • Evaluation may identify new requirements, restarting the cycle
PP-style · Q3 1 mark 1.1

During which stage of the development process would a programmer decide to use an array to store a list of names?

1.2 Analysis
PP-style · Q4 3 marks 1.2

A school wants a program to manage its after-school clubs. Identify one input, one process, and one output for this program.

Award 1 mark for each of:

Input (1 mark): Pupil name / club name / number of places / pupil registration number (any reasonable input)

Process (1 mark): Check if places are available / add pupil to waiting list / count total members / search for a pupil's clubs (any reasonable process)

Output (1 mark): Confirmation that the pupil has been added / list of available clubs / number of remaining places (any reasonable output)

PP-style · Q5 2 marks 1.2

Describe what is meant by a "functional requirement" for a software solution.

Award 1 mark each for two of:

  • A specific thing the software must do / be able to do
  • Describes the inputs, processes, and outputs required
  • Comes from the client's specification / what the client asked for
  • Something the developer can test — either the software does it or it doesn't

Example: "The program must accept a pupil's name and display a list of clubs they are registered for" is a functional requirement.

1.3 Design
PP-style · Q6 1 mark 1.3

Name one design notation used to plan the logic of a program before it is coded.

PP-style · Q7 4 marks 1.3

Design an algorithm using structured-English pseudocode for a program that: (a) asks the user to enter 5 test scores, (b) validates each score so that it must be between 0 and 100, (c) keeps a running total, and (d) displays the average score at the end.

Award 1 mark each for:

  • Repeats the score-collection process exactly 5 times
  • Rejects scores outside 0–100 inclusive, displays an error, and asks again until valid
  • Initialises the total to zero and adds each accepted score once
  • Divides the final total by 5 and displays the average
Set total to zero
Start fixed loop 5 times
    Start conditional loop
        Get score from user
        If score is outside 0 to 100 display error message
    Repeat until score is between 0 and 100 inclusive
    Add score to total
End fixed loop
Calculate average as total divided by 5
Display average

Accept any clear, logically correct alternative design, including one that reads a score before a conditional loop. Assess the four behaviours above; particular keywords, indentation, loop-end spelling, or refinement numbering are not required.

PP-style · Q8 2 marks 1.3

A programmer uses a structure diagram to design a program. Describe what a structure diagram shows.

Award 1 mark each for two of:

  • Uses symbols for process, loop, selection, and predefined-process steps
  • Represents the steps of an algorithm and how those steps are structured
  • Is read from top to bottom and, where steps branch at the same level, from left to right
  • Can show where repetition or selection occurs in the algorithm

A structure diagram is a design notation for algorithm steps; it is not a module-call hierarchy.

1.4 Implementation — data types and structures
PP-style · Q9 1 mark 1.4

A programmer stores the value 3.14 in a variable. What data type should be used?

PP-style · Q10 3 marks 1.4

A program stores the names of 6 clubs in an array called clubs.

(a) Write the Python code to declare the array and store the names "Art", "Chess", "Coding", "Drama", "Music", "Sport".
(b) Write Python code to display the third name in the array.
(c) State what index the last element has.

(a) 1 mark:

clubs = ["Art", "Chess", "Coding", "Drama", "Music", "Sport"]

(b) 1 mark:

print(clubs[2])

(index 2 = third element, because arrays/lists are zero-indexed in Python)

(c) 1 mark: Index 5. A 6-element array has indices 0–5. Last element = length − 1 = 6 − 1 = 5.

PP-style · Q11 2 marks 1.4

Explain the difference between a variable and an array.

Award 1 mark for each of:

  • A variable stores a single value; an array stores multiple values of the same type
  • Array elements are accessed using an index (position number, starting at 0); a variable is accessed by its name alone
1.5 Implementation — computational constructs
PP-style · Q12 1 mark 1.5

A program must repeat a block of code while the user's answer is wrong. The number of repetitions is not known in advance. Which loop construct is most appropriate?

PP-style · Q13 3 marks 1.5

The following Python code has three errors. Identify each error and state how to fix it.

score = int(input("Enter score: "))
if score =< 0:
    print("too low)
elif score > 100
    print("too high")
else:
    print("Valid score")

Award 1 mark each for identifying and fixing:

  • Error 1: =< is not valid Python. Fix: change to <= (less-than-or-equal-to).
  • Error 2: Missing closing quote in "too low) — the string is not closed. Fix: "too low")
  • Error 3: Missing colon at the end of elif score > 100. Fix: elif score > 100:
PP-style · Q14 2 marks 1.5

A program uses a predefined function called round(). State what is meant by a predefined function and give one benefit of using it.

Award 1 mark for definition: A predefined function is a function that is already written and built into the programming language — the programmer can use it without having to write the code themselves.

Award 1 mark for benefit (any one):

  • Saves time — the programmer does not have to write the code themselves
  • Reduces errors — the function has already been tested and is reliable
  • Improves readability — a single function call is easier to read than many lines of code
  • Can be used multiple times in the same program without repeating code
PP-style · Q15 2 marks 1.5

Complete the Python code below so that it traverses the array scores and prints each value on a new line.

scores = [45, 72, 88, 61, 53]
for _____ in range(_____):
    print(_____)
scores = [45, 72, 88, 61, 53]
for index in range(5):
    print(scores[index])

Award 1 mark for the loop variable and range (accept range(len(scores))); 1 mark for scores[index] (any valid index variable).

Alternative accepted: for score in scores: print(score) — award 2 marks.

1.6 Implementation — algorithm specification
PP-style · Q16 1 mark 1.6

Which of the following is one of the three standard algorithms named in the N5 specification?

PP-style · Q17 4 marks 1.6

An array called temps stores 7 daily temperature readings: [12, 8, 15, 6, 19, 11, 14].

(a) Write Python code that traverses the array and uses a running total within the loop to calculate the sum of all readings.
(b) Trace the value of total after each iteration and state the final output.

(a) 3 marks — award 1 each for: initialising total to 0 before the loop; traversing every array element; updating total inside the loop.

temps = [12, 8, 15, 6, 19, 11, 14]
total = 0

for index in range(len(temps)):
    total = total + temps[index]

print("Total:", total)

(b) 1 mark: total values after each iteration: 12, 20, 35, 41, 60, 71, 85. Final output: Total: 85.

PP-style · Q18 3 marks 1.6

Design the input validation algorithm using structured-English pseudocode that accepts a user's age, ensuring it is between 4 and 18 inclusive.

Award 1 mark each for:

  • Gets the age from the user
  • Correctly accepts ages 4–18 inclusive and identifies ages outside that range as invalid
  • Repeats after invalid input, showing an error message and asking for another age
Start conditional loop
    Get age from user
    If age is outside 4 to 18 display error message
Repeat until age is between 4 and 18 inclusive

Accept any clear, logically correct alternative design, including a read-before-loop design. Check the logic rather than requiring particular keywords or layout. An age is invalid if it is below 4 or above 18; the two endpoints are valid.

PP-style · Q19 3 marks 1.6

Complete the trace table below for the find-minimum algorithm running on the array [8, 3, 11, 2, 7]. The initial minimum is the value at index 0, which is 8.

Iterationindexcurrent valueminimum so far
Start088
113
2211
332
447

Award 1 teacher-created practice mark for each of: the first update to 3, the next update to 2, and the final minimum of 2:

Iterationindexcurrent valueminimum so far
Start088
1133 (3 < 8)
22113 (11 > 3 — no change)
3322 (2 < 3)
4472 (7 > 2 — no change)

Final minimum = 2.

1.7 Testing
PP-style · Q20 1 mark 1.7

A program accepts ages between 16 and 65 inclusive. Which of the following is an example of boundary test data?

PP-style · Q21 4 marks 1.7

A program accepts a percentage score (0–100) and awards a grade: A (70–100), B (50–69), C (30–49), Fail (<30). Design a test table with one example of each type of test data (normal, boundary, and exceptional). For each test, state the input, expected output, and type.

Award 1 teacher-created practice mark each for: a suitable normal test, a suitable boundary test, a suitable exceptional test, and correct expected outputs for all three.

TestInputExpected outputType
175Grade ANormal
270Grade ABoundary (lower boundary of A)
369Grade BBoundary (upper boundary of B)
40FailBoundary (lower boundary of range)
5101Error / Invalid input messageExceptional (out of range)
6"sixty"Error / Invalid input messageExceptional (wrong data type)

Any reasonable test table accepted, as long as: at least one normal, at least one boundary, at least one exceptional, and expected outputs are correct.

PP-style · Q22 2 marks 1.7

Explain the difference between a syntax error and a logic error.

Award 1 mark each for:

  • Syntax error: A mistake in the grammar / spelling / punctuation of the code that prevents the program from running. Detected by the interpreter/compiler before execution. Example: missing colon, misspelled keyword, unmatched bracket.
  • Logic error: The code runs without crashing but produces the wrong result. The programmer has made an error in the logic / algorithm. Example: using AND instead of OR in input validation, using < instead of <=.
1.8 Evaluation
PP-style · Q23 1 mark 1.8

Which evaluation criterion asks: "Does the program do what the client asked it to do?"

PP-style · Q24 4 marks 1.8

Evaluate the program below against the criteria of readability and efficient use of coding constructs. Your answer must refer to specific lines or features of the code.

x=int(input("?"))
if x>0:
    print("pos")
if x<0:
    print("neg")
if x==0:
    print("zero")

Practical: In PyCharm, create a new Python file called sdd18_practice.py. Run the supplied code with −3, 0, and 5. Then improve its identifiers, prompts, spacing, and selection structure, and repeat the tests. Record both sets of outputs alongside your evaluation. This verification is unmarked.

Award up to 2 marks for readability:

  • No internal comments — a comment explaining the purpose of the program would improve readability
  • Variable name x is not meaningful — should be renamed number or userValue
  • Input prompt "?" is not descriptive — the user does not know what to enter
  • No white space between the IF statements
  • Output strings ("pos", "neg", "zero") are abbreviated and not meaningful to the user

Award up to 2 marks for efficient use:

  • Three separate IF statements are used. This is inefficient because all three conditions are always evaluated.
  • If x is 5 (positive), condition 1 is True — but conditions 2 and 3 are still checked unnecessarily.
  • Using ELSE IF (elif) would be more efficient — once a match is found, the remaining conditions are skipped.

Unmarked PyCharm verification: the supplied code outputs neg, zero, and pos for separate inputs −3, 0, and 5 respectively. One improved implementation is:

# Classify an entered whole number.
number = int(input("Enter a whole number: "))

if number > 0:
    print("Positive")
elif number < 0:
    print("Negative")
else:
    print("Zero")

With −3, 0, and 5, the improved program displays Negative, Zero, and Positive respectively. Any equivalent improvement is acceptable.

PP-style · Q25 2 marks 1.8

A program accepts a numeric value and calculates its square root using math.sqrt(). It does not validate whether the number is negative. Evaluate the robustness of this program.

math.sqrt() is supplied as context for this question; it is not a function you are required to memorise at N5.

Practical: In sdd18_practice.py, replace the previous program with one that asks for a numeric value, repeats after a negative value, and displays its square root once valid. Test −9 followed by 16, then test 0 immediately. Record both outputs and use the evidence in your evaluation. This verification is unmarked; assume inputs are numeric.

Award 1 mark for identifying the problem: The program is not robust for negative numeric values. Calling math.sqrt() with a negative number raises ValueError, because the square root is not defined as a real number, and the program crashes.

Award 1 mark for suggesting an improvement: Validate the value so the program only calls math.sqrt() when number >= 0. One suitable Python rejection condition is while number < 0, with an error message and another numeric input inside the loop. Accept equivalent conditional-loop solutions.

Unmarked PyCharm implementation:

import math

number = float(input("Enter a non-negative number: "))
while number < 0:
    print("Invalid — number must be at least 0.")
    number = float(input("Enter a non-negative number: "))

print("Square root:", math.sqrt(number))

For −9 followed by 16, display Invalid — number must be at least 0. then Square root: 4.0. For 0 immediately, display Square root: 0.0. Without validation, math.sqrt(-9) raises ValueError.

SDD exam strategy

Use this practice to identify gaps across all eight specification areas. Read each command word carefully, then check that your answer addresses every part of the question.

Questions are expressed in SQA reference language, so you must be able to read forms such as RECEIVE x FROM (INTEGER) KEYBOARD, SEND "text" TO DISPLAY, SET x TO value, FOR ... / END FOR, and WHILE ... / END WHILE. When a question asks you to write code, you may use any programming language; marks reward correct understanding and logic rather than exact reference-language syntax.

For evaluation questions: name the criterion, state your judgement, justify with specific evidence from the code. Never give a vague answer — quote variable names, line features, or specific constructs.

Teacher notes — Shift+T to hide

Suggested use: This lesson works best as a revision class or post-assessment activity rather than a first-teach lesson. Pupils can work at their own pace through each spec section, spending more time on their weaker areas.

Score tracker: Pupils should manually click +1 for each mark they earn after revealing the marking notes. These are teacher-created practice marks, not SQA marking instructions. After completing the full set (55 practice marks), you can discuss which spec areas had the most drops as a class.

Known difficult questions: Q7 (pseudocode with validation + running total), Q17 (array traversal with running-total trace), Q21 (test table design), Q24 (evaluation of both readability and efficient use). Allow extra time for these.

Q13 (error spotting): This is a deliberately tricky question — pupils must spot =< (operator order), a missing closing quote, and a missing colon. Use these examples to practise checking operator order, paired quotes, and colons.