SST (for revision practice) 2024 S3 Computing EOY P2 QP Final
Uploaded by VishyError403 · 18 August 2026
Preview
Text from the first pagesSECONDARY 3 END-OF-YEAR EXAMINATION COMPUTING Paper 2 Practical (Lab-based) 7155/02 9 October 2024 (Wednesday) 2 hours 30 minutes CANDIDATE NAME CLASS INDEX NUMBER Additional Materials: Electronic version of AGE.ipynb file Electronic version of coe_bid.txt data file Electronic version of coe_id.txt data file Electronic version of MASTERMIND.ipynb file Electronic version of SALARY.xlsx data file Electronic version of TEMP.ipynb file Insert Quick Reference Guide for Python READ THESE INSTRUCTIONS FIRST Approved calculators are allowed. 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 70. This document consists of 13 printed pages including this cover page. For Examiner’s Use Task 1 15 Task 2 10 Task 3 10 Task 4 10 Task 5 25 Total /70 For revision practice
Task 1 SSTea Inc, a bubble tea company, uses spreadsheet software to calculate their employees’ salaries. Open the file SALARY.xlsx and you will see the following data. Save the file as: TASK1_<your class>_<index number>_<your name>.xlsx (e.g. TASK1_S300_08_Jane Tan.xlsx) 1 In cell G1, enter a function that displays the current date and time. [1] 2 In cell G3, enter a formula that uses (an) appropriate function(s) to create a Salary Reference Code. The reference code consists of the following information joined together with no extra characters in between: • the employee’s last name (the second word in Full Name) • the 3-letter abbreviation of the month (as shown in cell A1) • a random 1-digit number from 0 to 9 The Salary Reference Code must be calculated in a single formula. [4] 3 In cells C7 and C8, enter a formula that uses (an) appropriate function(s) to calculate the number of normal hours and overtime hours the employee worked. For a part-time employee, any hours after the 139th are considered overtime. For a full-time employee, any hours after the 176th are considered overtime. For example, if a part-time employee worked for 150 hours,139 hours are considered Normal Hours and 11 are considered Overtime Hours. [4]
Page 3 of 13 [Turn over 4 In cell C10, enter a formula that uses (an) appropriate function(s) to calculate the salary for this month. The formula should look up the correct salary rate for the employee’s job rank in the Salary Rate (per hour) table, then multiply the salary rate with the number of normal hours and overtime hours worked respectively. The salary rate should be multiplied by 1.5 for the overtime hours. The salary for this month must be calculated in a single formula. [3] 5 In cell C11, enter a formula that uses (an) appropriate function(s) to calculate the average salary per week, rounded to the nearest $0.10. You may assume that the month has 4 weeks. [1] 6 In cell C6, use a formatting tool to make the background red if the employee has at least 20 overtime hours. [2] 7 Save your work. Task 2 begins on the next page.
Page 4 of 13 Instruction to candidates: Your program code and output for each of Tasks 2 to 5 should be saved in a single .ipynb file using JupyterLab. For example, your program code and output for Task 2 should be saved as: TASK2_<your name>_<centre number>_<index number>.ipynb Make sure that each of your .ipynb files shows the required output in JupyterLab. Task 2 Open the file TEMP.ipynb Save the file as: TASK2_<your class>_<index number>_<your name>.ipynb (e.g. TASK2_S300_08_Jane Tan.ipynb) The task is to edit program code that allows temperature readings for a week to be input and prints the average temperature out. For each of the sub-tasks, add a comment using the hash symbol ‘#’ at the beginning of your code to indicate the sub-task that the program code belongs to. For example: In [1]: # Task 2.1 Program code Output: Task 2.1 Room temperatures in a biotechnology lab are highly controlled to ensure the optimum working conditions for the bacteria used in experiments. The following program accepts temperature readings for a week, from Day 1 to 7, and stores the temperatures in a list. It then prints out the average temperature. templist = [] while len(templist) < 7: input_s = input("Enter temperature: ") temp = float(input_s) templist.append(temp) average = sum(templist) / 7 print("Average temperature is", average)
Page 5 of 13 [Turn over Edit the program so that it: (a) allows the user to enter any number of entries and terminates the loop only if an exclamation mark '!' is entered. [3] (b) displays the number of the day with the highest and lowest temperatures. You may assume that the temperature for each day is different. The output must be displayed in the following format, where X, H, Y and L should be replaced with the appropriate values.: Day X has the highest temperature at H degrees. Day Y has the lowest temperature at L degrees. [4] (c) counts and prints out the number of days where the temperature was above the average temperature. Suitable output messages must be used. [3] Save your JupyterLab notebook for Task 2.
Page 6 of 13 Task 3 Open the file AGE.ipynb Save the file as: TASK3_<your class>_<index number>_<your name>.ipynb (e.g. TASK3_S300_08_Jane Tan.ipynb) The task is to edit program code that calculates the age of a person. The following program calculates a person’s age after accepting today's date and the date of birth. For simplicity, we will assume that we are using a modified calendar where every month has exactly 30 days. def validate_date(date): return True def calculate_age(tdy, dob): d_tdy, m_tdy, y_tdy = int(tdy[0]), int(tdy[1]), int(tdy[2]) d_dob, m_dob, y_dob = int(dob[0]), int(dob[1]), int(dob[2]) d_age = d_tdy - d_dob m_age = m_tdy - m_dob y_age = y_tdy - y_dob return d_age, m_age, y_age input_tdy = input("Enter today's date (DD/MM/YYYY): ") input_dob = input("Enter date of birth (DD/MM/YYYY): ") if validate_date(input_tdy) and validate_date(input_dob): tdy = input_tdy.split('/') dob = input_dob.split('/') d, m, y = calculate_age(tdy, dob) print("The age is {} years, {} months and {} days.".format(y, m, d)) else: print("You have entered an invalid date. This program will be terminated.")
Page 7 of 13 [Turn over For each of the sub-tasks, add a comment using the hash symbol ‘#’ at the beginning of your code to indicate the sub-task that the program code belongs to. For example: In [1]: # Task 3.1 Program code Output: Task 3.1 Edit the user-defined function validate_date()so that it returns True if all the four conditions below are met for the date to be valid. Otherwise, the function should return False. A date is considered valid if: • the number of characters in each entry is 10, • the separator between day, month and year is a slash '/', • the day should be between 01 and 30 inclusive, and • the month should be between 01 and 12 inclusive. [5] Save your program. Task 3.2 Copy and paste your program from sub-task 3.1. Edit the user-defined function calculate_age()so that it corrects the issue of returning a negative value for the number of months and/or days for some inputs. [5] Save your JupyterLab notebook for Task 3.
Page 8 of 13 Task 4 Open the file MASTERMIND.ipynb Save the file as: TASK4_<your class>_<index number>_<your name>.ipynb (e.g. TASK4_S300_08_Jane Tan.ipynb) The task is to identify and correct errors in program code so that the program works according to the given rules. T
Content continues in the PDF. Download PDF
Related notes
- Computing o level notes Notes/Practices · 2023
- BVSS Prelim P1 CPExam Papers · 2024
- BVSS Prelim P1 MSExam Papers · 2024
- CWSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 MSExam Papers · 2024
- computing notesNotes/Practices
- SST 2024 Prelim Paper 1 [revised for 2025] Exam Papers · 2024
- SST 2024 Prelim Paper 1 Ans [revised for 2025] Exam Papers · 2024
- [Notes for Computing] Heavily Compressed TextbookNotes/Practices · 2025
- [Notes for Computing] All Definitions/ TermsNotes/Practices · 2025
- (Notes) Heavily Compressed TextbookNotes/Practices · 2025
- All Computing Terms/DefinitionsNotes/Practices · 2025
- See all Computing notes

