How do I plan, write and test a working program in the on-screen examination to solve a set problem?
Apply practical programming skills in the on-screen examination: design, implement and test a program that solves a given problem.
An overview of WJEC A-Level Computer Science Unit 2, the on-screen practical programming examination, covering how to design, code and test a program to solve a set problem, and how the unit is assessed.
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 dot point is asking
Unit 2 Practical Programming to Solve Problems is the AS practical unit, assessed by an on-screen examination rather than a written paper. You write, test and debug working programs on a computer to solve problems set by WJEC. This is a single overview because Unit 2 is a skills unit: it does not add new theory beyond the programming principles of Unit 1, but assesses your ability to apply them at a keyboard under exam conditions. The skill is practised by programming, not by memorising facts, so this page sets out the approach rather than a body of content to recall.
The answer
What the unit assesses
Because it is practical, the only reliable preparation is to write many programs, debug your own errors, and build fluency in the constructs you will need under time pressure.
A method for solving the problem
Designing before coding is the single biggest time-saver in the on-screen exam: a clear plan turns coding into transcription and makes errors easy to locate.
Writing good code under exam conditions
Use the three control structures cleanly, decompose the problem into procedures and functions, choose appropriate data structures (an array or list for many similar items, a record for grouped fields), and validate input so the program does not crash on bad data. Readable code with meaningful names is also easier for you to debug when something goes wrong.
Testing systematically
Examples in context
- Example 1. Decomposing a larger problem
- A task to manage a club's membership might break into a procedure to add a member, a function to search for a member, and a procedure to print a report. Decomposing this way lets you write and test each part on its own, which is far easier than tackling the whole program at once, and it directly mirrors the modular approach Unit 1 teaches.
- Example 2. Why a record beats parallel arrays
- Storing each member's name, age and fee in three separate arrays risks them drifting out of step. Storing one record per member keeps the related fields together, so the data stays consistent. Choosing the right structure for the on-screen task is a practical application of the data-structures theory from Unit 1.
- Example 3. Catching an off-by-one error through testing
- A loop intended to process items 1 to 10 that actually runs 1 to 9 will pass casual testing but fail on the last item. A boundary test that checks the final item exposes the fault immediately, which is exactly why systematic testing with boundary data is stressed for this unit.
Try this
Q1. State the four stages of a sound approach to solving a programming problem. [4 marks]
- Cue. Understand the problem, design the solution, implement (code) it, and test it.
Q2. Give one example each of normal, boundary and erroneous data for a percentage field accepting 0 to 100. [3 marks]
- Cue. Normal: 57; boundary: 0 or 100 (and just outside, such as minus 1 or 101); erroneous: a letter or a value such as 200.
Exam-style practice questions
Practice questions written in the style of WJEC exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
WJEC 20198 marksA program must read a list of test marks, then output the highest mark, the lowest mark and the average. Describe how you would design and test a solution to this problem.Show worked answer →
Set out a design using the standard structures, then a test plan covering normal, boundary and erroneous data.
Design: read the marks into an array or list. Use a loop to traverse the list, keeping running variables for the highest (initialised to the first value), the lowest (likewise) and a running total. After the loop, the average is the total divided by the count. Validate each mark on entry (for example a range check 0 to 100) and reject anything out of range.
Testing: use normal data (a typical set of marks) to confirm the correct highest, lowest and average; boundary data (marks of 0 and 100) to check the limits; and erroneous data (a negative mark or a non-numeric entry) to confirm the validation rejects it. Record the expected and actual output for each test.
Markers reward a clear design using a loop and running variables, validation of input, and a test plan that includes normal, boundary and erroneous data with expected results.
WJEC 20216 marksExplain why testing with boundary data is important, and give an example of normal, boundary and erroneous data for a field that accepts an age between 0 and 120.Show worked answer →
Explain the purpose of boundary testing, then give one value of each type.
Boundary testing checks the program behaves correctly right at the edges of the allowed range, because off-by-one errors and incorrect comparison operators (for example using less-than where less-than-or-equal is meant) most often show up exactly there.
For an age accepted between 0 and 120: normal data is a value comfortably inside the range, such as 35; boundary data is a value on the limit, such as 0 or 120 (and just outside, such as minus 1 or 121); erroneous data is clearly invalid, such as minus 5 or the text "old".
Markers reward the point that errors cluster at the limits, plus one correct example each of normal, boundary and erroneous data.
Related dot points
- Explain the principles of programming: data types, the three control structures, procedures and functions, parameter passing and recursion.
A focused answer to WJEC A-Level Computer Science Unit 1 principles of programming, covering data types and variables, sequence, selection and iteration, procedures, functions and parameter passing, and recursion.
- Design algorithms in pseudocode, apply the standard searching and sorting algorithms, and compare algorithm efficiency.
A focused answer to WJEC A-Level Computer Science Unit 1 algorithms, covering algorithm design and pseudocode, linear and binary search, bubble, insertion and merge sort, and comparing efficiency.
- Describe and use arrays, records, lists, stacks, queues, trees and hash tables, and explain their operations and uses.
A focused answer to WJEC A-Level Computer Science Unit 1 data structures, covering arrays and records, the abstract data types stack and queue, lists, binary trees and hash tables, and when each is the right choice.
- Describe files, fields and records, relational databases, normalisation, basic SQL, and validation and verification.
A focused answer to WJEC A-Level Computer Science Unit 1 organisation of data, covering files, fields and records, relational databases and keys, normalisation to remove redundancy, basic SQL, and validation and verification.
- Represent numbers in binary, hexadecimal and two's complement, perform binary arithmetic, and represent characters, sound and images as binary data.
A focused answer to WJEC A-Level Computer Science Unit 1 data representation, covering binary and hexadecimal, two's complement, binary arithmetic and shifts, and how characters, sound and images are stored as binary.