Data types can be defined using pseudocode. The data type, BuildingRecord, is defined in pseudocode as: TYPE BuildingRecord DECLARE BuildingID : INTEGER DECLARE BuildingGroup : STRING DECLARE OwnerName : STRING DECLARE BuildingAddress : STRING DECLARE DateLastSold : DATE DECLARE PriceLastSold : REAL ENDTYPE A variable, BuildingRegister, is declared in pseudocode as: DECLARE BuildingRegister : BuildingRecord
- (a)Write pseudocode statements to assign: • • 1067 to the BuildingID of BuildingRegister house to the BuildingGroup of BuildingRegister[2]
- (b)(i)Write the type declaration for BuildingType in pseudocode.[2]
- (b)(ii)Write the new declaration for BuildingGroup in pseudocode.[1]
- (b)(iii)Write the new pseudocode statement to assign house to BuildingGroup of BuildingRegister.[1]
- (c)(i)Write the declaration in pseudocode for OwnerName as PRIVATE.[1]
- (c)(ii)Explain why the properties have been set to PRIVATE.[2]
Mark scheme
Marking points from the official mark scheme (May/June 2022). The mark or mark type is shown in brackets.
- [2] BuildingRegister.BuildingID ← 1067 BuildingRegister.BuildingGroup ← "house"
- [2] One mark: TYPE BuildingType = One mark: (house, bungalow, apartment, farm) TYPE BuildingType = (house, bungalow, apartment, farm)
- [1] DECLARE BuildingGroup : BuildingType
- [1] BuildingRegister.BuildingGroup ← house
- [1] PRIVATE OwnerName : STRING
- [2] To ensure that attributes can only be accessed by the class's own methods To enforce encapsulation // ensure they are hidden
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →