Pseudocode, flowcharts and program code

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Pseudocode, flowcharts and program code

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which is true about pseudocode?
A It is a planning format for an algorithm, not tied to one programming language
B It is a real programming language that a computer can run directly
2. A Paper 2 question says 'Write an algorithm in pseudocode'. Which answer is correct?
A Use the Cambridge pseudocode format, e.g. total ← total + 1
B Use Python, e.g. total = total + 1
3. Which Paper 2 question allows you to answer in Python, Visual Basic or Java?
A Any question that asks for an algorithm
B The 15-mark scenario question
4. Which of these is a valid choice of language for the 15-mark scenario question?
A Java
B C++
5. Which line is written in Cambridge pseudocode?
A for count in range(1, 11):
B FOR Count ← 1 TO 10

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1total ← total + mark AIF mark >= 50 THEN OUTPUT "Pass" ELSE OUTPUT "Fail" ENDIF
2total = total + mark BThe keywords are in lower case, but Cambridge pseudocode needs IF, THEN, OUTPUT and ENDIF in upper case. Precision matters.
3Pseudocode keywords must be written in upper case in the Cambridge format CIF mark >= 50 THEN
4A flowchart shows a decision as a diamond with Yes and No branches, matching an IF in pseudocode DPython's print() is program code. Paper 2 answers must use pseudocode such as OUTPUT, except the 15-mark question, which allows Python, VB or Java.
5if mark >= 50 then output "Pass" endif EPseudocode: the Cambridge assignment arrow stores a new value in the variable
6print("Pass") in a Paper 2 pseudocode answer FProgram code (such as Python): the equals sign is used for assignment

Definitions

pseudocode

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
Total _ 0
2.
______ Total
3.
_____(Total)
4.
IF Score ≥ 50 THEN OUTPUT "Pass" _____
5.
if Score >= 50_ print("Pass")

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A DECLARE Total : INTEGER
B Total = 0
C INPUT Score
D Total ← Total + Score
E OUTPUT Total
Question 2
A INPUT Age
B if Age >= 16 THEN
C OUTPUT "Allowed"
D ENDIF
Question 3
A total = 0
B for n in range(5):
C total ← total + n
D print(total)
Question 4
A # Add two numbers
B INPUT A
C INPUT B
D OUTPUT A + B
Question 5
A Total ← 0
B FOR Count ← 1 TO 5
C Total ← Total + Count
D ENDFOR
E OUTPUT Total

Answer Key

Pseudocode, flowcharts and program code
Section A: Quick Questions
Q1
A — It is a planning format for an algorithm, not tied to one programming language
Q2
A — Use the Cambridge pseudocode format, e.g. total ← total + 1
Q3
B — The 15-mark scenario question
Q4
A — Java
Q5
B — FOR Count ← 1 TO 10
Section B: Match the Pairs
Q1
total ← total + mark → Pseudocode: the Cambridge assignment arrow stores a new value in the variable
Q2
total = total + mark → Program code (such as Python): the equals sign is used for assignment
Q3
Pseudocode keywords must be written in upper case in the Cambridge format → IF mark >= 50 THEN
Q4
A flowchart shows a decision as a diamond with Yes and No branches, matching an IF in pseudocode → IF mark >= 50 THEN OUTPUT "Pass" ELSE OUTPUT "Fail" ENDIF
Q5
if mark >= 50 then output "Pass" endif → The keywords are in lower case, but Cambridge pseudocode needs IF, THEN, OUTPUT and ENDIF in upper case. Precision matters.
Q6
print("Pass") in a Paper 2 pseudocode answer → Python's print() is program code. Paper 2 answers must use pseudocode such as OUTPUT, except the 15-mark question, which allows Python, VB or Java.
Section C: Definitions
Q1
pseudocode — Cambridge's fixed format for planning an algorithm before it is written as program code. Paper 2 answers must use it, except the 15-mark question, which allows Python, VB or Java.
Section D: Fill in the Blanks
Q1
Total ← 0
Q2
OUTPUT Total
Q3
print(Total)
Q4
IF Score ≥ 50 THEN OUTPUT "Pass" ENDIF
Q5
if Score >= 50: print("Pass")
Section E: Spot the Error
Q1
B — Cambridge pseudocode assigns a value with the arrow ←, not =. The line should be Total ← 0.
Q2
B — Pseudocode keywords must be written in upper case. The line should start with IF, not if.
Q3
C — This is Python, which is allowed in the 15-mark question. Python uses = for assignment. The arrow ← belongs only in pseudocode. It should be total = total + n.
Q4
A — A comment in Cambridge pseudocode starts with //. The # symbol is Python comment style. It should be // Add two numbers.
Q5
D — A pseudocode FOR loop is closed with NEXT followed by the loop variable, not ENDFOR. The line should be NEXT Count.