Six original Cambridge-style questions on library routines in 0478 pseudocode, with mark points.
State what is returned by the library routines DIV and MOD.
State the value returned by: (a) DIV(29, 4) (b) MOD(29, 4) (c) ROUND(29 / 4, 0) (d) ROUND(12.3456, 2)
Write pseudocode that inputs a number of seconds and outputs it as minutes and seconds, using DIV and MOD.
INPUT Seconds ✓Mins ← DIV(Seconds, 60) and Secs ← MOD(Seconds, 60) ✓OUTPUT Mins, " minutes ", Secs, " seconds" ✓Write a statement that stores a random whole number from 1 to 100 in the variable Target. Explain why your expression cannot give 0 or 101.
Target ← ROUND(RANDOM() * 99, 0) + 1 ✓Write pseudocode that inputs a whole number and outputs "Even" or "Odd".
INPUT Number ✓IF MOD(Number, 2) = 0 ✓THEN OUTPUT "Even" ELSE OUTPUT "Odd" with ENDIF ✓A student tests whether Number is even with IF Number / 2 = 0. Explain why this does not work and correct it.
IF MOD(Number, 2) = 0. ✓Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.