SPS 2020 Computing P2
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Text from the first pagesREAD THESE INSTRUCTIONS FIRST Write your name, class, index number in the spaces at the top of this page. Write in dark blue or black pen. 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. Parent’s Signature : ____________________________ Date: ____________________________ Remarks (if any) : For Examiner’s Use Marks /50 Total % This document consists of 7 printed pages including this page and ANNEX A. ST. PATRICK'S SCHOOL PRELIMINARY EXAMINATIONS 2020 SECONDARY 4 EXPRESS NAME CLASS INDEX NUMBER COMPUTING Paper 2 (Lab-based) 7155/02 24 August 2020 2 h 30 min Additional Materials: Electronic version of THEMEPARK.xlsx data file Electronic version of GARGLE.py file Electronic version of INTEGERS.py file Quick Reference Glossary
2 [Turn over
3 [Turn over
4 [Turn over Task 1 A holiday theme park, Theme Park Pte Ltd uses a spreadsheet software to calculate their ticket sales. You are required to finish setting up the spreadsheet to calculate the revenue gained for each transaction number. Open the file THEMEPARK.xlsx. You will see the following data. Save the file as MYTHEMEPARK_<Class>_<Class_Index_Number>_<Your_Name> 1 The fifth character of each Transaction Number is the Code of the Package Name. In cells C7 to C16 enter a formula that uses an appropriate function to search for the Package Name in the Package table. Use it to display the Package Name. [2] 2 In cells E7 to E16 enter a formula that uses an appropriate function to search for the Price in the Package table. Use it to calculate the Full Cost in currency format. [2] 3 In cells G7 to G16 enter a formula that uses an appropriate function to search for the Discount in the Discount table. Use it to calculate the Discount given in currency format. [2] 4 In cells H7 to H16 enter a conditional statement to calculate the Revenue. If the Transaction Type is CORPORATE, apply an additional 2% of the Revenue. [2] 5 In cells F36 to H36 enter a conditional statement to calculate the number of each Transaction Type. [2]
5 [Turn over Task 2 The following program creates a Gargle Suite account for a user. It creates the username by taking the first letter of the user’s name and combining it with the user’s ID. It will also allow the user to enter a password. name = input("Please enter your full name: ") id = input("Please enter your ID: ") username = name[0] + id print("Your username is " + username) password = input("Please enter a password: ") Open the file GARGLE.py. Save the file as MYGARGLE_<Class>_<Class_Index_Number>_<Your_Name>.py 6 Edit the program so that the username is created using the first 5 characters of the user’s name and combining with the last 5 characters of the user’s ID. The program should also ignore any spaces in the user’s name when creating the username. [3] 7 The program needs to validate both the password and whether the user has correctly re-entered their password. (a) Edit the program to: • test whether the user has entered a password of eight characters or more and that it consists of at least 1 capital letter, 1 small letter and 1 numeral. • output a suitable error message that asks the user to enter a password again if the password does not meet the above criteria, and repeat this until the user enters a valid password. [3] (b) Edit the program to: • ask the user to re-enter their password (i.e. second entry of password) • output a suitable error message that asks the user to enter a new password if the second entry of the password does not match the first entry, and repeat this until the user enters a valid password and the second entry matches the first entry of the password. • output the user’s username and email address in this format: Your account has been set up successfully. Your username is ElgooG2020 Your email address is elgoog2020@gargle.com [4] Save your program.
6 [Turn over Task 3 The following program asks user to input a series of integers and checks whether the integer is a positive, negative or zero. The program also outputs the list of integers in ascending order. The program quits when the user enters "q". There are several syntax and logic errors in the program. data negatives = [] positives = [] zeroes = [] num_zeroes = 0 num = int(input("Enter an integer (q to quit): ")) while num != q: num = num data.extend(num) if num < 0: negatives.append(num) elif num > 0: positives.append(num) else zeroes.append(num) num = input("Enter an integer (q to quit): ") data = sort() print("\nThe integers, sorted in ascending order, are: {}\n".format(data)) print("\nThe negative values are: ") for num in negatives: print(num) print("\nThe positive values are: ") for num in positives: print(num) num_zeroes = count(zeroes) print("\nThere are {} zeroes.", num_zeroes) Open the file INTEGERS.py. Save the file as MYINTEGERS_<Class>_<Class_Index_Number>_<Your_Name>.py 8 Identify and correct the errors in the program so that it works according to the requirements given. Save your program. [10]
7 End of Paper Task 4 You have been asked to create an unscrambling word game program. This program simulates a two-player game. Player 1 enters a word. The program then scrambles it for Player 2 to figure out Player 1’s word. The program should: • allow Player 1 to input a word of length between 3 and 45, for Player 2 to unscramble. Instruct Player 1 to only enter lowercase letters from the English alphabet. There must be a validation present to check that the word entered is within the above characters limit and that it is made up of only lowercase letters from the English alphabet. • allow Player 2 to have three attempts to correctly unscramble the word input by Player 1. You do not need to validate the input for Player 2. • output an appropriate message when Player 2 manages to unscramble correctly and inputs the same word entered by Player 1. The game ends when Player 2 unscrambles correctly. • output an appropriate message when Player 2 does not input the same word entered by Player 1. • output an appropriate message when Player 2 has 3 incorrect attempts. The game must also end here. 9 Write your program and test that it works. Save your program as MYWORD1_<Class>_<Class_Index_Number>_<Your_Name>.py [10] 10 When your program is complete, test it for the following: • Test 1: Player 1 inputs the word “ISOSCELES” • Test 2: Player 1 inputs the word “an” • Test 3: Player 1 inputs the word “triangle” and player 2 enters “traingle” and “triangle”. • Test 4: Player 1 inputs the word “hen” and player 2 enters “neh”, “enh”, “nhe”. Take a screenshot of: • Test 1, 2, 3 and 4. Save this single screenshot as: TEST1234_<Class>_<Class_Index_Number>_<Your_Name> Save your file in either .png or .jpg format. [4] 11 Save your program as MYWORD2_<Class>_<Class_Index_Number>_<Your_Name>.py Extend your program to keep track of the number of attempts left for Player 2. Outputs a suitable message on the number of attempts left before asking Player 2 to enter his word. Save your program. [2] 12 Save your program as MYWORD3_<Class>_<Class_Index_Number>_<Your_Name>.py Extend your program to allow Player 2 to choose an easy, medium or hard game. An easy game allows five attempts, a medium game allows three attempts and a hard game allows two attempts. Sa
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

