ACJC 2025 JC2 Computing Prelim Paper 1 Solutions
Uploaded by Kozak327 · 23 August 2026
Preview
1(i) Conditions Run 2.4 km in at most 12 min T T T T F F F F Do at least 50 push ups in 1 min T T F F T T F F Do at least 40 sit ups in 1 min T F T F T F T F Actions Gold member X Silver member X X Ordinary member X X X X X 1(ii) Conditions Run 2.4 km in at most 12 min T T T T F Do at least 50 push ups in 1 min T T F F - Do at least 40 sit ups in 1 min T F T F - Actions Gold member X Silver member X X Ordinary member X X 2(a) Students - Name (string) - DOB (string) + Constructor(Name, DOB) + get_name() + get_dob() + get_school_fee() Full-time Part-time - Address (string) - Phone_no (string) - Classes (list of strings) + get_address() + get_phone_no() + get_school_fee() + Constructor + get_classes() + get_school_fee() 2(b) Full-time and part-time classes inherit attributes (Name and DOB) and methods (accessor for Name and DOB) from Students parent class 2(c) The calculation of school fees is different for full-time and part-time students, but the get_school_fee() method can be used for both. This streamlines code that uses the school fee for other purposes. 2(d)( i) Data should be backed up as it is updated so that a copy of the data exists in case the main database is damaged or deleted by accident or due to malicious action. The data can then be recovered from the backup copy.
2(d)( ii) Data that is no longer needed on a day -to-day basis (e.g. students who have already graduated) should be archived. It can still be looked up if necessary, but the data does not clog up space in the curr ent database. 3(a) 21 3(b) 06: IF m MOD i = 0 AND n MOD i = 0 3(c) The function has a base case (line 02) and for other cases, it calls itself with smaller values (lin es 06 and 08). The function would thus keep calling itself until the base case is reached. 3(d) 3(e) Since m > n, when the function calls itself, m will be replaced by m – n, which is larger than m and is still positive. As a result m will keep getting larger with each function call. Hence, the function will end up calling itself infinitely many times (until the computer runs out of memory or the program terminates it) 3(f) 00 FUNCTION gcd(m, n : INTEGERS) RETURNS INTEGER 01 02 WHILE m != n 03 IF m > n THEN 04 m m – n 05 ELSE 06 n n – m 07 ENDIF 08 ENDWHILE gcd(21, 28) gcd(21, 7) gcd(14, 7) gcd(7, 7) RETURN 7 RETURN 7 RETURN 7 RETURN 7
09 10 RETURN m 11 ENDFUNCTION 4(i) [1] [2] [3] ('Sam', 18) [4] ('Joel', 20) [5] ('Jacky', 22) [6] ('Bob', 21) [7] ('Justin', 19) [8] [9] [10] 4(ii) Hashing 'Bob' gives a value of 3. Go to index 3 at the hash table and check the name (first item of the tuple). If it is 'Bob', we return the age (second item of the tuple). If it is not 'Bob', or the ent ry is empty, we perform a linear search through the hash table starting form index 3 and looping
Content continues in the PDF.
Related notes
- ACJC 2025 JC2 Computing Prelim Paper 1Exam Papers · 2025
- VJC Chapter 23 Web Applications PrinciplesNotes/Practices · 2025
- VJC Chapter 20 SQLNotes/Practices · 2025
- VJC Chapter 16 Hash TableNotes/Practices · 2025
- VJC Chapter 22 NoSQLNotes/Practices · 2025
- VJC Chapter 10 RecursionNotes/Practices · 2025

