SST 2022 S4 Computing Prelim P2 QP final
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Text from the first pagesSECONDARY 4 PRELIMINARY EXAMINATION COMPUTING Paper 2 Practical (Lab-based) 7155/02 23 August 2022 (Tuesday) 2 hours 30 minutes CANDIDATE NAME CLASS INDEX NUMBER Additional Materials: Electronic version of BLOSSOM.xlsx data file Electronic version of BUBBLES.py file Electronic version of BUTTERCUP.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, including this Cover Page. Task 3 Task 4 Total 50 For Examiner’s Use Task 2 Task 1
Page 2 of 8 Task 1 Blossom Fresh Fruits and Vegetables uses spreadsheet software to create a receipt for a customer. The items ordered and their unit prices are listed. You are required to help the shop finish up the spreadsheet. Open the file BLOSSOM.xlsx and you will see the following data. Save your file as MYBLOSSOM_2022_<your class>_<index number>_<your name>.xlsx 1 In cell C15 enter a formula that uses (an) appropriate function(s) to find median unit price of all the types of fruits and vegetables sold. [1] 2 In cell C16 enter a formula that uses (an) appropriate function(s) to find total price of the items with 10 or more units ordered. [1] 3 In cells D3 to D12 enter a formula to calculate the Item Subtotal for each item. The Item Subtotal is the unit price multiplied by the number of units ordered. [1] 4 In cell D13, enter a formula that uses (an) appropriate function(s) to calculate the Total that the customer should pay. [1]
Page 3 of 8 [Turn over 5 Blossom Fresh Fruits and Vegetables has a loyalty point system. For each item bought, every $1 spent will earn the customer 1 point. The number of points earned per item is rounded down to the nearest whole number. In cells E3 to E12 enter a formula that uses (an) appropriate function(s) to calculate the number of Points per Item earned. [1] 6 For certain items, the shop also offers a bonus multiplier on the number of points per item earned. This multiplier can vary between 2 times to 5 times the calculated number in the Points per Item column. The items with the bonus points multiplier and their respective multipliers are shown in the Bonus Points Multiplier table. In cells F3 to F12 enter a formula that uses (an) appropriate function(s) to search for the Bonus Multiplier in the Bonus Points Multiplier table. If the item is not in the table, the cell in the corresponding row should show "1". Otherwise, the cell should show the bonus multiplier for the item. [3] 7 In cells A3 to F12, use a conditional formatting tool to make the text red in the rows where the item name ends with 's'. [2] Save and close your file. Task 2 begins on the next page.
Page 4 of 8 Task 2 The following program implements the bubble sort algorithm on a list of five integers that are inputted by the user. It will output the list from the smallest to the largest integer. list_length = 5 def bubblesort(arr): for r in range(1,list_length): for p in range(0, list_length-r): if arr[p] > arr[p+1]: arr[p], arr[p+1] = arr[p+1], arr[p] return arr arr = [] for i in range(5): num = int(input("Please input an integer: ")) arr = arr + [num] print("The sorted list:", bubblesort(arr)) Open the file BUBBLES.py Save the file as MYBUBBLES_2022_<your class>_<index number>_<your name>.py 8 Edit the program so that it will work for any list length. The program must display a suitable input message. [1] Save your program. 9 Edit the program so that it reverses the order of the sort. The program will then output the list from the largest to the smallest integer. [1] Save your program. 10 Edit the program so that it checks that a valid integer has been inputted before adding it to the list. [5] Save your program. 11 Edit the user-defined function bubblesort(arr) so that it removes duplicate values in the list. [3] Save your program.
Page 5 of 8 [Turn over Task 3 Buttercup Florist offers a bouquet customisation service to their customers, where customers can choose up to three types of flowers to create their own bouquet. The types of flowers chosen do not have to be unique. Customers must pay an additional $5, in addition to the cost for each type of flower they choose to include in their bouquet as shown in the table below. The shop also offers a 10% discount on bouquets with three types of flowers, rounded off to the nearest cent. The table below shows the types of flowers available and their cost. Flower Red roses Pink roses Buttercups Baby's breath Limonium Cost ($) 7 9 10 3 5 The code asks users to enter the name of each flower they want in their bouquet. The code converts the flower name to lower case and adds its corresponding cost to the total. After the user has chosen the flowers they want, the code calculates the cost of the bouquet. There are several syntax errors and logic errors in the code. print('Welcome to Buttercup Customised Bouquets!') print('Enter up to three flowers to create your bouquet.') flowers = ['red roses', 'pink roses', 'buttercups', 'baby's breath', 'limonium'] prices = [7, 9, 10, 3, 5] counter = 0 cost = 0 if counter < 3: flower = input('Please choose a flower: ') flower = flower.islower() if flower not in flowers: print('Sorry, we do not have that flower. Please try again!') continue flower_index = flowers.index(flower) cost += prices[flower_index+1] counter += 1 if counter < 2: cont = input('Please enter "N" to end, or any other key to continue: ').upper() if cont = 'n': break if counter == 3: cost = int(0.9 * cost, 2) print('The cost of your bouquet is ${}.'.format(cost))
Page 6 of 8 Open the file BUTTERCUP.py Save the file as MYBUTTERCUP_2022_<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 8 [Turn over Task 4 Most mover companies use the following expression to calculate the price quotes for their customers: For every X kilogram or less, it will be charged at S dollars. For example: If X = 20kg and S = $10, then it will cost $20 to move 30kg of items. 13 Write a user defined function using the following method signature: get_quotes(weight, price, est_weight) where weight and price are X and S in the above expression, and est_weight is the estimated weight of the items that the customer wants to move. The function will return the price quote of the mover company for the given parameters. Save your program as MOVER_2022_<your class>_<index number>_<your name>.py [3] 14 Jojo is moving house. You have been asked to write a program to help Jojo compare the cost incurred for N different mover companies, to help him make a decision about which one to hire. He represents each company with an uppercase letter starting from A. For example, if N = 4, then the companies are A, B, C and D. All the mover companies use the same expression to calculate their price quote, but with different X and S values. The program must: • ask the user to input N, the number of mover companies • ask the user to input of all the X values within a single line • check if the inputted number of X values is valid, and prompt and allow the user to re-enter all the X values if at least one of the val
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

