ACJC 2026 JC2 Computing Prelim Paper 2 (Practical)
Uploaded by Kozak327 · 4 October 2026
Preview
Text from the first pagesANGLO-CHINESE JUNIOR COLLEGE JC2 PRELIMINARY EXAMINATION Higher 2 COMPUTING 9569/02 Paper 2 (Lab-based) 12 August 2026 3 hours Additional Materials: Electronic version of ALL_WORDS.txt data file Electronic version of BOOKING.txt data file Electronic version of COACH.txt data file Electronic version of MEMBER.txt data file Insert Quick Reference Guide READ THESE INSTRUCTIONS FIRST Answer all questions. All tasks must be done in the computer laboratory. You are not allowed to bring in or take out any pieces of work or materials on paper or electronic media or in any other form. Approved calculators are allowed. Save each task as it is completed. The use of built -in functions, where appropriate, is allowed for this paper unless stated otherwise. Note that up to 6 marks out of 100 will be awarded for the use of common coding standards for programming style. 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 11 printed pages and 1 blank page. [Turn Over
2 ANGLO-CHINESE JUNIOR COLLEGE 202 6 H2 COMPUTING 9569/02 Instruction to candidates: Your program code and output for each of Task s 1, 2 and 3 should be saved in a single .ipynb file using Jupyter Notebook. For example, your program code and output for Task 1 should be saved as: TASK1_<your name>_<centre number>_<index number>.ipynb Make sure that each of your .ipynb files shows the required output in Jupyter Notebook. Task 1 Name your Jupyter Notebook as: TASK1_<your name>_<centre number>_<index number>.ipynb Positive integers can be categorised according to properties of their factors. In particular, consider the sum of the factors of the integer which are less than the integer itself. If the sum of the factors is equal to the integer, we say that the integer is a perfect number. o For example, 6 is perfect because 1 + 2 + 3 = 6. If the sum of the factors is larger than the integer, we say that the integer is an abundant number. o For example, 12 is abundant because 1 + 2 + 3 + 4 + 6 > 12. If there are two distinct positive integers x and y such that the sum of the factors of x is equal to y, and the sum of the factors of y is equal to x, we say that x and y are amicable numbers. o For example, the factors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55, and 110 which sum to 284. The factors of 284 are 1, 2, 4, 71 and 142 which sum to 220. If there is an integer x1 such that the factors of x1 sum to x2, and the factors of x2 sum to x3, etc, until a term xn is reached such that the factors of xn sum to x1, we say that the numbers x1, x2, …, xn are sociable numbers. o For example, x1 = 12496, x2 = 14288, x3 = 15472, x4 = 14536, x5 = 14264 and the sum of factors of x5 is x1. Therefore, these five numbers are sociable numbers. For each of the sub -tasks, add a comment statement at the beginning of the code, using the hash symbol ‘#’ to indicate the sub-task the program code belongs to, for example: In [1]: #Task 1.1 Program code Output: Task 1.1 Write a function factor_sum(x) which returns the sum of factors of the integer x which are at least 1 and smaller than x. [3]
3 ANGLO-CHINESE JUNIOR COLLEGE 202 6 H2 COMPUTING 9569/02 [Turn Over Task 1.2 Write program code to ask a user to input a positive integer k. The program should then print out the first k perfect numbers. Test your code with k = 4. Print the output. [6] Task 1.3 Write program code to find and print the smallest odd abundant number. [4] Task 1.4 Write program code to ask a user to input a positive integer k. The program should then print out the smaller number of the first k pairs of amicable numbers. [5] Test your code with k = 4. Print the output. Task 1.5 Write a function status(x) which returns a string describing what type of positive integer x is. Value of x Expected output 28 "Perfect" 284 "Amicable" 12496 "Sociable" 10 "Nil" 562 "Nil" 608 "Nil" Test your code on the cases above. Print your output. [7] Save your Jupyter Notebook for Task 1.
4 ANGLO-CHINESE JUNIOR COLLEGE 202 6 H2 COMPUTING 9569/02 Task 2 Name your Jupyter Notebook as: TASK2_<your name>_<centre number>_<index number>.ipynb In a single -player word guessing game, players attempt to guess a secret n-letter word. Assume all input strings consist of uppercase English letters, and the player always guesses an n-letter word. After submitting a guess, the player receives an evaluation array of length n containing feedback indicators based on its comparison to the secret word. Each integer in the evaluation array is either 2, 1 or 0. The integer at a certain index in the evaluation array gives information about how close the guess is to the secret word. If a letter in the guess matches the letter in the secret word at the same index, the evaluation array would contain 2 at that index. These letters are no longer considered in the next step. For the remaining letters in the guess, if they match a letter at the secret word in a different index, the evaluation array would contain 1 at that index. These letters are no longer considered in the next step. Any remaining letters in the guess would correspond to a 0 in the evaluation array at that index. For example, if the secret word is 'APPLE' and the guess is 'PUPPY', the evaluation array is [1, 0, 2, 0, 0]. The "P" at index 2 in the guess matches the "P" at index 2 in the secret word, so the evaluation array contains 2 at index 2. The "P" at index 0 in the guess matches the "P" at index 1 in the secret word, so the evaluation array contains 1 at index 2. The "P" at index 3 in the guess does not have any remaining letters in the secret word to match with, so the the evaluation array contains 0 at index 3. For each of the sub -tasks, add a comment statement at the beginning of the code, using the hash symbol ‘#’ to indicate the sub-task the program code belongs to, for example: In [1]: #Task 2.1 Program code Output:
5 ANGLO-CHINESE JUNIOR COLLEGE 202 6 H2 COMPUTING 9569/02 [Turn Over Task 2.1 Write a function right_index(secret, guess) that takes in two strings, secret and guess, of equal length n. The function must return a tuple containing two items: A partial evaluation array of length n with 2 at indices where the letters in secret and guess match, and None otherwise; A dictionary mapping each letter in secret to its frequency count, after subtracting the letters which have already been matched. For example, right_index("APPLE", "PUPPY") should return ([None, None, 2, None, None], {"A": 1, "P": 1, "L": 1, "E": 1}) because there are two "P"s in "APPLE" and one of them has already been matched. [5] Task 2.2 Write a function wrong_index(guess, partial_ eval, remaining_counts) that takes the guess string, along with the partial evaluation array and the dictionary of remaining letter counts obtained from Task 2.1 as partial_eval and remaining_counts, respectively. The function must update partial_eval by assigning 1 to the indices where the letters in guess match with a letter in secret at a different index, and also update the letter frequencies in remaining_counts by subtracting these matches. It should then return the updated evaluation array. [5] Task 2.3 Write a function score_word_guess(secret, guess) that integrates your logic from Task s 2.1 and 2.2 to construct the evaluation array. The function must Call right_index() to obtain the partial evaluation array and letter counts after matching the letters in the correct index; Call wrong_index() to update the evaluation array and letter counts
Content continues in the PDF. Download PDF
Related notes
- NYJC 2026 Prelim P2Exam Papers · 2026
- NYJC 2026 Prelim P1Exam Papers · 2026
- DHS 2026 Y6 H2 Computing Prelim Paper 2_finalExam Papers · 2026
- 2026_NJC Prelim_Computing_P2.pdfExam Papers · 2026
- 2026_JPJC_Computing_Prelim_P2_finalExam Papers · 2026
- 2026_JPJC_Computing_Prelim_P1_markschemeExam Papers · 2026
- 2026_JPJC_Computing_Prelim_P1_finalExam Papers · 2026
- 2026 ACJC Prelim Computing Paper 2Exam Papers · 2026
- 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
- See all H2 Computing notes

