Question 4(b) 2019 · October-November · Paper 22 · 6 marks
Reveal official mark-scheme answer
Official answer for Question 4
Part (b)
Question 2
independent marks for each test:
Question 6
Show text version of question
Question 4
Part (b)
Question 4
A program is being written to control the operation of a portable music player. One part of the
program controls the output volume.
The player has two buttons, one to increase the volume and one to decrease it. Whenever a button is pressed, a procedure Button() is called with a parameter value representing the button as follows:
Button Parameter value
Volume increase 10
Volume decrease 20
For example, pressing the volume increase button three times followed by pressing the volume decrease button once would result in the calls:
CALL Button(10) // VolLevel increased by 1 CALL Button(10) // VolLevel increased by 1 CALL Button(10) // VolLevel increased by 1 CALL Button(20) // VolLevel decreased by 1
The program makes use of two global variables of type INTEGER as follows:
Variable Description VolLevel The current volume setting. This must be in the range 0 to 49.
in order to protect the user’s hearing. MaxVol
The procedure Button() will modify the value of VolLevel depending on which button has been pressed and whether a maximum value has been set.
Question 9
Part (b)
The procedure Button() is to be tested using black-box testing.
Fill in the gaps below to define three tests that could be carried out.
TEST 1 – VolLevel is changed
Parameter value: 10
MaxVol: ..................
VolLevel value before call to Button(): 48
VolLevel expected value after call to Button(): ..................
TEST 2 – VolLevel is not changed
Parameter value: 10
MaxVol: 34
VolLevel value before call to Button(): ..................
VolLevel expected value after call to Button(): ..................
TEST 3 – VolLevel is not changed
Parameter value: ..................
MaxVol: 40
VolLevel value before call to Button(): 0
VolLevel expected value after call to Button(): ..................
Question 11
Why this question appears here
71% 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_w19_qp_22.pdf
