Coding Sheets, Practice & Learning Support: Translating Between Flowcharts And Pseudocode (Copy)
Translating Between Flowcharts And Pseudocode
Purpose Of This Sheet
- Helps students convert accurately between:
- Flowcharts → Pseudocode
- Pseudocode → Flowcharts
- This skill is tested in:
- Algorithm design questions
- “Convert the following…” questions
- Logic explanation questions
- Marks are awarded for:
- Correct logic
- Correct structure
- Correct sequencing (not drawing skill)
Core Examiner Rule (Critical)
- Flowcharts and pseudocode must represent the same logic
- Any mismatch = logic error
- Symbols and statements must map one-to-one
Standard Flowchart Symbols And Their Meaning
| Flowchart Symbol | Meaning | Pseudocode Equivalent |
|---|---|---|
| Oval | Start / End | START / END |
| Parallelogram | Input / Output | INPUT / OUTPUT |
| Rectangle | Process | Assignment / Calculation |
| Diamond | Decision | IF / WHILE condition |
| Flow line | Direction | Execution order |
Flowchart → Pseudocode: Basic Translation Rules
Rule 1: START / END
- Flowchart:
- Oval labelled START / END
- Pseudocode:
START
...
END
Rule 2: Input / Output
- Flowchart:
- Parallelogram: “Enter number”
- Pseudocode:
INPUT number
Rule 3: Process Box
- Flowchart:
- Rectangle: “total = total + num”
- Pseudocode:
total ← total + num
Rule 4: Decision Diamond
- Flowchart:
- Diamond with Yes / No branches
- Pseudocode:
IF condition THEN
...
ELSE
...
ENDIF
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 AS Level Computer Science Full Scale Course
Translating Simple Sequential Flowchart → Pseudocode
Flowchart Description
- Start
- Input length and width
- Calculate area
- Output area
- End
Correct Pseudocode
START
INPUT length
INPUT width
area ← length * width
OUTPUT area
END
Translating Selection (IF) Flowchart → Pseudocode
Flowchart Logic
- Input mark
- If mark ≥ 50:
- Output “Pass”
- Else:
- Output “Fail”
Correct Pseudocode
INPUT mark
IF mark >= 50 THEN
OUTPUT "Pass"
ELSE
OUTPUT "Fail"
ENDIF
Examiner Tip
- Every decision diamond becomes:
- One IF
- Possibly one ELSE
- Never skip ELSE if flowchart shows two exits
Translating Loop Flowcharts → Pseudocode
Case 1: WHILE Loop (Entry-Controlled)
Flowchart Pattern
- Decision at top
- Loop body only executes if condition TRUE
Pseudocode Translation
WHILE condition DO
statements
ENDWHILE
Example Flowchart Logic
- Input x
- While x > 0:
- Output x
- x ← x – 1
Correct Pseudocode
INPUT x
WHILE x > 0 DO
OUTPUT x
x ← x - 1
ENDWHILE
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 AS Level Computer Science Full Scale Course
Case 2: REPEAT UNTIL Loop (Exit-Controlled)
Flowchart Pattern
- Loop body executes first
- Condition checked at bottom
Pseudocode Translation
REPEAT
statements
UNTIL condition
Example Flowchart Logic
- Input num
- Add to total
- Repeat until num = -1
Correct Pseudocode
total ← 0
REPEAT
INPUT num
IF num <> -1 THEN
total ← total + num
ENDIF
UNTIL num = -1
OUTPUT total
Examiner Tip
- REPEAT UNTIL condition must describe when to stop
- Do not write invalid condition here
Translating FOR Loop Flowcharts → Pseudocode
Flowchart Pattern
- Initialisation
- Condition
- Increment step
- Loop body
Pseudocode Translation
FOR i ← start TO end
statements
NEXT i
Example Flowchart Logic
- For i = 1 to 5
- Output i
Correct Pseudocode
FOR i ← 1 TO 5
OUTPUT i
NEXT i
Flowchart With Counting Logic → Pseudocode
Flowchart Logic
- Input numbers
- If number > 10:
- Increment count
- Repeat 8 times
- Output count
Correct Pseudocode
count ← 0
FOR i ← 1 TO 8
INPUT num
IF num > 10 THEN
count ← count + 1
ENDIF
NEXT i
OUTPUT count
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 AS Level Computer Science Full Scale Course
Pseudocode → Flowchart: Translation Strategy
Step-by-Step Method
- Identify:
- INPUT / OUTPUT
- PROCESS
- DECISIONS
- Place:
- START at top
- END at bottom
- Convert:
- IF → Decision diamond
- WHILE → Decision at top
- REPEAT → Decision at bottom
- Follow execution order exactly
Translating IF–ELSE Pseudocode → Flowchart
Pseudocode
INPUT age
IF age >= 18 THEN
OUTPUT "Allowed"
ELSE
OUTPUT "Not Allowed"
ENDIF
Flowchart Structure (Text Description)
- Start
- Input age
- Decision: age ≥ 18?
- Yes → Output “Allowed”
- No → Output “Not Allowed”
- End
Translating WHILE Loop Pseudocode → Flowchart
Pseudocode
i ← 1
WHILE i <= 3 DO
OUTPUT i
i ← i + 1
ENDWHILE
Flowchart Structure
- Start
- Set i ← 1
- Decision: i ≤ 3?
- Yes → Output i → Increment i → Back to decision
- No → End
Translating REPEAT UNTIL Pseudocode → Flowchart
Pseudocode
REPEAT
INPUT num
UNTIL num = 0
Flowchart Structure
- Start
- Input num
- Decision at bottom: num = 0?
- No → Loop back
- Yes → End
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 AS Level Computer Science Full Scale Course
Common Translation Mistakes (High-Frequency)
Mistake 1: Reversing Condition Logic
- Writing:
UNTIL num <> 0
- When flowchart shows stop at num = 0
Mistake 2: Missing Initialisation Box
- Variables used before being set
Mistake 3: Extra Decision Diamonds
- Adding logic not present in pseudocode
Mistake 4: Forgetting Loop Back Arrows
- Loop executes only once incorrectly
Examiner-Approved Keywords (Use In Explanations)
- “The decision diamond represents the IF condition”
- “The loop continues while the condition remains true”
- “Execution flows back to the decision”
- “The exit condition is checked at the bottom”
Flowchart ↔ Pseudocode Mapping Table (Fast Recall)
| Concept | Flowchart Position | Pseudocode |
|---|---|---|
| IF | Middle (branch) | IF / ELSE |
| WHILE | Top of loop | WHILE |
| REPEAT | Bottom of loop | REPEAT UNTIL |
| Counter update | Process box | count ← count + 1 |
| Sentinel check | Decision | UNTIL value = sentinel |
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 AS Level Computer Science Full Scale Course
Exam-Ready Translation Checklist
- Does every flowchart symbol have a pseudocode equivalent?
- Are conditions written exactly (not reversed)?
- Is the loop entry/exit position correct?
- Are all inputs and outputs included?
- Does the execution order match?
Master Translation Templates
Flowchart → Pseudocode
START
INPUT
PROCESS
IF condition THEN
PROCESS
ELSE
PROCESS
ENDIF
OUTPUT
END
Pseudocode → Flowchart (Logic Order)
- START
- INPUT
- PROCESS
- DECISION
- LOOP / BRANCH
- OUTPUT
- END
