SPS 2022 Sec 4E Computing Prelim P2
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Text from the first pages[NAME CLASS INDEX NO. ST. PATRICK'S SCHOOL PRELIMINARY EXAMINATION 2022 SUBJECT : Computing Paper 2 (7155/02) DATE : 22 AUG 2022 LEVEL : Secondary 4 Express DURATION : 2 hours 30 minutes ADDITIONAL MATERIALS Electronic version of APPLICATION.xlsx file Electronic version of BLOODPRESSURE.py file Electronic version of HASHTAG.py file Insert Quick Reference Glossary READ THESE INSTRUCTIONS FIRST For Examiner’s Use Score /50 This paper contains 11 printed pages including this cover page. Write your name, register number and class at the top of this page. 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.
2
3
4 Task 1 A government agency uses spreadsheet software to calculate the one -time cash payout to help applicants residing in the country tide through the Covid -19 pandemic . The spreadsheet provides the application reference number, monthly family income and number of family members in the applicant’s household. Each Application Reference Number in Column A comprises the following: 1. The first alphabet which represents the citizenship status of the applicant as follows: • “C” represents “Citizen” • “P” represents “Permanent Resident” • “F” represents “Foreigner” 2. The next 4 digits of the Application Reference Number represents the year that the applicant was born. 3. The last 3 digits are random. You are required to finish setting up the spreadsheet to provide useful information and calculate the payout to each applicant.
5 Open the file APPLICATION.xlsx. You will see the following data. Save the file as PAYOUT_<your name>_<centre number>_<index number>.xlsx 1 Enter a formula to calculate the current age of the applicants in the Age column at the time of application in the year 2020. [2] 2 Use a conditional statement to identify the citizenship status ( Citizen, Permanent Resident or Foreigner) in the Citizenship column. [2] 3 The monthly per capita income is the monthly family income divided by the number of family members in the applicant’s household. Enter a formula to calculate each applicant’s Monthly Per Capita Income, rounded down to the nearest dollar($). [2] 4 All applicants except Foreigner citizenship status will receive the cash payout according to their Monthly Per Capita Income. Use a conditional statement to identify an applicant’s cash payout based on Citizenship status and search for the correspondi ng Payout in the Per Capital Income Level table to complete the Cash Payout column. [2] 5 In cell B28 enter a formula to find the median monthly per capita income. [1] 6 In cell B29 enter a formula to find the 70th percentile monthly per capita income. [1] Save and close your file.
6 Task 2 Blood pressure (BP) readings are expressed as a ratio of the systolic pressure over the diastolic pressure. The program below takes in the patient's systolic and diastolic pressure and outputs the diagnosed outcome of the patient. systolic = int(input("Enter your systolic pressure (mmHg): ")) diastolic = int(input("Enter your diastolic pressure (mmHg): ")) cat = None result = ["Normal BP", "High-normal BP"] if systolic < 120 and diastolic < 80: cat = 0 if (systolic >= 120 and systolic <= 139) or (diastolic >= 80 and diastolic <= 89): cat = 1 print("Diagnosis:", result[cat]) Open the file BLOODPRESSURE.py Save the file as MYBP_<your name>_<centre number>_<index number>.py 7 Edit the program so that it prints the patient's blood pressure reading in the following form after the patient's data has been entered: Enter your systolic pressure (mmHg): 120 Enter your diastolic pressure (mmHg): 75 Your BP is 120 / 75 mmHg. Save your program. [1]
7 8 Save your program as MYBP2_<your name>_<centre number>_<index number>.py A more complete categorisation is shown in the table below. Categories for Blood Pressure Levels in Adults (Aged 18 Years and Older) Blood Pressure Level (mmHg) Category Systolic Diastolic Normal BP < 120 and < 80 High-Normal BP 120 - 139 or 80 - 89 Stage 1 Hypertension 140 - 159 or 90 - 99 Stage 2 Hypertension 160 or more or 100 or more * Isolated Systolic Hypertension > 140 and < 90 When systolic and diastolic blood pressures fall into different categories, the higher category should be used to classify blood pressure level. For example, 160/95 mmHg would be classified as stage 2 hypertension. Edit the program so that it can also correctly output the additional 3 cases of hypertension. Save your program. [7] 9 Save your program as MYBP3_<your name>_<centre number>_<index number>.py Edit the program so that it will request user to enter the number of sets of data to be entered and perform the categorisation for the entered number of times. Your program should prompt the user with the following message: "Enter the number of sets of data to be cateogorised: " Save your program. [2]
8 Task 3 A program is used to process data relating to the number of hashtags linked to blog posts and the number of views of the posts in its first week of posting. The hashtags of 5 posts are combined into a string and consolidated in a list. A second list consoli dates the number of views of each post after 1 week. The post titles are consolidated in a third list. The program eventually outputs 1) the post with the highest number of hashtags 2) the average number of hashtags among the 5 posts 3) the post with the most number of views There are several syntax and logic errors in the program. all_hashes = ["#gogreen#recycling#upcycling",'' "#coolgames#experiment#expertmode#awesomegames",'' "#diycook#ironchef",'' "#outdoor#fauna#flora#nature#scenery#sunset",'' "#magic#howcanitbe"] views = [230, 683, 388, 597, 127] post_titles = ["My Upcycling Project", '' "Stanley's Awesome Games", '' "Chef @ Home", '' "An afternoon at Bukit Timah Reserve", '' "Card Tricks" num_hashes = [] for i in range(5) num_hashes += len(all_hashes[i].split("#")) - 1 highest_hash = max(num_hashes) index = None for j in range(5): if num_hashes[j] = highest_hash: index = j print(post_titles[j],"has",highest_hash,"hashtags which is the highest among all posts.") average = sum(num_hashes) % 5 print("The average number of hashtags is", sum)
9 highest_view = max(view) index = None for k in range(4): if views[k] == highest_view: k = index print(post_titles[index],"has",highest_view,"views which is the highest among all posts.") Open the file HASHTAG.py Save the file as MYHASHTAG_<your name>_<centre number> <index number>.py 10 Identify and correct the errors in the program so that it works according to the rules given. Save your program. [10]
10 Task 4 SpendMax shopping mall is having its annual lucky draw for all shoppers. Every shopper is entitled to a lucky draw chance. Shoppers have to enter the receipt number of their purchase followed by their mo
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

