Cambridge pseudocode: keywords in capitals and indentation

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

Cambridge pseudocode: keywords in capitals and indentation

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which line is written in correct Cambridge pseudocode style?
A INPUT Age
B input Age
2. Which line uses the keyword correctly?
A OUTPUT "Welcome"
B output "Welcome"
3. Which IF line follows Cambridge style?
A IF Score > 50 THEN
B if Score > 50 then
4. Where should the statement OUTPUT "Pass" go inside an IF ... ENDIF?
A At the left margin, level with IF
B Indented on its own line between IF and ENDIF
5. Which layout shows one statement per line?
A INPUT Name OUTPUT Name
B INPUT Name OUTPUT Name

Match the Pairs

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

Left columnRight column
1INPUT Age AThe OUTPUT statement inside the IF is not indented, so the structure is hard to read
2IF Score >= 50 THEN OUTPUT "Pass" ENDIF BOUTPUT "Hello"
3Keywords such as OUTPUT are written in capital letters in Cambridge pseudocode CINPUT is a keyword written in capital letters; it reads a value from the user into the variable Age
4Statements inside a loop are indented, with one statement on each line DThe statement inside the IF is indented, and IF, THEN, OUTPUT and ENDIF are all in capital letters
5input Name output Name EThe keywords INPUT and OUTPUT are written in lowercase; Cambridge pseudocode needs them in capital letters
6IF Age >= 18 THEN OUTPUT "Adult" ENDIF FFOR Count <- 1 TO 3 OUTPUT Count NEXT Count

Definitions

KEYWORDS IN CAPITALS

Fill in the Blanks

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

1.
_____ Age OUTPUT Age
2.
INPUT Name ______ Name
3.
__ Mark >= 50 THEN OUTPUT "Pass" ENDIF
4.
IF Mark >= 50 THEN OUTPUT "Pass" _____
5.
FOR Count ← 1 TO 3 OUTPUT Count ____ Count

Spot the Error

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

Question 1
A OUTPUT "Enter your age"
B input Age
C IF Age >= 18 THEN
D OUTPUT "Adult"
E ENDIF
Question 2
A INPUT Mark
B if Mark >= 50 THEN
C OUTPUT "Pass"
D ENDIF
Question 3
A INPUT Score
B IF Score > 90 THEN
C OUTPUT "Top"
D else
E OUTPUT "Keep going"
F ENDIF
Question 4
A Input Name
B OUTPUT "Hello " & Name
C OUTPUT "Welcome"
Question 5
A FOR Count ← 1 TO 3
B output "Hello"
C NEXT Count

Answer Key

Cambridge pseudocode: keywords in capitals and indentation
Section A: Quick Questions
Q1
A — INPUT Age
Q2
A — OUTPUT "Welcome"
Q3
A — IF Score > 50 THEN
Q4
B — Indented on its own line between IF and ENDIF
Q5
B — INPUT Name OUTPUT Name
Section B: Match the Pairs
Q1
INPUT Age → INPUT is a keyword written in capital letters; it reads a value from the user into the variable Age
Q2
IF Score >= 50 THEN OUTPUT "Pass" ENDIF → The statement inside the IF is indented, and IF, THEN, OUTPUT and ENDIF are all in capital letters
Q3
Keywords such as OUTPUT are written in capital letters in Cambridge pseudocode → OUTPUT "Hello"
Q4
Statements inside a loop are indented, with one statement on each line → FOR Count <- 1 TO 3 OUTPUT Count NEXT Count
Q5
input Name output Name → The keywords INPUT and OUTPUT are written in lowercase; Cambridge pseudocode needs them in capital letters
Q6
IF Age >= 18 THEN OUTPUT "Adult" ENDIF → The OUTPUT statement inside the IF is not indented, so the structure is hard to read
Section C: Definitions
Q1
KEYWORDS IN CAPITALS — Cambridge pseudocode writes keywords like INPUT, OUTPUT and IF in capital letters, puts one statement on each line, and indents the statements inside IF and loops.
Section D: Fill in the Blanks
Q1
INPUT Age OUTPUT Age
Q2
INPUT Name OUTPUT Name
Q3
IF Mark >= 50 THEN OUTPUT "Pass" ENDIF
Q4
IF Mark >= 50 THEN OUTPUT "Pass" ENDIF
Q5
FOR Count ← 1 TO 3 OUTPUT Count NEXT Count
Section E: Spot the Error
Q1
B — Cambridge pseudocode keywords must be written in capital letters. 'input' should be INPUT.
Q2
B — The keyword IF must be written in capitals. 'if' should be IF.
Q3
D — ELSE is a keyword, so it must be in capital letters. 'else' should be ELSE.
Q4
A — Keywords must be fully in capitals, not just start with a capital. 'Input' should be INPUT.
Q5
B — OUTPUT is a keyword inside the FOR loop and must be in capital letters. 'output' should be OUTPUT.