Question 1(c)(ii) 2016 · October-November · Paper 41 · 2 marks
Reveal official mark-scheme answer
Official answer for Question 1
Part (c)
(ii)
(ii)
1 mark per bullet
- The public methods can be called anywhere in the main program // Public methods
- The private methods can only be called within the class definition // cannot be called
Show text version of question
Question 1
Part (c)
(ii)
Question 1
A user can lock a safety deposit box by inputting a 4-digit code. The user can unlock the box with
the same 4-digit code.
There is a keypad on the door of the safety deposit box. The following diagram shows the keys on the keypad.
1 2 3
4 5 6
7 8 9
R 0 Enter
Initially, the safety deposit box door is open and the user has not set a code.
The operation of the safety deposit box is as follows:
A) To set a new code the door must be open. The user chooses a 4-digit code and sets it by pressing the numerical keys on the keypad, followed by the Enter key. Until the user clears this code, it remains the same. (See point E below) B) The user can only close the door if the user has set a code. C) To lock the door, the user closes the door, enters the set code and presses the Enter key. D) To unlock the door, the user enters the set code. The door then opens automatically. E) The user clears the code by opening the door and pressing the R key, followed by the Enter key. The user can then set a new code. (See point A above)
The following state transition table shows the transition from one state to another of the safety deposit box:
Current state Event Next state Door open, no code set 4-digit code entered Door open, code set Door open, code set R entered Door open, no code set Door open, code set Close door Door closed Door closed Set code entered Door locked Door locked Set code entered Door open, code set Door locked R entered Door locked
Question 3
It is possible to declare properties and methods as either public or private.
The programmer has modified the class design for SafetyDepositBox as follows:
SafetyDepositBox PRIVATE Code : STRING State : STRING PUBLIC Create() StateChange() PRIVATE Reset() SetState() SetNewCode()
(ii)
Describe the effects of declaring two methods of the class as public and the other three
as private.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
......................................................................................................................................
Question 10
Why this question appears here
82% assigned-topic match · Hardware › Logic gates and logic circuits
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_w16_qp_41.pdf
