JPJC 2025 H2 Computing Prelim Paper 1 solutions
Uploaded by Kozak327 · 24 August 2026
Preview
Text from the first pagesJPJC 2025 H2 Computing Year-End Exam Paper 1 Marking Scheme 2. JRide – Object-Oriented Modelling (Suggested Answers) (a) Class diagram description (6 marks) • Attributes are properties belonging to an instance (i.e.: object) of a class. • Distance and fare are not properties of Vehicle object. • The question did not mention rate and basefare stored in the system. However, if you were to include them, then rate would be in the Vehicle class (inherited by both Car and Motorbike) while basefare would be in the Car class. • Fare is calculated using the calcFare() method. • Methods such as getFare() are interpreted as an assessor method. Vehicle driverName: String registrationNum: String maxCapacity: Integer rate: Float //optional Constructor() calcFare(): Float Motorbike Constructor() calcFare(): Float Car basefare: Float //optional Constructor() calcFare(): Float
JPJC 2025 H2 Computing Year-End Exam Paper 1 1m – Car and Motorbike child classes with correct arrows 2m – Polymorphism calcFare() in both child classes 1m – Attributes in Vehicle parent class 1m – calcFare() method in Vehicle parent class 1m – No additional attribute in child classes (b) Introducing Driver class – describe update (3 marks) Describe questions must be answered in proper sentence and paragraph(s). No mark awarded if only a new class diagram is drawn. 1m – Add class Driver with attributes: name:String, licenceNo:String, yearsExperience:Int. 1m – Replace Vehicle.driverName with Vehicle.driver where the attribute is a Driver object. 1m – Vehicle and Driver classes share a HAS-A association. For example: A new class Driver should be introduced with the attributes name, licenceNo, and yearsExperience. In the Vehicle class, the existing attribute driverName should be replaced with driver, where driver is an object of the Driver class. This modification establishes a HAS -A relationship between Vehicle and Driver.
JPJC 2025 H2 Computing Year-End Exam Paper 1 (c) Encapsulation (2 marks) 1m – Encapsulation is used to hide the values or state of a structured data object inside a class, preventing unauthorized parties’ direct access to them. 1m – Publicly accessible methods are generally provided in the class (so -called getters/ accessors and setters/ modifiers) to access the values, and other client classes call these methods to retrieve and modify the values within the object. OR 1m – Encapsulation is also known as information hiding because it hides specific information and control access to the internal state of the object. 1m – Attributes of a class will be hidden from other classes and can be accessed/ modified only through its accessor/ modifier methods. (d) Applying encapsulation here (2 marks) 1m – Choose an appropriate attribute to be kept private. 1m – Must use the get/ set methods to retrieve or modify the data. For example: Encapsulation can be applied by making attributes such as maxCapacity private. For Car, provide a public setter for maxCapacity that validates input (capacity ≤ 7). For Motorbike, make the setter for maxCapacity private since it must always be 1, preventing external modification. OR The method calculateFare(distance) is public while the rates and base fee remain private within Car and Motorbike classes. Clients can compute fares, using the public method, without knowing the formula details.
JPJC 2025 H2 Computing Year-End Exam Paper 1 3. e ‑Assessment Portal – Digital Signatures and Firewall (Suggested Answers) (a) Digital signature explanation in this context (5 marks) 1m per bullet Creating the Signature: • Hash the spreadsheet using a cryptographic algorithm/ hash function. • Encrypt the hash with the teacher’s private key to create the digital signature. • Upload the spreadsheet together with the signature and the teacher’s certificate. Verifying the Signature: • Portal hashes the received spreadsheet and uses the teacher’s public key (from the certificate or key registry) to decrypt the signature. • If the decrypted hash matches the newly computed hash, authenticity and integrity are confirmed; otherwise, reject. (b) One key difference (1 mark) Encryption provides confidentiality (hides content). A digital signature provides authenticity/integrity (proves who signed it and that it was not altered).
JPJC 2025 H2 Computing Year-End Exam Paper 1 (c) Firewall policy (2 marks) Any two points, 1m each Network Firewall: • Allow only HTTPS traffic from the Internet to the e -Assessment portal, blocking all other types of connections. • Restrict administrative access to specific permitted IP addresses from the IT office. • Actively block IP addresses flagged for malicious activity and apply basic traffic controls to prevent overload. Software (Host) Firewall: • On the server itself, allow inbound connections only for the web service and block all other ports. Web Application Firewall (WAF): • Filter and inspect all web requests to block common web attacks such as injections or cross-site scripting. • For spreadsheet uploads, accept only valid file types and sizes, scan for malware.
JPJC 2025 H2 Computing Year-End Exam Paper 1 4. BST of Locker IDs + Circular Queue (Suggested Answers) (a) Build & In‑order (3 marks) i. BST shape 1m – root 1m – rest of the nodes ii. In‑order output: 12, 18, 35, 42, 50, 60, 63, 70, 72 (b) Recursive InOrder(root) (3) no mark for wrong sequence PROCEDURE InOrder(node) IF node <> NULL THEN //1m InOrder(node.left) //1m OUTPUT node.key //1m InOrder(node.right) //1m ENDIF ENDPROCEDURE 42 18 12 35 60 50 70 63 72
JPJC 2025 H2 Computing Year-End Exam Paper 1 ii. Iterative BST_Search 1m per step 1. Start at the root node and set it as the current node. 2. While the current node is not empty: (1m) • If the search key k is equal to the key stored in the current node, return True (key found). • If k is less than the key in the current node, use the left pointer (which references the left child node) to move to the left child. Otherwise, use the right pointer (which references the right child node) to move to the right child. 3. If the search reaches an empty node, return False (key not found in the tree). (c) Worst‑case time complexity (2 marks) 1m – The worst case is the BST is skewed, and the key is not found. 1m – Leading to O(n) time complexity. (d) Why BST over a sorted linear array (2 marks) 1m – Balanced BST gives O(log n) search and supports O(log n) insert/delete. 1m – An ordered array also has O(log n) for binary search but O(n) insertion/deletion due to its contiguous nature. Hence, BST is preferred since its allocation and deallocation of locker ids are more efficient.
JPJC 2025 H2 Computing Year-End Exam Paper 1 (e) Circular queue pseudocode (6 marks) – capacity 50 FUNCTION DEQUEUE(PASS BY REF: Q, head: INT) RETURNS INT //1m IF head = -1 THEN //1m OUTPUT "QUEUE IS EMPTY" RETURN -1 //1m ENDIF val ← Q[head] //1m head ← (head + 1) MOD 50 //1m RETURN val //1m ENDFUNCTION (f) One advantage of a circular queue (2marks) 1m – Circular queue enables wrap around 1m -which reuses the empty space after an item has been dequeued.
JPJC 2025 H2 Computing Year-End Exam Paper 1 5. Smart Thermostat – Static vs Dynamic Memory (Suggested Answers) (a) Cause of the recurring problem (3 marks) 1m – A dynamic data structure is used for HISTORY, which grows continuously as a new record is added during every loop, eventually exceeding the available memory space. 1m - DISPLAY_BUFFER is initialised in each cycle, and if the previous buffer is not deallocated or reused, these abandoned buffers accumulate in memory. Over months, this can lead to excessive memory use, increased fragmentation, (b) How to change the algorithm (2 marks) 1m – To
Content continues in the PDF. Download PDF
Related notes
- JPJC 2024 JC2 Prelim Paper 2 QPExam Papers · 2024
- JPJC 2024 JC2 Prelim Paper 2 MS v2Exam Papers · 2024
- JPJC 2024 JC2 Year-End Exam H2 Computing Paper 1Exam Papers · 2024
- JPJC 2024 JC2 Year-End Exam H2 Computing Paper 1 Marking SchemeExam Papers · 2024
- 2024 ASR H2 Computing Prelim P1 SolExam Papers · 2024
- 2024 ASR H2 Computing Prelim P1 QnsExam Papers · 2024
- 2025 VJC H2 Computing Prelim Paper 1Exam Papers · 2025
- 2025 VJC H2 Computing Prelim Paper 1 SolutionsExam Papers · 2025
- 2025 TJC H2 Computing Prelim Paper 1 SolutionsExam Papers · 2025
- RVHS 2025 H2 Computing Prelim Paper 1Exam Papers · 2025
- RVHS 2025 H2 Computing Prelim Paper 1 SolutionsExam Papers · 2025
- RI 2025 H2 Computing Prelim Paper 1Exam Papers · 2025
- See all H2 Computing notes

