Question 3(b) 2018 · May-June · Paper 22 · 3 marks
Reveal official mark-scheme answer
Official answer for Question 3
Part (b)
Question 3
Show text version of question
Question 3
Part (b)
Question 3
This pseudocode algorithm inputs two non-zero numbers and a sign, and then performs the
calculation shown by the sign. An input of zero for the first number terminates the process.
INPUT Number1, Number2, Sign WHILE Number1 <> 0 IF Sign = '+' THEN Answer Number1 + Number2 ENDIF IF Sign = '-' THEN Answer Number1 - Number2 ENDIF IF Sign = '*' THEN Answer Number1 * Number2 ENDIF IF Sign = '/' THEN Answer Number1 / Number2 ENDIF IF Sign <> '/' AND Sign <> '*' AND Sign <> '-' AND Sign <> '+' THEN Answer 0 ENDIF IF Answer <> 0 THEN OUTPUT Answer ENDIF INPUT Number1, Number2, Sign ENDWHILE
Part (b)
Show how you could improve the algorithm written in pseudocode by writing an alternative
type of conditional statement in pseudocode.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
Question 9
Why this question appears here
83% assigned-topic match · Algorithm design and problem-solving
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 2210_s18_qp_22.pdf
