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

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

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

Official answer for Question 2

Part (a)

(i)

Part (a)

(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 DenaryDigit(Letter :
✓
CHAR) : INTEGER;
✓
BEGIN
✓
CASE Letter OF
✓
'K': DenaryDigit :=
✓
0;
✓
'D': DenaryDigit :=
✓
1;
✓
'L': DenaryDigit :=
✓
2;
✓
'C': DenaryDigit :=
✓
3;
✓
'F': DenaryDigit :=
✓
4;
✓
'H': DenaryDigit :=
✓
5;
✓
'B': DenaryDigit :=
✓
6;
✓
'G': DenaryDigit :=
✓
7;
✓
'E': DenaryDigit :=
✓
8;
✓
'A': DenaryDigit :=
✓
9;
✓
ELSE
✓
DenaryDigit:= -1
✓
END;
✓
END;
✓
[max 5]

Mark scheme 9691_w15_ms_23.pdf →

Show text version of question

Question 2

Part (a)

(i)

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

(i)

Write the program code to implement the function DenaryDigit from its flowchart

design. Use 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_23.pdf

Keep practising this topic