2023 JPJC P1 Question Paper
Uploaded by Kozak327 · 8 September 2026
Preview
Text from the first pagesName:____________________________________ Class:_____________ JURONG PIONEER JUNIOR COLLEGE 2023 JC2 Preliminary Examination COMPUTING 9569/01 Higher 2 14 September 2023 Paper 1 (Written) 3 hours Additional materials: 12-page Answer Booklet Cover Page READ THESE INSTRUCTIONS FIRST Answer all the questions. Approved calculators are allowed. You are reminded of the need for clear presentation in your answers. Answer papers will be provided with the question paper. Write your name and civics class on all the work that you hand in. Write in dark blue or black pen on both sides of the paper. You may use an HB pencil for any diagrams or graphs. Do not use staples, paper clips, glue or correction fluid. Answer all the questions. Write your answers to every question on a fresh page of paper. Approved calculators are allowed. The number of marks is given in brackets [ ] at the end of each question or part question. The total number of marks for this paper is 100. This document consists of 10 printed pages. [Turn over
2 1 Students from the Robotics Club of a school learn to program robots and drones to perform tasks. The club wants to use Object-oriented Programming to model the robots and drones. For every robot, the following data is recorded: x coordinate y coordinate For the robot, it can move forward, backward, left and right by a given distance. Moving left and right will increase or decrease the x coordinate, while moving forward and backwards will increase or decrease the y coordinate, we can get its attributes, and display its location in cartesian coordinates (x, y), its attributes cannot be set directly. For a drone, which can be considered a flying robot, its z coordinate is also recorded. For the drone, it can move up and down by a given distance, in addition to moving in the directions a robot can. Moving up and down will increase or decrease the z coordinate, we can get its attributes, and display its location in cartesian coordinates (x, y, z), its attributes cannot be set directly. (a) For the situation described above, draw a class diagram that shows the following: suitable classes with appropriate properties and methods inheritance polymorphism [6] (b) Explain the following by using an example from the situation described above: (i) encapsulation (ii) inheritance (iii) polymorphism [2] [2] [2]
3 2 The Green Harvest agricultural cooperative is on a mission to harness technology for efficient farm management. They are planning to develop an integrated computerised data management system to effectively store and manage information related to: • Farmers, • Crops, and • Harvest Records. A relational database management system (RDBMS) will be implemented to create this integrated system. • Each farmer will be uniquely identified by their farmerID. • Each crop will have a distinctive cropID. The cropID will follow a specific format, starting with 'C' to indicate a crop, followed by two digits representing the crop type, a hyphen, and additional digits signifying the crop's specific identifier. (a) Explain the roles and purposes of (i) a primary key, and (ii) a foreign key. As part of this integrated system, a module for recording harvest activities will be introduced to allow farmers to digitally log their crop harvests. • The system will enforce strict validation to prevent duplicate entries for the same crop in a single harvest record. • When a farmer successfully records a harvest, a harvest record will be generated. • Each harvest record will include the harvest date and will link a farmer to the specific crop harvested. • For example, a farmer who records harvests for three different crops will result in the creation of three separate harvest records. • The system will also capture any relevant details related to farmers and crops. You are appointed to be the lead programmer to develop the integrated system. (b) Differentiate between data redundancy and data inconsistency within this context. [4] [4] [Turn over
4 (c) Explain how unresolved data redundancy can lead to update anomalies and ultimately result in inconsistent data. (d) The table description can be expressed as follows: TableName(Attribute1, Attribute2, Attribute3, ...) The primary key is indicated by underlining one or more attributes and the foreign key is annotated with an asterisk ‘*’. Using the provided data model, create fully normalized table descriptions for the following tables: (i) Farmer, and Crop, suggesting two additional attributes most appropriate for each table. (ii) HarvestRecord, considering that no additional unique keys will be generated by the system to differentiate records in HarvestRecord. (e) Draw an entity-relationship (ER) diagram illustrating the essential three tables and the relationships between them. [2] [9] [6]
5 3 A binary tree can be implemented using an array of nodes, where each node contains an item Data, and two integer pointers LeftPtr and RightPtr, pointing to the array index of the left and right nodes respectively. A pointer Root indicates the index of the root node. The following shows the conceptual diagram of the binary tree BT. Binary tree BT BT(pointer) returns the node stored at the location pointer in the array of the binary tree BT. A value of -1 in the pointer indicates NULL. (a) Procedure X is written to operate on the global binary tree, BT. The procedure has a single integer parameter, CurrPtr. The pseudocode for procedure X is as follows, PROCEDURE X(CurrPtr) IF CurrPtr <> -1 X(BT(CurrPtr).LeftPtr) PRINT(BT(CurrPtr).Data) X(BT(CurrPtr).RightPtr) ENDIF ENDPROCEDURE (i) Write down the output of X(Root) in the order they were printed. (ii) State the purpose of procedure X. [2] [1] A B C D E F [Turn over G Root
6 (b) Using pseudocode, write a function to count the number of nodes in the global binary tree BT including the root node and return an integer sum. The function header is as follows: FUNCTION Count(CurrPtr) RETURNS INTEGER The function will be called using Count(Root). [5] 4 The Fibonacci numbers are the integers in the following sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55… The following pseudocode is a recursive function that returns the n th term of a Fibonacci sequence. You may assume n is larger or equals to zero. FUNCTION Fib(n: INTEGER) RETURNS INTEGER IF n = 0 THEN RETURN 0 ENDIF RETURN Fib(n-1) + Fib(n-2) ENDFUNCTION (a) By analysing the provided pseudocode, identify, and explain one potential issue. Suggest an improvement to the pseudocode to address the issue. (b) Design a set of three test cases to test the Fib function. Explain why each test case is important and what it checks. (c) Write the descriptive algorithm of an iterative solution to find the nth term of a Fibonacci sequence, where n is larger or equals to zero. [3] [3] [5]
7 5 The merge sort algorithm is used to sort some integers of an array. The pseudocode is given as follows. PROCEDURE MergeSort(arr: ARRAY, left: INTEGER, right: INTEGER) IF left < right mid ← left + INTEGER((right - left) / 2) MergeSort(arr, left, mid) MergeSort(arr, mid + 1, right) Merge(arr, left, mid, right) ENDIF ENDPROCEDURE // main CALL MergeSort(arr, 0, 5) It is given
Content continues in the PDF. Download PDF
Related notes
- 2024 ACJC Computing PromoExam Papers · 2024
- 2023 ACJC Promo QPExam Papers · 2023
- 2022 ACJC Computing Promo Paper 2Exam Papers · 2022
- 2021 ACJC Computing Promo Paper 2Exam Papers · 2021
- 1992 AJC Computing QPExam Papers · 1992
- 2023 YIJC P2 Question PaperExam Papers · 2023
- 2023 YIJC P1 Question PaperExam Papers · 2023
- 2023 RVHS P2 CombinedExam Papers · 2023
- 2023 RI P2 Question PaperExam Papers · 2023
- 2023 RI P1 Question PaperExam Papers · 2023
- 2023 NYJC-VJC-TJC P2 Question PaperExam Papers · 2023
- 2023 NJC P2 Question PaperExam Papers · 2023
- See all H2 Computing notes

