Pseudocode as a design method

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

Pseudocode as a design method

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which statement about pseudocode is correct?
A It follows set rules but does not need to run on a computer
B It must be compiled before a computer can run it
2. What does pseudocode mainly show?
A The logic of the design
B The exact syntax of one programming language
3. Which is a difference between pseudocode and a programming language?
A Pseudocode must follow exact syntax so a computer can run it
B A programming language must follow exact syntax so a computer can run it
4. A student writes pseudocode that has the right logic but a small spelling slip in a keyword. Which matters more?
A The exact spelling of every keyword
B The logic of the algorithm
5. In a Cambridge 0478 exam, which line is written in the expected pseudocode style?
A OUTPUT "Hello"
B print("Hello")

Match the Pairs

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

Left columnRight column
1pseudocode APseudocode does not need to run on a computer. It is for planning the logic of an algorithm, so small syntax slips matter less than clear logic.
2OUTPUT "Hello" BTotal ← Price * Quantity
3Pseudocode shows the logic of a design, so the same idea can later be written in any programming language CIF Score >= 50 THEN OUTPUT "Pass" ENDIF
4Pseudocode follows Cambridge 0478 style rules, such as capital-letter keywords and the arrow for assignment Dprint() is Python syntax, so it is a programming language, not Cambridge pseudocode. Pseudocode should use OUTPUT "Hello" instead.
5print("Hello") // thinking this is pseudocode EA Cambridge-style pseudocode line that shows a message to the user, written with a capital-letter keyword
6Pseudocode must be typed into a compiler and run without errors FA structured, code-like way of writing an algorithm that follows set rules but does not need to run on a computer

Definitions

pseudocode

Fill in the Blanks

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

1.
OUTPUT "Enter a number" _____ Num OUTPUT Num * 2
2.
IF Score >= 50 ____ OUTPUT "Pass" ENDIF
3.
INPUT Price Total _ Price * 3 OUTPUT Total
4.
FOR Count ← 1 __ 5 OUTPUT Count NEXT Count
5.
__ Calculate the area of a rectangle Area ← Length * Width OUTPUT Area

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 Mark
D Total = Total + Mark
E OUTPUT Total
Question 2
A INPUT Age
B IF Age >= 16 THEN
C OUTPUT Allowed
D ENDIF
Question 3
A DECLARE Score : NUMBER
B INPUT Score
C OUTPUT Score * 2
Question 4
A INPUT Count
B Total ← 0
C FOR i ← 1 UNTIL Count
D INPUT Num
E Total ← Total + Num
F NEXT i
Question 5
A WHILE Password <> "abc"
B INPUT Password
C ENDWHILE

Answer Key

Pseudocode as a design method
Section A: Quick Questions
Q1
A — It follows set rules but does not need to run on a computer
Q2
A — The logic of the design
Q3
B — A programming language must follow exact syntax so a computer can run it
Q4
B — The logic of the algorithm
Q5
A — OUTPUT "Hello"
Section B: Match the Pairs
Q1
pseudocode → A structured, code-like way of writing an algorithm that follows set rules but does not need to run on a computer
Q2
OUTPUT "Hello" → A Cambridge-style pseudocode line that shows a message to the user, written with a capital-letter keyword
Q3
Pseudocode shows the logic of a design, so the same idea can later be written in any programming language → IF Score >= 50 THEN OUTPUT "Pass" ENDIF
Q4
Pseudocode follows Cambridge 0478 style rules, such as capital-letter keywords and the arrow for assignment → Total ← Price * Quantity
Q5
print("Hello") // thinking this is pseudocode → print() is Python syntax, so it is a programming language, not Cambridge pseudocode. Pseudocode should use OUTPUT "Hello" instead.
Q6
Pseudocode must be typed into a compiler and run without errors → Pseudocode does not need to run on a computer. It is for planning the logic of an algorithm, so small syntax slips matter less than clear logic.
Section C: Definitions
Q1
pseudocode — A structured, code-like way of writing an algorithm that follows set rules but does not need to run on a computer. It shows the logic of a design, not exact programming syntax.
Section D: Fill in the Blanks
Q1
OUTPUT "Enter a number" INPUT Num OUTPUT Num * 2
Q2
IF Score >= 50 THEN OUTPUT "Pass" ENDIF
Q3
INPUT Price Total ← Price * 3 OUTPUT Total
Q4
FOR Count ← 1 TO 5 OUTPUT Count NEXT Count
Q5
// Calculate the area of a rectangle Area ← Length * Width OUTPUT Area
Section E: Spot the Error
Q1
D — Cambridge pseudocode uses the assignment arrow ← to store a value in a variable. The = sign is used for comparisons. It should be Total ← Total + Mark.
Q2
C — Text to be displayed must be written as a string in double quotes. Without quotes, Allowed looks like a variable. It should be OUTPUT "Allowed".
Q3
A — Cambridge pseudocode only uses the data types INTEGER, REAL, CHAR, STRING and BOOLEAN. NUMBER is not one of them. It should be DECLARE Score : INTEGER.
Q4
C — A count-controlled loop in pseudocode uses the keyword TO between the start and end values. UNTIL belongs to REPEAT loops. It should be FOR i ← 1 TO Count.
Q5
A — A WHILE loop header must end with the keyword DO so the structure is complete. It should be WHILE Password <> "abc" DO.