Question 7(b)(i) 2015 · October-November · Paper 22 · 8 marks
Reveal official mark-scheme answer

Official answer for Question 7
Part (b)
(i)
Part (b)
(i)
Use of correct identifiers only to score
Question 22
Show text version of question
Question 7
Part (b)
(i)
Question 7
ASCII character codes are used to represent a single character.
Part of the code table is shown below.
ASCII code table (part) Character Decimal Character Decimal Character Decimal <Space> 32 I 73 R 82
E 69 N 78 W 87 F 70 O 79 X 88 G 71 P 80 Y 89 H 72 Q 81 Z 90
Some pseudocode statements follow which use these built-in functions:
CHARACTERCOUNT(ThisString : STRING) RETURNS INTEGER returns the number of characters in the string ThisString. For example: CHARACTERCOUNT("South Africa") returns 12.
CHR(ThisInteger : INTEGER) RETURNS CHAR returns the character with ASCII value ThisInteger. For example: CHR(66) returns 'B'.
ASC(ThisCharacter : CHAR) RETURNS INTEGER returns the ASCII value for character ThisCharacter. For example: ASC('B') returns 66.
Study the following pseudocode:
OUTPUT "Enter message" INPUT MyMessage EncryptString "" ← FOR i ← 1 TO CHARACTERCOUNT(MyMessage) NextNum ← ASC(ONECHAR(MyMessage, i) + 3) EncryptString ← EncryptString & CHR(NextNum) ENDFOR
OUTPUT EncryptString
(i)
Write the above pseudocode algorithm as program code.
Visual Basic and Pascal: You should include the declaration statements for variables. Python: You should show a comment statement for each variable used with its data type.
Programming language .....................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.......................................................................................................................................[8]
Why this question appears here
91% assigned-topic match · Programming › Programming basics
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 9608_w15_qp_22.pdf
