Question 3(a) 2018 · May-June · Paper 22 · 3 marks
Reveal official mark-scheme answer
Official answer for Question 3
Part (a)
Question 3
Question 5
Question 7
Question 12
Question 12
Question 6
Question 2
Question 4
Question 4
Question 4
Question 3
Question 12
Question 12
Question 7
Question 8
Show text version of question
Question 3
Part (a)
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 (a)
Complete the trace table for the input data:
* 5, 7, +, 6, 2, –, 4, 3, , 7, 8, ?, 0, 0, /
Number1 Number2 Sign Answer OUTPUT
Why this question appears here
98% 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
