topic badge
CanadaON
Grade 7

15.07 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

7.C3.1

Solve problems and create computational representations of mathematical situations by writing and executing efficient code, including code that involves events influenced by a defined count and/or sub-program and other control structures.

7.C3.2

Read and alter existing code, including code that involves events influenced by a defined count and/or sub-program and other control structures, and describe how changes to the code affect the outcomes and the efficiency of the code.

What is Mathspace

About Mathspace