Dry Runs, Tracing & Logic Control: Predicting Output Questions And Mark Allocation (Copy)
Predicting Output Questions And Mark Allocation (Cambridge Standard – O Level 2210 + IGCSE 0478)
Why Predicting Output Questions Are High-Scoring In Paper 2
- Predicting output questions test:
- Dry run accuracy
- Understanding of execution order
- Correct handling of loops, selection, arrays, and procedures
- These questions are:
- Directly linked to tracing skills
- Often broken into multiple method-mark steps
- Cambridge expects:
- Logical execution, not intuition
- Correct intermediate reasoning, not just final output
What Cambridge Means By “Predict The Output”
- You are required to:
- Execute the algorithm exactly as written
- Using the given inputs
- And state what is OUTPUT at the specified points
- OUTPUT statements:
- Report values at that exact moment
- Do not change any variable
Where Predicting Output Questions Appear
- Short-answer questions (2–4 marks)
- Section B structured parts
- Pre-release follow-up questions
- Combined with:
- Loops
- Arrays
- Conditional logic
- Procedures or functions
Typical Command Words Used
- “State the output”
- “Determine the output”
- “What is displayed?”
- “What is printed?”
- “Give the output produced”
All require:
- Exact values
- Correct order
- No extra explanation unless asked
Core Principle: Output Depends On Execution Point
- Output reflects:
- Current values at the exact OUTPUT line
- If OUTPUT is:
- Inside a loop → multiple outputs
- Outside a loop → single output
- If variables change later:
- They do not affect earlier outputs
Step 1: Identify All OUTPUT Statements Before Tracing
Before any dry run:
- Underline every OUTPUT statement
- Note:
- Whether it is inside or outside loops
- Whether it is conditional
This determines:
- Number of outputs
- Order of outputs
Step 2: Understand Cambridge Mark Allocation Logic
Cambridge typically allocates marks as follows:
| Aspect | Typical Marks |
|---|---|
| Correct execution logic | 1 |
| Correct intermediate value(s) | 1 |
| Correct final output | 1 |
| Correct order of outputs | 1 |
This means:
- Even if final output is wrong
- Partial marks are awarded for correct steps
Simple Output Prediction Example (No Loops)
Algorithm
- x ← 3
- y ← x + 4
- OUTPUT y
- x ← y * 2
- OUTPUT x
Correct Output
- First OUTPUT: 7
- Second OUTPUT: 14
Mark Allocation (Typical 2 Marks)
- 1 mark for OUTPUT y = 7
- 1 mark for OUTPUT x = 14
Output Prediction With FOR Loops
Algorithm
- total ← 0
- FOR i ← 1 TO 3
- total ← total + i
- OUTPUT total
- ENDFOR
Dry Run
| i | total | OUTPUT |
|---|---|---|
| 1 | 1 | 1 |
| 2 | 3 | 3 |
| 3 | 6 | 6 |
Final Output Sequence
- 1, 3, 6
Examiner Expectation
- All outputs listed
- In correct order
- No commas replaced with spaces incorrectly (format matters)
Written and Compiled By Sir Hunain Zia (AYLOTI), World Record Holder With 154 Total A Grades, 7 Distinctions and 11 World Records For Educate A Change O Level And IGCSE Computer Science Full Scale Course
Output Prediction With IF Statements
Algorithm
- score ← 48
- IF score >= 50 THEN
- OUTPUT “Pass”
- ELSE
- OUTPUT “Fail”
- ENDIF
Output
- Fail
Mark Allocation
- 1 mark for correct branch
- 1 mark for correct output
Examiner Trap
- Writing both outputs
- Ignoring ELSE logic
Output Prediction With Arrays
Algorithm
- DECLARE marks[1:4]
- marks ← [10, 20, 30, 40]
- FOR i ← 2 TO 4
- OUTPUT marks[i]
- ENDFOR
Output Sequence
- 20, 30, 40
Examiner Focus
- Correct index range
- Inclusive FOR loop
- Correct order
Output Prediction When Arrays Are Updated
Algorithm
- values ← [5, 12, 8]
- FOR i ← 1 TO 3
- IF values[i] < 10 THEN
- values[i] ← values[i] + 5
- ENDIF
- OUTPUT values[i]
- IF values[i] < 10 THEN
- ENDFOR
Dry Run
| i | values before | values after | OUTPUT |
|---|---|---|---|
| 1 | 5 | 10 | 10 |
| 2 | 12 | 12 | 12 |
| 3 | 8 | 13 | 13 |
Final Output
- 10, 12, 13
Examiner Trap
- Outputting original values instead of updated ones
Written and Compiled By Sir Hunain Zia (AYLOTI), World Record Holder With 154 Total A Grades, 7 Distinctions and 11 World Records For Educate A Change O Level And IGCSE Computer Science Full Scale Course
Output Prediction With WHILE Loops
Algorithm
- count ← 1
- WHILE count <= 3 DO
- OUTPUT count
- count ← count + 1
- ENDWHILE
Output
- 1, 2, 3
Examiner Focus
- Correct termination
- No extra output after count = 3
Output Prediction With REPEAT UNTIL
Algorithm
- x ← 5
- REPEAT
- OUTPUT x
- x ← x – 1
- UNTIL x = 2
Dry Run
- OUTPUT 5 → x = 4
- OUTPUT 4 → x = 3
- OUTPUT 3 → x = 2
- Condition TRUE → stop
Output
- 5, 4, 3
Examiner Trap
- Including 2
- Treating UNTIL like WHILE
Output Prediction With Nested Loops
Algorithm
- FOR i ← 1 TO 2
- FOR j ← 1 TO 3
- OUTPUT i * j
- ENDFOR
- FOR j ← 1 TO 3
- ENDFOR
Output Order
- 1, 2, 3, 2, 4, 6
Mark Allocation
- 1–2 marks for correct sequence
- Partial credit if pattern correct but one value wrong
Written and Compiled By Sir Hunain Zia (AYLOTI), World Record Holder With 154 Total A Grades, 7 Distinctions and 11 World Records For Educate A Change O Level And IGCSE Computer Science Full Scale Course
Output Prediction With Procedures And Functions
Function Example
- FUNCTION double(x)
- RETURN x * 2
- ENDFUNCTION
- OUTPUT double(4)
Output
- 8
Procedure Example
- PROCEDURE show(x)
- OUTPUT x
- ENDPROCEDURE
- CALL show(5)
Output
- 5
Examiner Trap
- Assuming procedure returns a value
- Ignoring RETURN keyword in functions
How Cambridge Awards Partial Marks
Cambridge may award marks for:
- Correct number of outputs
- Correct order but one wrong value
- Correct logic but arithmetic slip
- Correct tracing but final transcription error
You lose all marks only when:
- Output is completely random
- Execution logic is clearly wrong
Common Output Prediction Errors (High Penalty)
- Missing outputs inside loops
- Writing extra outputs
- Wrong order of outputs
- Using original array values after update
- Incorrect loop bounds
- Confusing WHILE and REPEAT logic
Fast Exam Strategy For Output Questions
- Underline OUTPUT statements first
- Write a mini trace table
- Track only changing variables
- Write outputs as they occur
- Do not jump to final result
- Double-check loop boundaries
Examiner Checklist Before Writing Final Output
- Did I list all outputs?
- Are they in correct order?
- Are updated values used correctly?
- Did I stop loops correctly?
- Did I ignore non-executed branches?
Final Quality Checklist
- Outputs traced line-by-line
- No skipped iterations
- Correct execution order
- Correct final values
- Correct formatting
Final Lock-In Rules
- OUTPUT reflects current state only
- Order matters as much as value
- Loops multiply outputs
- Updates affect future outputs
- Predicting output correctly = easy Paper 2 marks
