(a) State the result of each expression.
(i) 17 MOD 5 [1]
(ii) 17 DIV 5 [1]
(iii) 2 ^ 4 [1]
(b) The code below uses iteration.
do
pin = input("Enter PIN")
until pin == "4821"State the type of iteration used. [1]
- 2(1)
- 3(1)
- 16(1)
- Condition-controlled (accept indefinite)(1)
- Answer: (a) 2, 3, 16; (b) condition-controlled
- Examiner tip: DIV gives the whole number of times 5 goes into 17 (3), and MOD gives what is left over (2). Don't swap them.