Question 2(c)(iii) 2015 · October-November · Paper 23 · 10 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (c)
(iii)
(iii)
1 mark per line of pseudocode correctly written in the high-level language chosen.
Show text version of question
Question 2
Part (c)
(iii)
Question 2
Alia received a number coded as a sequence of letters. She wants to write a program to change
this sequence of letters back to the original number. She knows that each digit of the original number was replaced by exactly one letter. The letters used are shown in the flowchart below.
She has drawn the flowchart as part of the design for her solution.
The function DenaryDigit(Letter) returns an integer.
FUNCTION DenaryDigit(Letter)
CASE OF 'K' Letter Value 0
ELSE 'D' Value 1
'L' Value 2
'C' Value 3
Value –1 'F' Value 4
'H' Value 5
'B' Value 6
'G' Value 7
'E' Value 8
'A' Value 9
RETURN Value
ENDFUNCTION
Question 7
(iii)
Write program code to implement the pseudocode given in part (b).
Remember to declare variables before you use them.
The code is repeated here so that you do not need to turn back to part (b):
PROCEDURE ConvertToDenary(CodedNumber : STRING)
Denary ← 0
FOR i ← 1 TO LENGTH(CodedNumber) ThisChar ← MID(CodedNumber, i, 1) ThisNumber ← DenaryDigit(ThisChar) Denary ← Denary + (ThisNumber * 10) ENDFOR
OUTPUT Denary ENDPROCEDURE
Programming Language ....................................................................................................
Code ..................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.....................................................................................................................................[10]
Question 11
Why this question appears here
82% assigned-topic match · Data types and structures › Data types and records
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 9691_w15_qp_23.pdf
