2021 SST S4 Computing Prelim P2 QP final
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Text from the first pagesPage 1 of 9 SECONDARY 4 PRELIMINARY EXAMINATION COMPUTING Paper 2 Practical (Lab-based) 7155/02 24 August 2021 (Tuesday) 2 hours 30 minutes CANDIDATE NAME CLASS INDEX NUMBER Additional Materials: Electronic version of CREDITCARD.xlsx data file Electronic version of TEAORDER.py file Electronic version of MORETEA.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 9 printed pages, including this Cover Page. Task 3 Task 4 Total 50 For Examiner’s Use Task 2 Task 1
Page 2 of 9 Task 1 A customer of a credit card company uses spreadsheet software to keep track of his expenditure with his credit card. He lists his spending according to the Transaction ID. You are required to help this customer finish up the spreadsheet. Open the file CREDITCARD.xlsx and you will see the following data. Save your file as MYCREDITCARD_<your class>_<index number>_<your name>.xlsx 1 In cell B14 enter a formula that uses (an) appropriate function(s) to find the total amount charged. [1] 2 In cell B15 enter a formula that uses (an) appropriate function(s) to find the range of the amount charged for the transactions. [1]
Page 3 of 9 [Turn over 3 The credit card company offers a varying percentage of cashback on expenditure, depending on the amount spent in each transaction. In cells C3 to C12 enter a formula that uses (an) appropriate function(s) to search for the Percentage Cashback in the Cashback table. [2] 4 The Transaction ID of each transaction consists of the date of the transaction followed by the shop name. In cells D3 to D12 enter a formula that uses (an) appropriate function(s) to obtain the Shop Name from the Transaction ID. [2] 5 In cells A3 to A12, use a formatting tool to change the colour of the cell to red if it corresponds to an expenditure of more than $50 as reflected in cells B3 to B12. [2] 6 The credit card company also allows their customers to pay their credit card bill in 6 equal monthly payments, with 12% of interest per annum, compounded monthly. In cell B16 enter a formula that uses (an) appropriate function(s) to find the total amount repayable, including interest, if they take this option. [2] Save and close your file. Task 2 begins on the next page.
Page 4 of 9 Task 2 The following program is a point-of-sale (POS) system which reads in a customer's drink order and displays the total bill. menu = ['OOLONG MILK TEA', 'EARL GREY MILK TEA', 'MATCHA LATTE'] price = [4.9, 4.5, 6.9] print('Welcome to SSTea Inc!') order = input('What tea would you like to order? ') bill = price[menu.index(order)] print('Your total bill is ${}.'.format(bill)) print('Thank you. Please come again!') Open the file TEAORDER.py Save the file as MYTEAORDER_<your class>_<index number>_<your name>.py 7 Edit the program to add "YEO'S CHRYSANTHEMUM TEA" to the menu at the price of $1.90 per order. [1] Save your program. 8 Edit the program to accept the order input in any letter case. [1] Save your program. 9 Edit the program to only accept orders that are on the menu. A suitable error message must be displayed if the order input is not in the menu. The program must loop until a valid order is input. [3] Save your program. 10 Edit the program to accept more than one order. The program must ask the user how many drinks are to be ordered. Validation is not required for this input. After the addition of each order, the program must display the subtotal of the customer's bill. After all the orders have been made, the program must display the total bill. [3] Save your program. 11 Edit the program to apply a 20% discount on the final total bill if the customer orders more than 3 drinks. [2] Save your program.
Page 5 of 9 [Turn over Task 3 To cater for more customer customisations, SSTea Inc. decides to add a new function to their existing POS program with the following options: • Size: Small (+$0), Medium (+$1), Large (+$1.50) • Sugar level: 0%, 25%, 50%, 75%, 100% • Add topping: Pearls (+$0.50), Jelly (+$1.00) The function allows a user to customise the size and sugar level of their drink, and choose toppings to add. If the size or sugar level input is incorrect, the function will void all selections. Otherwise, the function will return the new cost of the drink. There are several syntax errors and logic errors in the function. class drinkOption(base_cost) : add_cost = base_cost reject = True print('Small +$0, Medium +$1.00, Large +$1.50") size = input("Upsize? [S, M, L] : ").upper() sugar_level = input("Sugar level [0, 25, 50, 75, 100] : ") pearls = input("Add Pearls +$0.50 [Y]es [N]o : ").upper() jelly = input("Add Jelly +$1.00 [Y]es [N]o : ").upper() if size == "m": add_cost += 1.0 elif size == "L" : add_cost += 1.5 elif size == "S" : add_cost = 0 elif: reject = True if sugar_level % 25 != 0: reject = True if pearls == "Y": add_cost += 0.55 elif jelly == "Y": add_cost += 1.0 if reject: return base_cost return add_cost menu = ["OOLONG MILK TEA", "EARL GREY MILK TEA", "MATCHA LATTE"] price = [4.9, 4.5, 6.9] print("Welcome to SSTea Inc!") order = input("What tea would you like to order? ") bill = price[menu.index(order)] bill = drinkOption(bill) print("Your total bill is ${}.".format(bill)) print("Thank you. Please come again!") Open the file MORETEA.py
Page 6 of 9 Save the file as MYMORETEA_<your class>_<index number>_<your name>.py 12 Identify and correct the errors in the program so that it works according to the requirements given. [10] Save your program. Task 4 begins on the next page.
Page 7 of 9 [Turn over Task 4 A school is organising an upcoming inter-house competition named Three Dragon Ante. There are a total of five Houses: Blue, Green, Purple, Red, Yellow. Students can form their own teams among the same House members. Team names consists of the House initials followed by a two-digit number. Each team name is unique. The competition is played over many matches. Each match involves the participation of three teams. Two teams of the same House may participate in the same match. A team may participate in more than one match. Each match can produce one of the following results: 1. One winning team, two losing teams. 2. Two winning teams, one losing team. Each winning team contributes 1 point to the House it represents. The school wants a program that will tabulate the results and display the relevant statistics with the following criteria: • Take as input a match report: a comma separated string, "N,A,B,C", where N denotes the number of winning teams (either 1 or 2), and A, B, C are team names. If N = 1, A is the winning team; if N = 2, A and B are both winning teams. • Display a suitable message each time one or more of the team names in an input is not of the correct format. It is not necessary to check the number of winning teams indicated or the number of team names inputted. • Loop until "end" is inputted to indicate that no more match reports need to be entered. • Display the total points accumulated by each House on separate lines, in the following order: Blue, Green, Purple, Red, Yellow. A suitable message must be used for each input and output. 13 Write a program for the given criteria. [11] Save your
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

