Write a sequence with assignments
Arrange statements in order so each calculation uses values that have already been assigned.
Exam scope and assessment notes
This sequence follows Cambridge IGCSE Computer Science 0984, 2026–2028 syllabus Version 4. It covers section 8.1 (Programming concepts) only. Pseudocode examples use the published Cambridge format; the separate 2029–2031 syllabus is not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers, a browser-based programming workspace and human subject-teacher review remain outstanding. Cambridge states that 0984 has the same 2026–2028 subject content as 0478, with 9–1 grading. In June and November, Cambridge lists 0984 in Administrative zone 3 and for centres in Oman and the UAE. Confirm availability for your centre and exam series with Cambridge International. The separately published 2029–2031 syllabus changes to Python 3 only and removes pseudocode; this 2026–2028 route does not cover those changes.
Before you begin
- Be comfortable following an ordered algorithm and tracing variable values. Each lesson introduces the Cambridge pseudocode form it uses.
Work on paper. Try each question before revealing help, and explain why your method works.
Quick readiness check
If A is 3, what does A ← A + 1 do?
What you will learn
- Trace statements in sequence
- Use ← to assign a value
- Update variables without confusing old and new values
Sequence is the order statements run
A computer follows statements from top to bottom unless a selection or loop changes the flow. Each assignment takes effect before the next statement runs.
For example, Total ← Price * Quantity must come after both inputs have values. A later OUTPUT can then display the calculated Total.
An assignment changes the variable on its left
The arrow ← means store the evaluated expression on the right in the variable on the left. The expression can use the variable's current value.
When tracing, write down the value after every assignment. This avoids treating an update such as Counter ← Counter + 1 as an equation to solve.
Pause and explain
Which statement sets Price before calculating Cost = Price × Quantity?
Worked example
Trace A ← 4; B ← A + 3; A ← B * 2; OUTPUT A, B.
Show the worked solution
- A receives 4.
- B receives the current A plus 3, so B becomes 7.
- A is then updated to 14; B remains 7.
Answer The output is 14, 7 because assignments run in sequence and B keeps its earlier value.
Try a topic test
Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.
Test this topic →From guided practice to a new situation
Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.
Trace X ← 6; Y ← X * 2; X ← X - 1. Give the final values.
Give me a hint
Record each assignment before moving to the next line.
Compare my reasoning
- Set X to 6.
- Use that value to set Y to 12.
- Reduce X by one; Y is unchanged.
X = 5 and Y = 12.
Look for these in your work
- Order followed
- Both final values correct
Write a sequence to calculate the total price for 4 items at a price stored in UnitPrice.
Give me a hint
Multiply the unit price by the number of items after UnitPrice is available.
Compare my reasoning
- Declare Quantity and Total as numeric variables.
- Set Quantity ← 4.
- Set Total ← UnitPrice * Quantity.
Quantity ← 4; Total ← UnitPrice * Quantity.
Look for these in your work
- Quantity set
- Multiplication correct
A program sets Balance ← 30; Deposit ← 10; Balance ← Balance + Deposit. Explain the final balance and why.
Give me a hint
Follow the last assignment using the current Balance.
Compare my reasoning
- Balance starts at 30.
- Deposit is set to 10.
- The last statement stores 30 + 10 in Balance.
Balance is 40; the final assignment updates the existing value using Deposit.
Look for these in your work
- Starting values traced
- Updated value explained
Common mistakes
- Treating assignment as a two-way equality
- Updating a variable before its first value is set
- Assuming a later change to A also changes an earlier copy in B
What can you explain now?
After X ← 5 followed by Y ← X + 2, what are X and Y?
Compare with the explanation
X is 5 and Y is 7
The second statement reads X's current value and stores 7 in Y.
After trying it yourself, choose your next review. This is your self-assessment.
Your review choice appears on Today. Sign in to sync it across devices.
Make it stick
How does a trace table help when several assignments update the same variable?
If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.