Question 4(b) 2019 · October-November · Paper 21 · 7 marks
Reveal official mark-scheme answer
Official answer for Question 4
Part (b)
Question 7
Show text version of question
Question 4
Part (b)
Question 4
A student is developing a program to count how many times each character of the alphabet (A to Z)
occurs in a given string. Upper case and lower case characters will be counted as the same. The string may contain non-alphabetic characters, which should be ignored.
The program will:
- check each character in the string to count how many times each alphabetic character occurs
- store the count for each alphabetic character in a 1D array
- output each count together with the corresponding character.
Part (b)
Write pseudocode to implement the program.
You should note the following:
- InString contains the string to be checked. It has been assigned a value.
- The elements of the array Result have all been initialised to zero.
- The ASCII value of letter ‘A’ is 65.
You should assume the following lines of pseudocode have been written:
DECLARE InString : STRING DECLARE Result : ARRAY [1:26] OF INTEGER
Declare any further variables you use. Do not implement the code as a subroutine.
Refer to the Appendix on pages 16–17 for the list of built-in functions and operators.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Question 10
Why this question appears here
82% 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 9608_w19_qp_21.pdf
