Spec & Goals 3 min
AQA Spec 3.2 · Programming (whole unit)
By the end of this lesson you can:
- Revise and self-check the whole of Unit 2, spotting your weak topics.
- Answer exam questions that span all of spec 3.2, for the marks on offer.
- Make a focused revision plan that targets the topics you got wrong.
Warm-Up — command words & the paper 5 min
This is the last lesson of Unit 2. First, know the exam you are sitting.
Command words tell you what to do
Read the command word first — it sets how much to write.
| Command word | What it demands |
|---|---|
| State | A word or short phrase. No explanation. |
| Describe | Say what something is, or the steps, with detail. |
| Explain | Give reasons — the how or the why. |
| Complete | Fill a table, loop or line of code exactly. |
| Calculate | Work out a value; show your working. |
Key Concept — your Unit 2 spec checklist 14 min
Tick each spec point. If you cannot do one, that is a topic to revise tonight.
| Spec point | You should be able to… |
|---|---|
| Data types | Name and use integer, real, Boolean, character and string. |
| Variables & constants | Declare, assign and use a variable; explain why a constant never changes while the program runs. |
| Selection | Use IF … THEN … ELSE … ENDIF and nested or chained ELSE IF to choose a path. |
| Iteration | Use count-controlled (FOR) and condition-controlled (WHILE, REPEAT) loops. |
| Arithmetic operators | Use + - * /, integer division DIV and remainder MOD. |
| Relational operators | Use = ≠ < > ≤ ≥ to compare two values and return a Boolean. |
| Boolean operators | Combine conditions with AND, OR and NOT. |
| Arrays (1-D & 2-D) | Create, read and write a one-dimensional array and a two-dimensional array using indexes. |
| Records | Store related fields of different types together as one structured record. |
| Input / output | Read a value with USERINPUT and display one with OUTPUT. |
| Random numbers | Generate a random integer in a range with RANDOM_INT(a, b). |
| String handling | Find LEN, take a substring, change case and join strings with +. |
| Subroutines | Write a procedure and a function; pass parameters and use RETURN. |
| Scope | Tell apart a local variable (one subroutine) from a global one (whole program). |
| Structured programming | Break a problem into named subroutines with clear inputs and outputs. |
| Validation | Check input is sensible with range, length, presence and format checks. |
| Authentication | Confirm a user's identity, e.g. with a username and password. |
| Testing & test data | Choose normal, boundary and erroneous test data to test a program. |
Worked Example — a full multi-part question 12 min
Here is one question with three parts. We earn the marks aloud.
AQA pseudo-code
01 total ← 0 02 FOR i ← 0 TO 2 03 total ← total + scores[i] 04 ENDFOR 05 average ← total DIV 3 06 OUTPUT average
The array scores holds [8, 5, 5].
Part (a) — Complete the trace table. [3 marks]
We follow the loop line by line, writing i and total after each pass.
| i | total | average | OUTPUT |
|---|---|---|---|
| — | 0 | ||
| 0 | 8 | ||
| 1 | 13 | ||
| 2 | 18 | ||
| 6 | |||
| 6 |
Each correct value of total after a pass earns a mark.
Part (b) — State the output. [1 mark]
The total is 18; 18 DIV 3 is 6. The output is 6 (1).
Part (c) — A score must be from 0 to 10. Name a suitable validation check. [1 mark]
A range check (1) — it accepts a score only if it is between 0 and 10 inclusive.
Try It Yourself — timed mini-paper 12 min
Give yourself 12 minutes. Write full answers; check them with your teacher.
State the data type best suited to store a person's age, and one to store whether they are a member. [2 marks]
Calculate the value of 23 DIV 4 and the value of 23 MOD 4. [2 marks]
Complete the missing line so this loop outputs the numbers 1 to 5.
01 FOR i ← 1 TO 5 02 __________ 03 ENDFOR
[1 mark]
Describe the difference between a local variable and a global variable. [2 marks]
Explain why a function is used instead of a procedure when a calculated result is needed. [2 marks]
📝 Exam Practice 10 min
These questions span the whole of Unit 2. Match your answer to the command word and the marks.
Calculate the value of 29 DIV 6 and the value of 29 MOD 6.
Mark scheme
29 DIV 6 = 4(1).29 MOD 6 = 5(1).
Complete the missing condition so the loop stops once count reaches 10.
01 count ← 0 02 WHILE ____________ 03 count ← count + 1 04 ENDWHILE
Mark scheme
count < 10(1). Acceptcount ≠ 10/count <= 9.
Describe the difference between a procedure and a function.
Mark scheme
- A function returns a value to the line that called it (1).
- A procedure carries out a task but does not return a value (1).
A field accepts a percentage from 0 to 100. Give one normal, one boundary and one erroneous test value.
Mark scheme
- Normal: any value clearly inside the range, e.g.
57(1). - Boundary: a value on the edge, e.g.
0or100(1). - Erroneous: a value that should be rejected, e.g.
-1or150(1).
An array names holds ["Ali", "Bo", "Chen"]. State the value of names[2].
Mark scheme
"Chen"(1) — arrays index from 0, so index 2 is the third element.
Recap & Key Terms 3 min
Use your mini-paper marks to plan tonight's revision.
- Muddled the data types or operators? Redo CS-L2-01 and CS-L2-02.
- Tripped on selection or iteration? Redo CS-L2-03 and CS-L2-04.
- Unsure on DIV / MOD or string handling? Redo CS-L2-05.
- Lost on arrays or records? Redo CS-L2-06 — remember arrays index from 0.
- Mixed up procedures and functions? Redo CS-L2-09 and learn scope.
- Slipped on validation or test data? Redo CS-L2-13 and CS-L2-14.
- Variable
- A named store whose value can change while the program runs.
- Constant
- A named store whose value is fixed and cannot change while the program runs.
- Selection
- Choosing between paths with a decision — written as
IF … THEN … ELSE … ENDIF. - Iteration
- Repeating steps with a count-controlled (
FOR) or condition-controlled (WHILE) loop. - DIV
- Integer division — the whole number of times one value divides another.
- MOD
- The remainder left after integer division.
- Array
- An ordered collection of items of the same type, accessed by an index from 0.
- Record
- A structure that groups related fields of possibly different types.
- Procedure
- A named subroutine that carries out a task but does not return a value.
- Function
- A named subroutine that returns a value with
RETURN. - Parameter
- A value passed into a subroutine so it can work on different data.
- Local variable
- A variable that exists only inside the subroutine where it is declared.
- Global variable
- A variable that can be used anywhere in the program.
- Validation
- Checking input is sensible, e.g. with a range, length, presence or format check.
- Authentication
- Confirming a user's identity, for example with a username and password.
- Test data
- Values chosen to test a program: normal, boundary and erroneous.
Homework 1 min
Task (≤ 15 min): Revisit your weakest topic from the mini-paper. Open that lesson and redo its Exam Practice section.
Bring one question you still find hard to the next session, so we can work through it together.