Algorithm Header and Structure

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

Algorithm Header and Structure

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which is the correct first line of a VCAA maths pseudocode algorithm?
A Algorithm: find the total
B algorithm: find the total
2. What punctuation mark must follow the word Algorithm in a VCAA maths pseudocode header?
A A dash — Algorithm - name
B A colon — Algorithm: name
3. In a VCAA maths pseudocode algorithm, where does the input statement appear?
A After the processing and print statements
B After the Algorithm header, before processing
4. Which keywords wrap the body of a VCE Software Development pseudocode algorithm?
A Begin ... End
B Start ... Finish
5. Can a VCAA maths pseudocode algorithm have a second Algorithm: header inside its body?
A No — each algorithm is a separate independent unit
B Yes — nested Algorithm headers are allowed

Match the Pairs

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

Left columnRight column
1Algorithm: find the larger input a, b if a > b then print a AWrong — the Algorithm header requires a colon: `Algorithm: find the sum`. Without the colon the header does not follow VCAA pseudocode convention
2Begin result <- a + b Print result End BA complete VCE Software Development pseudocode algorithm: Begin opens the body, statements are indented inside, and End closes it
3The Algorithm: header must be the first line of a VCAA maths pseudocode algorithm and uses a capital A and a colon CWrong — the keyword must have a capital A: `Algorithm: find total`. Lowercase `algorithm` does not follow VCAA convention
4In VCE Software Development pseudocode, Begin opens and End closes the algorithm body; all statements inside are indented DAlgorithm: compute average input x, y average <- (x + y) / 2 print average
5algorithm: find total input a, b total <- a + b EA complete VCAA maths pseudocode algorithm: Algorithm header names it, input collects values, then processing and output follow in order
6Algorithm find the sum input a, b print a + b FBegin score <- x * 10 Print score End

Definitions

Algorithm:

Fill in the Blanks

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

1.
_________: calculate area input l, w area <- l * w
2.
Algorithm: ____ the total input a, b total <- a + b
3.
Algorithm: check age _____ age if age >= 18 then
4.
_____ total <- a + b Print total End
5.
Begin result <- x * 2 Print result ___

Spot the Error

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

Question 1
A algorithm: find maximum
B input a, b
C print a
Question 2
A Algorithm find the sum
B input a, b
C total <- a + b
D print total
Question 3
A Algorithm: compute product
B product <- p * q
C input p, q
D print product
Question 4
A Algorithm: show double
B input n
C result <- n * 2
D print result
E Algorithm: check value
Question 5
A Begin
B area <- l * w
C Print area
D Finish

Answer Key

Algorithm Header and Structure
Section A: Quick Questions
Q1
A — Algorithm: find the total
Q2
B — A colon — Algorithm: name
Q3
B — After the Algorithm header, before processing
Q4
A — Begin ... End
Q5
A — No — each algorithm is a separate independent unit
Section B: Match the Pairs
Q1
Algorithm: find the larger input a, b if a > b then print a → A complete VCAA maths pseudocode algorithm: Algorithm header names it, input collects values, then processing and output follow in order
Q2
Begin result <- a + b Print result End → A complete VCE Software Development pseudocode algorithm: Begin opens the body, statements are indented inside, and End closes it
Q3
The Algorithm: header must be the first line of a VCAA maths pseudocode algorithm and uses a capital A and a colon → Algorithm: compute average input x, y average <- (x + y) / 2 print average
Q4
In VCE Software Development pseudocode, Begin opens and End closes the algorithm body; all statements inside are indented → Begin score <- x * 10 Print score End
Q5
algorithm: find total input a, b total <- a + b → Wrong — the keyword must have a capital A: `Algorithm: find total`. Lowercase `algorithm` does not follow VCAA convention
Q6
Algorithm find the sum input a, b print a + b → Wrong — the Algorithm header requires a colon: `Algorithm: find the sum`. Without the colon the header does not follow VCAA pseudocode convention
Section C: Definitions
Q1
Algorithm: — The required header keyword that names a VCAA maths pseudocode algorithm. Written as Algorithm: followed by a descriptive name, it must appear as the first line before input or processing
Section D: Fill in the Blanks
Q1
Algorithm: calculate area input l, w area <- l * w
Q2
Algorithm: find the total input a, b total <- a + b
Q3
Algorithm: check age input age if age >= 18 then
Q4
Begin total <- a + b Print total End
Q5
Begin result <- x * 2 Print result End
Section E: Spot the Error
Q1
A — The keyword `algorithm` must have a capital A in VCAA pseudocode. The correct header is `Algorithm: find maximum`. Line 0 is wrong.
Q2
A — The Algorithm header requires a colon after the keyword: `Algorithm: find the sum`. Without the colon the header does not follow VCAA convention. Line 0 is wrong.
Q3
B — `product <- p * q` appears before `input p, q`. The variables p and q have not been given values yet. Input must come before any processing that uses those variables. Line 1 is wrong.
Q4
E — A second Algorithm header cannot appear inside the body of an existing algorithm. Each named algorithm is a separate independent unit. Line 4 is wrong.
Q5
D — In VCE Software Development pseudocode, the closing keyword is `End`, not `Finish`. The body opened with `Begin` must be closed with `End`. Line 3 is wrong.