- Understand why evaluation is the final stage of the iterative development process
- Describe, identify, and exemplify all four SQA evaluation criteria for a software solution
- Apply evaluation criteria to code examples and explain specific improvements
- I can define fitness for purpose and explain how to check a program meets its requirements
- I can define robustness and identify whether a program handles invalid input correctly
- I can define efficient use of coding constructs and give a specific code example
- I can define readability and identify all four sub-criteria: commentary, meaningful identifiers, indentation, and white space
- I can evaluate a given program against all four criteria and justify my judgement with evidence from the code
Answer before the lesson begins.
1. Evaluation is one of the six stages of the iterative development process. When does it take place?
2. A program asks the user for their age. The user types "twenty". What does a robust program do?
3. Which of the following variable names is the most readable?
Key vocabulary
totalScore is meaningful; x is not.The four evaluation criteria
The SQA specification requires you to evaluate a software solution against exactly four criteria. For each one, you must be able to describe what it means, identify whether a program has it, and exemplify it with specific evidence from code.
1. Fitness for purpose
Does the program do what it was designed to do? To evaluate this, go back to the functional requirements from the analysis stage and check each one:
- Does every input listed work correctly?
- Does every process produce the right result?
- Does every output appear as specified?
A program is fit for purpose if it meets all requirements. If it meets most but not all, it is partially fit for purpose β and you should identify which requirement is not met.
2. Robustness
Does the program handle invalid input without crashing? A robust program:
- Validates input before processing it
- Displays a meaningful error message when input is invalid
- Gives the user the chance to try again
- Does not crash or produce garbage output when unexpected data is entered
At N5 level, robustness is primarily achieved through the input validation standard algorithm (SDD14b). A program that uses int(input(...)) without any validation is not robust β it will crash if the user types a letter.
3. Efficient use of coding constructs
Does the program use the right tool for each job? The SQA is specifically looking for situations where a less efficient approach was replaced with a more efficient one. The most common examples at N5 are:
| Situation | Inefficient | Efficient |
|---|---|---|
| Multiple conditions | Three separate IF statements (all three are always evaluated) | IF / ELSE IF / ELSE (stops at the first match) |
| Repeated code | Same block of code copied 10 times | A loop that runs 10 times |
| Common calculation | Writing the same formula in multiple places | A predefined function called wherever needed |
| Array traversal | Accessing array[0], array[1], array[2]β¦ individually | A loop with an index variable |
Key point for the exam: ELSE IF is more efficient than multiple IF statements because when one condition is true, the rest are skipped. With separate IFs, the computer evaluates every single one.
4. Readability
The SQA specifies four sub-criteria for readability. All four can be examined:
| Sub-criterion | What it means | Example |
|---|---|---|
| Internal commentary | Comments in the code that explain what sections do. In Python, lines starting with #. | # Calculate the average score |
| Meaningful identifiers | Variable, array, and function names that describe their purpose. | totalScore not x |
| Indentation | Code inside loops, IF statements, and functions is consistently indented (4 spaces in Python). Makes the structure visible. | Lines inside for indented by 4 spaces |
| White space | Blank lines between sections of code. Makes the code easier to scan. | Blank line between variable declarations and the main loop |
Before and after β applying the criteria
x=0
for i in range(5):
n=int(input("?"))
x=x+n
print(x/5)
# Collect 5 scores and calculate the average
total = 0
for question in range(1, 6):
score = int(input("Enter score for Q" + str(question) + ": "))
total = total + score
average = total / 5
print("Average score:", average)
Improvements: comment added; meaningful identifiers (total, score, average, question); consistent 4-space indentation; blank line before the loop and before the output.
if score >= 70:
grade = "A"
if score >= 50 and score < 70:
grade = "B"
if score < 50:
grade = "Fail"
if score >= 70:
grade = "A"
elif score >= 50:
grade = "B"
else:
grade = "Fail"
If score is 80, the first condition is True. With separate IFs, conditions 2 and 3 are still evaluated. With ELSE IF (elif), Python jumps straight to END IF β more efficient.
age = int(input("Enter your age: "))
# If user types "hello", this crashes
# with ValueError: invalid literal
age = int(input("Enter your age (0-120): "))
while age < 0 or age > 120:
print("Invalid. Enter age 0-120.")
age = int(input("Try again: "))
Note: the improved version validates the range β it still assumes the user enters a number. Full robustness (handling non-numeric input) requires exception handling, which is beyond N5 scope.
How to write an exam evaluation
In the exam, you may be shown a program and asked to "evaluate this solution" or asked about a specific criterion. Always:
- Name the criterion β use the SQA term exactly.
- State your judgement β is it good, poor, or could be improved?
- Give specific evidence from the code β quote a line number, variable name, or specific construct.
Example answer β fitness for purpose
"The program is fit for purpose. The functional requirements stated that the program should accept a score, calculate the grade, and display it. All three requirements are met: line 3 receives the score, lines 5β10 calculate the grade using ELSE IF, and line 12 displays the result."
Example answer β readability
"The readability could be improved. The variable name x on line 1 is not meaningful β it should be renamed totalScore to make its purpose clear. There are also no internal comments to explain what each section of the program does."
Example answer β efficient use
"The program makes efficient use of coding constructs. Lines 6β10 use an ELSE IF chain rather than three separate IF statements. This is more efficient because once the first matching condition is found, the remaining conditions are not evaluated."
Evaluate the program below against all four criteria. Give specific evidence from the code for each one.
t = 0
for i in range(10):
n = int(input("number: "))
t = t + n
print(t)
Fitness for purpose: Partially fit for purpose. The program collects 10 numbers and outputs their total. If the requirement was to display the total and average, it would not be fit for purpose as it only shows the total.
Robustness: Not robust. There is no input validation β if the user enters a non-numeric value, the program will crash with a ValueError. Adding a WHILE loop to check the input is within range would improve robustness.
Efficient use of coding constructs: Efficient. A FOR loop is used to collect 10 numbers rather than repeating the input line 10 times. The accumulator pattern (t = t + n) is the correct construct for a running total.
Readability: Poor. Variable names t, i, and n are not meaningful β they should be total, counter, and number. There are no internal comments. No white space separates the loop from the output statement.
totalScore is a meaningful identifier" or "there are comments on lines 2 and 7 explaining each section."Evaluation questions are among the highest-value questions in the SDD section. They are often worth 3β4 marks and require you to name, judge, and justify for each criterion. If the question says "evaluate the solution", cover all four criteria. If it says "evaluate the readability", cover all four readability sub-criteria.
The phrase the SQA uses for efficient use is: "efficient use of coding constructs". Use these exact words in your answer, not "good code" or "no repetition."
1. Which evaluation criterion specifically concerns the program handling invalid input without crashing? TYPE 1
2. A program uses three separate IF statements to check if a score is an A, B, or C grade. A student says this could be improved for efficiency. What should they replace them with? TYPE 1
3. Which of the following is NOT one of the four SQA sub-criteria for readability? TYPE 1
4. A program was required to: (a) accept a name and age, (b) check the age is valid, and (c) output a welcome message. The program accepts the name and age and outputs the message, but does no validation. How would you evaluate its fitness for purpose? TYPE 1
5. Evaluate the readability of the code below. Refer to all four SQA sub-criteria in your answer. TYPE 2
a=0
b=0
for i in range(5):
n=int(input("?"))
a=a+n
b=a/5
print(b)
Internal commentary: Poor. There are no comments in the program. A comment before the loop explaining that it collects 5 numbers, and one before the final line explaining the average calculation, would improve readability.
Meaningful identifiers: Poor. The variable names a, b, i, and n give no indication of what each variable holds. They should be renamed: a β total, b β average, i β counter, n β score.
Indentation: Partially acceptable. The two lines inside the FOR loop are indented, but inconsistently β they appear to use 4 spaces in one place and less in another. Consistent 4-space indentation should be used throughout.
White space: Poor. There are no blank lines between the variable declarations, the loop, and the output. Adding blank lines between these sections would make the structure of the program much clearer.
6. The following program was written to meet these requirements: (1) ask the user for a temperature in Celsius, (2) convert it to Fahrenheit using the formula F = C Γ 1.8 + 32, (3) display the result. Evaluate it for fitness for purpose and robustness. TYPE 2
celsius = float(input("Enter temperature in Celsius: "))
fahrenheit = celsius * 1.8 + 32
print("Temperature in Fahrenheit:", fahrenheit)
Fitness for purpose: Fully fit for purpose. All three requirements are met: line 1 accepts a Celsius temperature from the user; line 2 applies the correct conversion formula (C Γ 1.8 + 32); and line 3 displays the result in Fahrenheit. The program would produce the correct output for any valid numeric input.
Robustness: Not robust. There is no input validation. If the user enters a non-numeric value (e.g. "hot"), the program will crash with a ValueError on line 1. A WHILE loop should be added to validate that the input is within a realistic range, such as β273 to 1000 degrees Celsius. The program also does not handle the case where the user enters no value.
7. Evaluate the efficient use of coding constructs in the code below. Identify one inefficiency, explain why it is inefficient, and rewrite that section using a more efficient construct. TYPE 2
score = int(input("Enter score: "))
if score >= 70:
print("Grade A")
if score >= 50 and score < 70:
print("Grade B")
if score >= 30 and score < 50:
print("Grade C")
if score < 30:
print("Fail")
Inefficiency identified: Four separate IF statements are used. This means every condition is evaluated every time the program runs, even after a matching condition has been found. For example, if score is 85, the first condition is True and "Grade A" is printed β but conditions 2, 3, and 4 are still checked unnecessarily.
Why inefficient: With four separate IFs, the computer always performs four comparisons. With ELSE IF, it stops as soon as a match is found β potentially only one comparison is needed.
Rewritten:
score = int(input("Enter score: "))
if score >= 70:
print("Grade A")
elif score >= 50:
print("Grade B")
elif score >= 30:
print("Grade C")
else:
print("Fail")
8. Write a full evaluation of the program below against all four SQA criteria. The program was required to: collect 5 pupil names from the user, store them in an array, and display them all. TYPE 2
n=[]
for i in range(5):
x=input("?")
n.append(x)
for i in range(5):
print(n[i])
Fitness for purpose: Fully fit for purpose. The program collects 5 names (FOR loop, lines 2β4), stores them in an array (line 4 appends each to n), and displays all five (FOR loop, lines 5β6). All three requirements are met.
Robustness: Robustness is not applicable for string input β any text the user types is valid. However, the input prompt ("?") gives no information about what to enter, which could lead to user error. A more descriptive prompt would improve the user experience.
Efficient use of coding constructs: Efficient. Two FOR loops are used rather than writing the input and print lines five times each. This is an appropriate and efficient use of loops for a fixed number of iterations.
Readability: Poor. Variable names n, i, and x are not meaningful β they should be names, counter, and pupilName. There are no internal comments. There is no white space between the two loops. Indentation appears consistent (acceptable).
9. In PyCharm, write a program that deliberately demonstrates all four evaluation criteria being met. The program should: ask the user for 3 temperatures (validate: between -50 and 60), calculate and display the average temperature, and state whether the average is above or below freezing (0Β°C). Your code must include: (a) at least two comments, (b) meaningful variable names throughout, (c) consistent indentation, (d) blank lines between sections, (e) input validation for robustness, and (f) ELSE IF / else for the above/below freezing check. TYPE 3
# Program to collect 3 temperatures and calculate the average
total = 0
for reading in range(1, 4):
temperature = float(input("Enter temperature " + str(reading) + " (-50 to 60Β°C): "))
while temperature < -50 or temperature > 60:
print("Invalid. Temperature must be between -50 and 60 degrees Celsius.")
temperature = float(input("Enter temperature " + str(reading) + " (-50 to 60Β°C): "))
total = total + temperature
# Calculate average and determine whether it is above or below freezing
average = total / 3
print("Average temperature:", round(average, 1), "Β°C")
if average > 0:
print("The average temperature is above freezing.")
elif average == 0:
print("The average temperature is exactly at freezing point.")
else:
print("The average temperature is below freezing.")
This solution demonstrates: internal comments (lines 1 and 11); meaningful identifiers (total, reading, temperature, average); consistent 4-space indentation; blank lines between sections; robustness via input validation; and efficient use of elif.
10. The program below has poor readability and makes inefficient use of coding constructs. In PyCharm, rewrite the entire program to fix both issues. Add comments, rename all variables to meaningful names, add white space, and replace the repeated IFs with ELSE IF. Test both versions to confirm they produce the same output. TYPE 3
p=int(input("p?"))
if p>=90:
print("gold")
if p>=70 and p<90:
print("silver")
if p>=50 and p<70:
print("bronze")
if p<50:
print("no medal")
# Medal award program β determines medal based on percentage score
percentage = int(input("Enter your percentage score (0-100): "))
# Award medal based on score bracket
if percentage >= 90:
print("Gold medal")
elif percentage >= 70:
print("Silver medal")
elif percentage >= 50:
print("Bronze medal")
else:
print("No medal awarded")
Improvements made:
Readability: p renamed to percentage (meaningful identifier); two comments added; blank line before the IF block; input prompt now descriptive.
Efficiency: four separate IFs replaced with IF / ELIF / ELSE β the computer now stops evaluating conditions as soon as a match is found.
Suggested timing: 55 minutes. Warm up 7 min; vocab + notes 15 min; before/after examples 10 min; now you try 5 min; task set Q1βQ8 13 min; PyCharm Q9βQ10 15 min (or set as homework).
Common pupil confusion: evaluation vs testing. Testing checks whether the program produces correct outputs for given inputs. Evaluation makes a broader judgement about the quality of the solution. They are related but distinct β a program can pass all tests and still have poor readability or inefficient code.
Efficient use β the key teaching point. Write both versions of the grade checker on the board side by side. Ask pupils: "If score is 85, how many IF comparisons does version A do? How many does version B (ELSE IF) do?" Version A: 4. Version B: 1. This makes the efficiency difference concrete.
Readability task: Give pupils a printout of a real piece of pupil code (anonymised) with poor readability. Ask them to annotate it β identify which sub-criteria are missing and rewrite it with improvements. This is more engaging than working from a textbook example.
SQA mark scheme language. Pupils must use "efficient use of coding constructs" β not "efficient code" or "no repeated lines". Similarly for robustness β must reference "invalid input" not just "errors".