Pseudocode Writing Conventions

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

Pseudocode Writing Conventions

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which is the correct VCAA way to close an if block?
A end if
B endif
2. How many statements should appear on one line in VCAA pseudocode?
A One statement per line
B Multiple statements are fine
3. What does indentation show in VCAA pseudocode?
A Nothing — it is just a style preference
B That lines belong inside a nested block
4. Which correctly closes a for loop in VCAA pseudocode?
A end loop
B end for
5. Does VCAA pseudocode use semicolons to end statements?
A No — statements end at the end of the line
B Yes — semicolons are required

Match the Pairs

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

Left columnRight column
1end if AThe closing keyword for an if block in VCAA pseudocode; end is always followed by a space and the keyword that opened the block
2if temp > 30 then print "hot" else print "cold" end if Bx <- 5 y <- x + 1 print y
3One statement per line is a core VCAA pseudocode writing convention Cfor i from 1 to 5 print i end for
4Indentation shows which lines belong inside a nested block such as a loop or if statement DWrong — VCAA pseudocode requires one statement per line. Semicolons are not used. `x <- 5` and `print x` must each be on their own line
5if age > 18 then print "ok" endif EA snippet showing all three VCAA conventions: one statement per line, the body indented inside each block, and end if closing the construct
6x <- 5; print x if x > 0 then print "ok" end if FWrong — VCAA pseudocode writes this as two words: `end if`. The closing keyword always separates end from the block name with a space

Definitions

end if

Fill in the Blanks

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

1.
if score > 50 then print score ___ if
2.
while count < 10 print count end _____
3.
for i from 1 to 5 print i end ___
4.
if x > 5 ____ print x end if
5.
if a > b then print a end __

Spot the Error

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

Question 1
A if score > 50 then
B print score
C end if
Question 2
A x <- 5; print x
B if x > 0 then
C print "positive"
D end if
Question 3
A if age >= 18 then
B print "Adult"
C endif
Question 4
A if x > 5:
B print x
C end if
Question 5
A while count < 10
B print count
C count <- count + 1
D endwhile

Answer Key

Pseudocode Writing Conventions
Section A: Quick Questions
Q1
A — end if
Q2
A — One statement per line
Q3
B — That lines belong inside a nested block
Q4
B — end for
Q5
A — No — statements end at the end of the line
Section B: Match the Pairs
Q1
end if → The closing keyword for an if block in VCAA pseudocode; end is always followed by a space and the keyword that opened the block
Q2
if temp > 30 then print "hot" else print "cold" end if → A snippet showing all three VCAA conventions: one statement per line, the body indented inside each block, and end if closing the construct
Q3
One statement per line is a core VCAA pseudocode writing convention → x <- 5 y <- x + 1 print y
Q4
Indentation shows which lines belong inside a nested block such as a loop or if statement → for i from 1 to 5 print i end for
Q5
if age > 18 then print "ok" endif → Wrong — VCAA pseudocode writes this as two words: `end if`. The closing keyword always separates end from the block name with a space
Q6
x <- 5; print x if x > 0 then print "ok" end if → Wrong — VCAA pseudocode requires one statement per line. Semicolons are not used. `x <- 5` and `print x` must each be on their own line
Section C: Definitions
Q1
end if — A closing keyword in VCAA pseudocode that ends an if block; every nested construct uses end followed by its matching keyword: end if, end while, end for
Section D: Fill in the Blanks
Q1
if score > 50 then print score end if
Q2
while count < 10 print count end while
Q3
for i from 1 to 5 print i end for
Q4
if x > 5 then print x end if
Q5
if a > b then print a end if
Section E: Spot the Error
Q1
B — The body of an if block must be indented to show it is inside the block. Line 1 should be ` print score` with leading spaces. Line 1 is wrong.
Q2
A — VCAA pseudocode requires one statement per line. `x <- 5` and `print x` must each appear on their own separate line. Semicolons are not used in VCAA pseudocode. Line 0 is wrong.
Q3
C — The closing keyword must be written as two words: `end if`, not `endif`. VCAA pseudocode always separates end from the block keyword with a space. Line 2 is wrong.
Q4
A — VCAA pseudocode uses `if condition then`, not a colon. Colons are Python syntax and have no place in VCAA pseudocode. The correct line is `if x > 5 then`. Line 0 is wrong.
Q5
D — The closing keyword for a while loop must be written as two words: `end while`, not `endwhile`. VCAA pseudocode always separates end from the block keyword with a space. Line 3 is wrong.