JYSS 4E COM Prelim P2 QP
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Text from the first pagesJUNYUAN SECONDARY SCHOOL PRELIMINARY EXAMINATION 2022 SECONDARY FOUR EXPRESS CANDIDATE NAME CLASS INDEX NUMBER COMPUTING 7155/02 Paper 2 (Practical) 12 Sep 2022 2 hours 30 minutes Additional Materials: 1 x Thumb Drive Electronic version of TASK1.xlsx file Electronic version of TASK2.py file Electronic version of TASK3.py file Insert Quick Reference Glossary 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. Programs are to be written in Python. Save your work using the file name given in the question as and when necessary. 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 50. This document consists of 8 printed pages, 4 blank pages and 1 insert. [Turn over For Examiner’s Use Task 1 10 Task 2 10 Task 3 10 Task 4 20 Total 50
2 Task 1 Ms. Yeo is consolidating the academic results of her students at the end of the year. She uses a spreadsheet software to make calculations and plan for school events. Students who do well will be awarded a monetary award on Speech Day. Ms. Yeo also plans to help her students who are underperforming by conducting a holiday bridging programme. You are required to finish setting up the spreadsheet to record the details for her students. Open the file TASK1.xlsx and you will see the following data. Save the file as MARKS_<Class>_<Index>_<Name>.xlsx. 1 In the Average column, enter a formula that uses a function to calculate the average of all the subjects attained for each student rounded up to one decimal place. [2] 2 In the Award column, enter a formula that uses an appropriate function to search for the Award in the Speech Day Awards table. [2]
3 4E Computing P2 2022 Prelim [Turn over 3 A student is awarded a Top Student award if their average score is the highest. In the Top Student column, enter a formula that uses functions to find the student(s) with the highest average and display the text ‘Top’ for the student. All other cells in the column must be empty. [3] 4 In cells K17 and K18, enter a formula that uses an appropriate function to count the number of students that meets the criteria description in the Holiday Bridging Programme table. [3] Save your work.
4 Task 2 The following program accepts positive integers and outputs their corresponding binary (base-2) equivalent. a = int(input("Enter a denary number: ")) converted = 0 loop = 0 while a != 0: remainder = a % 2 converted = converted + remainder*(10**loop) a = a // 2 loop += 1 print(converted) Open the file TASK2.py Save the file as BINARY_<Class>_<Index>_<Name>.py 5 Edit the program so that when a denary number 10 is entered, it outputs the following statement: Binary equivalent of 10 is 1010. Save your program. [2] 6 Edit the program to accept and convert only five positive integers from the user. Save your program. [3] 7 Edit the program to only accept positive integers as input. A suitable error message must be displayed if a negative input is given. The program must loop until a valid denary number is input. Save your program. [3] 8 Save the file as OCTAL_<Class>_<Index>_<Name>.py Edit the program so that it converts the positive denary numbers into octal numbers. Similar to the binary number system, octal numbers are base-8 numbers. Save your program. [2]
5 4E Computing P2 2022 Prelim [Turn over BLANK PAGE
6 Task 3 A program converts a denary number to its hexadecimal equivalent and vice versa. The program shown on the next page asks the user to input a conversion option: H to convert denary numbers to hexadecimal numbers D to convert hexadecimal numbers to denary numbers Q to end the program. The conversions are processed in subfunctions. To convert from denary number to hexadecimal number, the function: takes in the user input divides the denary number repeatedly by 16 uses the remainders of each division to derive the hexadecimal number from the hexadecimal array divides the quotients of each division until the quotient is zero. returns the hexadecimal number To convert the hexadecimal number to denary number, the function: takes in the user input flips the hexadecimal input locates the index of each character in the input in the hexadecimal array computes the denary number by multiplying the hexadecimal value with its place value returns the denary number The program outputs the conversion result. The program loops the options until the user enters a ‘Q’ or ‘q’ to end the program. There are several syntax and logic errors in the program.
7 4E Computing P2 2022 Prelim [Turn over def hextoden(a): converted = 0 hex_sys = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"] a = a[::-1 for i in range(len(a)): value = hex_sys.index(a[i]) converted = converted + value*(16*i) return converted def dentohex(): converted = "" hex_sys = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"] while a != 0: remainder = a % 8 converted = hex_sys[remainder] + converted a = a / 16 return converted choice = input("Enter H to convert denary to hex \n\ Enter D to convert hex to denary\n\ Enter Q to Quit: ").upper() while choice != 'Q' user = input("\nEnter the number to be converted: ") if choice == 'H': hex_num = dentohex(user) print("Hexadecimal of", user, "is", hex_num, ".") if choice != 'D': den_num = hextoden(user.upper()) print("Denary of", user.upper(), "is", den_num, ".") choice = input("\nEnter H, D or Q: ").upper() print("Program ends." Open the file TASK3.py Save the file as HEXDEN_<Class>_<Index>_<Name>.py 9 Identify and correct the errors in the pr ogram so that it works according to the requirements given. Save your program. [10]
8 Task 4 Ms. Yeo wants a program that collates the names and scores of her students in a class. The program must: ask the user for the number of student data that is being entered ask the user to enter a student name, converts the input to upper case and store the input ask the user to enter the score of the student, correct to one decimal place and store the input repeatedly take input of a student’s score until the score is from 0 to 100 inclusive tracks the names of students who achieved distinction (75 marks or more) tracks the names of students who failed (below 50 marks) computes and outputs the following: number of students who achieved distinction and failed the names of the students who achieved distinction, if any the names of the students who failed, if any average score of the class, correct to one decimal place Your program must include appropriate input and output messages. 10 Write a program to meet the requirements. Save your program as CLASS1_<Class>_<Index>_<Name>.py [15] 11 When your program is working, use the following test data of five students to show your result. Student Name Score Mike Wheeler 65.9 Lucas Sinclair 9 70.3 Max Mayfield 91 Will Byers 61.6 Dustin Henderson 82.4 Take a screenshot of your result and save it as: TESTCLASS_<Class>_<Index>_<Name> [2] Save your file in either .jpg or .png format.
9 4E Computing P2 2022 Prelim [Turn over 11 Save your program as CLASS2_<Class>_<Index>_<Name>.py The cla
Content continues in the PDF. Download PDF
Related notes
- SST (for revision practice) 2024 S3 Computing EOY P2 QP_FinalExam Papers · 2024
- Computing o level notes Notes/Practices · 2023
- BVSS Prelim P1 MSExam Papers · 2024
- BVSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 MSExam Papers · 2024
- computing notesNotes/Practices
- SST 2024 Prelim Paper 1 Ans [revised for 2025] Exam Papers · 2024
- SST 2024 Prelim Paper 1 [revised for 2025] Exam Papers · 2024
- [Notes for Computing] All Definitions/ TermsNotes/Practices · 2025
- [Notes for Computing] Heavily Compressed TextbookNotes/Practices · 2025
- All Computing Terms/DefinitionsNotes/Practices · 2025
- See all Computing notes

