Question 2(d) 2015 · October-November · Paper 22 · 4 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (d)
- 1)
Show text version of question
Question 2
Part (d)
Question 2
At the end of movies, when credits are listed, the year of production is often shown in Roman
numerals.
Roman numbers are formed by combining letters together and adding their value. The letters used and their values are:
M: 1000 D: 500 C: 100 L: 50 X: 10 V: 5 I: 1
For example, MMXV is 1000 + 1000 + 10 + 5 = 2015.
Ali wants to write a program to convert a year written in Roman numerals to denary.
He has drawn the flowchart as part of the design for his solution.
FUNCTION NumeralValue(Letter)
CASE Letter OF 'M' Value@1000 ELSE 'D' Value@500
'C' Value@100 Value@-1 'L' Value@50
'X' Value@10
'V' Value@5
'I' Value@1
RETURN Value
ENDFUNCTION
Question 7
Part (d)
The order of letters in Roman numbers is significant. Letters are placed from left to right, in
order of value, starting with the largest.
However, a sequence of four identical letters (such as IIII) is shortened as follows. If a letter to the left is of lower value than the letter to its right, the left letter’s value becomes negative. Examples are shown in the following table:
Roman number Shortened Roman number Interpretation Denary IIII IV -1 + 5 4 VIIII IX -1 + 10 9 XXXX XL -10 + 50 40 LXXXX XC -10 + 100 90 CCCC CD -100 + 500 400 DCCCC CM -100 + 1000 900
Ali has to amend his pseudocode to include the conversion of these shortened Roman numbers.
Ali has chosen some test data.
Complete the table.
RomanNumber Expected result Reason for choice "MDCLXVI" 1666 Each letter used once in descending order "CCC" 300 Multiple letters (but not 4 identical letters) "IIII" "IV" "XIV" "XY"
Why this question appears here
71% assigned-topic match · Programming › Constructs
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_22.pdf
