Past-paper question · 2019 October-November · Paper 22 · Q4(b)

Question 4(b) 2019 · October-November · Paper 22 · 6 marks

Original past-paper question for 4(B)
Original past-paper question for 4(B)
Original past-paper question for 4(B)
Original past-paper question for 4(B)
Reveal official mark-scheme answer Official mark-scheme answer for 4(B)

Official answer for Question 4

Part (b)

Question 2

independent marks for each test:

Question 6

✓
Test 1
✓
MaxVol: 0/49
✓
VolLevel expected: 49
✓
Test 2
✓
VolLevel before: 34
✓
VolLevel expected: 34
✓
Test 3
✓
Parameter: 20
✓
VolLevel expected: 0
✓
9608/22
✓
Cambridge International AS/A Level – Mark Scheme
✓
October/November
✓
PUBLISHED
✓
2019
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_w19_ms_22.pdf →

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.

A
value that can be set to limit the maximum value of VolLevel,

in order to protect the user’s hearing. MaxVol

A
value in the range 1 to 49 indicates the volume limit.
A
value of zero indicates that no volume limit has been set.

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(): ..................

[6]

Question 11

Topic relevance

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

Keep practising this topic