topic badge
CanadaON
Grade 9

11.04 Loops in code

Interactive practice questions

Look at the pseudocode below:

START
SET a = 2
SET sum = 0
WHILE a < 9
    sum = sum + a
    a = a + 1
END WHILE
PRINT sum
END
a

The initial value of a is $\editable{}$.

b

What is the OUTPUT of this code?

OUTPUT: $\editable{}$

Easy
3min

Look at the pseudocode below:

Easy
2min

Look at the pseudocode below:

Note that the symbol / represents division.

Easy
3min

Look at the pseudocode below, and determine the value that is printed at the end of the code:

Note that the symbol > represents the statement 'greater than'.

Easy
< 1min
Sign up to access Practice Questions
Get full access to our content with a Mathspace account

Outcomes

9.C2.1

Use coding to demonstrate an understanding of algebraic concepts including variables, parameters, equations, and inequalities.

9.C2.2

Create code by decomposing situations into computational steps in order to represent mathematical concepts and relationships, and to solve problems.

9.C2.3

Read code to predict its outcome, and alter code to adjust constraints, parameters, and outcomes to represent a similar or new mathematical situation.

What is Mathspace

About Mathspace