topic badge
AustraliaVIC
VCE 11 Methods 2023

11.05 Algorithms in code

Worksheet
Algorithms in code
1

Determine the value that is printed at the end of the following pseudocodes:

a
\text{START}\\ \text{SET } a=73\\ \text{SET } b=44\\ \text{SET } c=a+b\\ \text{PRINT } c \\ \text{END}
b
\text{START}\\ \text{SET } a=26\\ \text{SET } b=11\\ \text{SET } c=a*b\\ \text{PRINT } c \\ \text{END}
c
\text{START}\\ \text{SET } a=2\\ \text{SET } b=a * a * a\\ \text{PRINT } b \\ \text{END}
d
\text{START}\\ \text{SET } a=1\\ \text{SET } b=3\\ \text{SET } c=a \land b\\ \text{PRINT } c \\ \text{END}
e
\text{START}\\ \text{SET } a=11\\ \text{SET } b=18 \\ \text{IF } a>=b\\ \qquad \text{THEN PRINT } a\\ \text{ELSE PRINT } b\\ \text{END IF} \\ \text{END}
f
\text{START}\\ \text{SET } a=7\\ \text{SET } b=5 \\ \text{SET } m=(a+b)\,/\,2 \\ \text{PRINT } m\\ \text{END}
g
\text{START}\\ \text{SET } a=4\\ \text{SET } b=3 \\ \text{SET } c=9 \\\text{SET } d=a+b*c\\ \text{PRINT } d\\ \text{END}
h
\text{START}\\ \text{SET } a=78\\ a=a+73 \\ \text{PRINT } a\\ \text{END}
2

What statement is printed at the end of the following pseudocode?

\text{START}\\ \text{SET } a=8\\ \text{IF } a\,/\,2 \text{ IS integer}\\ \qquad \text{THEN PRINT } "a \text{ is even}"\\ \text{ELSE PRINT} "a \text{ is odd}"\\ \text{END IF }\\ \text{END}

3

Consider the following pseudocode with steps in the wrong order:

StepCode
A\text{ SET } a=2
B\text{ END}
C\text{ SET b=3}
D\text{ PRINT } a+b
E\text{ START}
a

Arrange the steps of the algorithm in the correct order.

b

What is printed at the end of the code?

4

Consider the following pseudocode:

a

What does the code calculate?

A

Volume

B

Units

C

Area

D

Perimeter

b

What is the output of this code?

\text{START}\\ \text{SET } W=3\\ \text{SET } L=6\\ \text{SET } A=W*L\\ \text{PRINT } A\,"\text{m}^2"\\\text{END}

5

Consider the following pseudocode:

a

What does the code calculate?

A

Volume

B

Units

C

Area

D

Perimeter

b

What is the output of this code?

\text{START}\\ \text{SET } W=7\\ \text{SET } L=9\\ \text{SET } P=2*W+2*L\\ \text{PRINT } P\,"\text{m}"\\\text{END}

Sign up to access Worksheet
Get full access to our content with a Mathspace account

Outcomes

U12Out2.4

key elements of algorithm design: sequencing, decision-making, repetition and representation including the use of pseudocode.

What is Mathspace

About Mathspace