Past-paper question · 2016 October-November · Paper 41 · Q1(c)(i)

Question 1(c)(i) 2016 · October-November · Paper 41 · 2 marks

Original past-paper question for 1(C)(I)
Original past-paper question for 1(C)(I)
Original past-paper question for 1(C)(I)
Original past-paper question for 1(C)(I)
Original past-paper question for 1(C)(I)
Original past-paper question for 1(C)(I)
Reveal official mark-scheme answer Official mark-scheme answer for 1(C)(I)

Official answer for Question 1

Part (c)

(i)

Part (c)

(i)

1 mark per bullet to max 2:

[2]
  • The attributes can only be accessed in the class
  • Properties are needed to get/set the data // It provides/uses encapsulation
  • Increase security/integrity of attributes

Mark scheme 9608_w16_ms_41.pdf →

Show text version of question

Question 1

Part (c)

(i)

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

(i)

Describe the effects of declaring the SafetyDepositBox properties as private.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

......................................................................................................................................

[2]
Topic relevance

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

Keep practising this topic