2021 SPS Computing P2 Solutions
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Text from the first pages[Turn over NAME CLASS INDEX NO. MARKING SCHEME ST. PATRICK'S SCHOOL PRELIMINARY EXAMINATION 2021 SUBJECT : Computing Paper 2 (7155/02) DATE : 24 August 2021 LEVEL : Secondary 4 Express DURATION : 2 hours 30 minutes ADDITIONAL MATERIALS: Electronic version of ORDERS.xlsx data file Electronic version of DRINK.py file Electronic version of REVERSE.py file Quick Reference Glossary INSTRUCTIONS TO CANDIDATES: Write your Name, Class and Index No. in the spaces at the top of this page. Write in dark blue or back pen. Answer all the 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. INFORMATION FOR CANDIDATES: The allocated marks for each question are indicated in the brackets [ ]. For Examiner’s Use Score /50 This question paper consists of 8 printed pages, including the cover page. Candidates answer on the Question Paper.
2 Task 1 Save the file as MYORDERS_<Class>_<Class_Index_Number>_<Your_Name>.xlsx 1 The first character of Order ID denotes the zone of the order. In cells B4 to B15, enter a formula that uses an appropriate function to display the zone of the order. [1] 2 In cells E4 to E15, enter a formula that uses an appropriate function to search for the Price of the respective Bento Set and calculate the total price of each order. [2] 3 A discount of 20% is given for orders whose Total Price is above $40. In cells F4 to F15, enter a formula that uses an appropriate function to calculate the price after discount for each order. [3] 4 In cell F16, enter a formula that uses an appropriate function that calculates the total revenue for the day. [1] 5 In cells B20 to F20, enter a formula that uses an appropriate function that calculates the total quantity of each bento set ordered. [2] 6 In cells F4 to F15, use a formatting tool to change the colour of the cells whose value is at least $50, to green fill. [1]
3 [Turn over Task 2 The following program displays a list of drinks available and asks user to input a drink to search within the list. a_list = ["PowerBoost", "EnergyOne", "RedOx", "VitaJuice", "HydroPlus"] print (a_list) search = input("Enter a drink: ") Open the file DRINK.py Save the file as MYDRINK_<Class>_<Class_Index_Number>_<Your_Name>.py 7 Edit the program so that it searches the list based on the user input and displays a message "Drink found. Enjoy!" when the drink is found within the list and "Drink not found." when the drink is not found. [4] 8 Save your program as VARDRINK_<Class>_<Class_Index_Number>_<Your_Name>.py Edit the program so that it: (a) Asks the user for input whether or not to remove the drink from the list after the drink is found within the list. If user inputs “Yes”, then, the drink is removed from the list and the same updated list is displayed to the user. (b) Ask the user repeatedly to input a drink to search within the list (and also input whether or not to remove the drink from the list) until the letter “q” is entered or the list is empty. The program will then exit. Save your program. [3] [3]
4 Task 3 Open the file REVERSE.py. Save the file as MYREVERSE _<Class>_<Class_Index_Number>_<Your_Name>.py 9 Identify and correct the errors in the program so that it works according to the requirements given. Save your program. [10]
5 [Turn over Task 4 Moving averages are one of the most commonly used technical indicators by traders to identify price trends. They are normally used to filter out market noise and smooth out fluctuations in price to help traders distinguish between typical market fluctuations and actual price reversals. The most basic type of moving average is Simple Moving Average (SMA). It is simply the average price over the specified period. The chart below shows an example of 200 period SMA, i.e. average over 200 data points. Source: https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/sma Example: If the most recent 5 prices are $1, $2, $3, $4 and $5, the average would be the sum of the rates i.e. (1+2+3+4+5) divided by the number of reporting periods. Therefore SMA = 15/5 = $3 Each time a new price becomes available, the average "moves" so that the average is always based only on the last same number of variables. In this case, if the next number in the sequence is $6, the oldest rate, i.e. $1 would be dropped and the new average would (2+3+4+5+6)/5 which equals $4.
6 You are tasked to write a program that generates the SMA given user inputs of 5 data points for each of the 3 different commodities (Commodity A, Commodity B and Commodity C). The program should: • For each commodity, take as input 5 data points in the format a, b, c, d, e where a, b, c, d and are the prices across 5 reporting periods. You may assume that the prices are positive integers. [2] • Only allow data entry of positive integers. [2] • If user enters invalid data points, output an appropriate error message and ask the user to enter the data points again. [2] • Calculate the SMA using the formula given. [1] • Display the 5 data points and the SMA. [1] • Repeat the above steps for the 3 different commodities, i.e. Commodity A, Commodity B and Commodity C. [2] 10 Write your program and test that it works. Save your program as MYSMA_<Class>_<Class_Index_Number>_<Your_Name>.py [10] 11 When your program is complete, use the following test data to show your test result. • Commodity A with 1, 2, 3, 4, 5 as its data points across 5 reporting periods. [1] • Commodity B with 3, 6, 4, -2, 2 as its data points across 5 reporting periods. [1] • Commodity B with 3, 6, 4, 2, 2 as its data points across 5 reporting periods. [1] • Commodity C with 4, 5, 9, 12, 20 as its data points across 5 reporting periods. [1] Take a screenshot of your result and save it as: SMATEST_<Class>_<Class_Index_Number>_<Your_Name> [1] Save your file in either .png or .jpg format. [5] 12 Save your program as MYSMA2_<Class>_<Class_Index_Number>_<Your_Name>.py Extend your program so that the average “moves” as described on the previous page. It should accept user input of the next data point in the format a, b, c where a is the next data point for Commodity A, b as the next data point for Commodity B and c as the next data point for Commodity C. [3] The program should then calculate the new SMA for each of the 3 commodities. [1] The program should also display the initial data points and its initial SMA, as well as the new data points and its new SMA, for each of the 3 commodities. [1] Save your program. [5] End of Paper
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

