Skip to content

e. Extras

Control structures

9. How does a sequence differ from an iteration?


10. What is the difference between a WHILE iteration and a DO/WHILE iteration?


11. Mary writes some code to iterate over a set of data. It runs exactly once, but no conditions have been met. What types of iterations could Mary have written?


12. State the values that will be returned or displayed in the following examples of pseudocode:

a.

a ← 4
b ← 2
c ← 3
IF (a > c) OR (b > c) THEN
    RETURN True
ELSE
    RETURN False
ENDIF

b.

age ← 10
If age < 10 Then
    RETURN "Child"
ELSEIF age < 18 THEN
    RETURN "Teenager"
ELSE
    RETURN "Adult"
ENDIF