Question 6(b) 2018 · May-June · Paper 23 · 9 marks
Reveal official mark-scheme answer
Official answer for Question 6
Part (b)
Question 9
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
Question 7
Question 8
Question 9
Show text version of question
Question 6
Part (b)
Part (b)
A 2D array, Picture, contains data representing a bitmap image. Each element of the array
represents one pixel of the image. The image is grey-scale encoded where the value of each pixel ranges from 0 (representing black) to 255 (representing white) with intermediate values representing different levels of grey.
The following is an example of an image and the corresponding data values for the Picture array.
Bitmap image Values
In pseudocode, the array is declared as follows:
DECLARE Picture : ARRAY[1:8, 1:8] OF INTEGER
- take an integer parameter, MaxVal, to represent the maximum allowed value for each
- limit each pixel value to the maximum allowed value
- return TRUE if any of the pixel values have been changed, otherwise return FALSE
pixel
An example use of the function is:
IsClipped Clip(234)
This will limit the maximum pixel value within the array to 234. Pixels with a value not greater than 234 will remain unchanged.
Question 13
Write pseudocode to implement the Clip() function.
Assume that Picture is a global variable.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[9]
Question 14
Why this question appears here
82% assigned-topic match · Programming › Structured programming
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_s18_qp_23.pdf
