Past-paper question · 2015 October-November · Paper 22 · Q2(a)(i)

Question 2(a)(i) 2015 · October-November · Paper 22 · 5 marks

Original past-paper question for 2(A)(I)
Original past-paper question for 2(A)(I)
Reveal official mark-scheme answer

Official answer for Question 2

Part (a)

(i)

(i)

Mark as follows:

✓
–
✓
parameter
✓
–
✓
Return data type
✓
–
✓
Correctly formed CASE statement (including the end)
✓
–
✓
with all cases present (characters in quotes)
✓
–
✓
ELSE clause
✓
–
✓
Return of value (implied)
✓
Example PASCAL:
✓
FUNCTION NumeralValue(Letter :
✓
CHAR) : INTEGER;
✓
BEGIN
✓
CASE Letter OF
✓
'M': NumeralValue :=
✓
1000;
✓
'D': NumeralValue :=
✓
500;
✓
'C': NumeralValue :=
✓
100;
✓
'L': NumeralValue :=
✓
50;
✓
'X': NumeralValue :=
✓
10;
✓
'V': NumeralValue :=
✓
5;
✓
'I': NumeralValue :=
✓
1;
✓
ELSE
✓
NumeralValue := -1;
✓
END;
✓
END;
✓
[max 5]

Mark scheme 9691_w15_ms_22.pdf →

Show text version of question

Question 2

Part (a)

(i)

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

(i)

Write program code to convert the flowchart into the function NumeralValue, using a

high-level programming language.

Programming Language ....................................................................................................

Code ..................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

.......................................................................................................................................[5]

Topic relevance

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

Keep practising this topic