MFSS 2020 P2
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Text from the first pagesName: ______________________________ ( ) Class: _______ MONTFORT SECONDARY SCHOOL PRELIMINARY EXAMINATION 2020 Secondary 4 Express COMPUTING Paper 2 Practical (Lab-based) 1.00 pm 7155/02 1 Sep 2020 (Tue) 2 hours 30 minutes Additional Materials: Electronic version of LOANS.xlxs data file Electronic version of NUMBER.py file Electronic version of NAPFA.py file Insert Quick Reference Glossary attached as ANNEX A READ THESE INSTRUCTIONS FIRST Do not open this booklet until you are told to do so. Write your name, index number and class in the spaces provided 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 marks for this paper is 50. Parent’s Signature: _______________________ For Examiner’s Use Total 50 This document consists of 8 printed page. Setter: Mr Ricky Tan
2 Task 1 A loan broker keeps track of his clients’ housing loans using a spreadsheet. The rates of three banks are compared and the best (lowest) rate is used to calculate each client’s Monthly Payment. You are required to finish setting up the spreadsheet. Open the file LOANS.xlsx. You will see the following data. Save the file as MYLOANS_<your name>_<your class>_<index number>.xlsx 1 In cells F2 to F13 enter a formula that uses an appropriate function to search for the rate offered by Bank C for each given principal. The rates offered by each bank is given in the Rates table. [2] 2 In cells G2 to G13 enter a formula to determine the Best Rate among the rates offered by the three banks. The best rate is the lowest of Rate A, Rate B, and Rate C [2] 3 In cells H2 to H13 enter a formula to calculate the Monthly Payment of a loan based on the Best Rate. [2]
3 4 In cells I2 to I13 enter a formula to calculate the Total Payment made of a loan based on the Best Rate. The Total Payment made is the sum of all monthly payments for the duration of the loan. [2] 5 In cells J2 to J13 enter a formula to calculate the Total Interest paid of a loan based on the Best Rate. The Total Interest paid is amount of interest that was paid to the bank for the duration of the loan. [2] Task 2 begins on the next page.
4 Task 2 The following program is a number guessing game that allows the user to guess a randomly generated number between 1 and 10 inclusive. The program does the following: • Generates a random number between 1 and 10 inclusive; • Allows the user to repeatedly guess the randomly generated number by entering a number; • Informs the user that his guess is correct if his guess matches the randomly generated number and the program ends; • Otherwise, informs the user whether the correct number is greater than or less than his guess. import random ans = random.randint(1,10) x = int(input("Enter a number: ")) while x != ans: if x < ans: print("Your guess is too low!") else: print("Your guess is too high!") x = int(input("Enter a number: ")) print("Correct!") Open the file NUMBER.py Save the file as MYNUMBER_<your name>_<your class>_<index number>.py 6 Edit the program so that it: (a) Generates a number between 1 and 100, inclusive, instead of 1 to 10. (b) Counts the number of tries the user has used, and prints it out at the end. (c) Performs data validation on the user input. Informs the user if his input is not an integer and allow him to enter again. Save your program. [1] [3] [4] 7 Save your program as MYNUMBER8_<your name>_<your class>_<index number>.py Extend your program so that the user can only guess up to 8 times. Output an appropriate message if he has used up all 8 tries and has yet to correctly guess the number. Save your program. [2]
5 Task 3 The following program calculates the number of Points scored by a 16 year-old male student doing his Standing Broad Jump station in a NAPFA test. Subjects are given two tries and the better of the tries is used to determine the score he scores. The score table is shown below. Points Distance Jumped (cm) 5 > 245 4 236-245 3 226-235 2 216-225 1 206-215 0 < 206 The program does the following: • Allows the PE teacher to enter the distances that a student jumped. • Calculates the points that the student scored based on the better of the two distances. There are several syntax errors and logical errors in the program. try1 = int(input(Enter distance for Attempt 1: ")) try1 = int(input("Enter distance for Attempt 2: ")) if try1 < try2: dis = try1 elif: dis == try2 if dis >= 245: print("5 Points") if dis >= 236: print("4 Points") elif dis >= 226: print("3 Points" elif dis >= 216: print("2 Points") elif dis >= 206: print("1 Points") else print("6 Points") Open the file NAPFA.py Save the file as MYNAPFA_<your name>_<class>_<index number>.py 8 Identify and correct the errors in the program so that it works correctly according to the rules above. Save your program. [10]
6 Task 4 In computer Role Playing Games (RPGs), a world is presented to the user and he explores it by moving about, picking up valuable items and fighting enemies along the way. You have been asked to write a simple RPG. A small world can be represented by a 4 x 4 grid, with each space indexed by a number. The game starts by presenting the initial state of the world to the user. Each space is represented by a character: Character Represents . Unexplored space A Space explored by Player A The player always starts at space 0, which is at the top-left corner of the world. 9 Represent the world in a suitable structure. Construct the initial state of the world and display it on the screen. Your output must look like this: A... .... .... .... Write your program and test that it works. Save your program as GAME_<your name>_<your class>_<index number>.py [4] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
7 10 Movement in the world is done using the keys ‘w’, ’s’, ’a’, ’d’, which correspond to Key Movement w Up s Down a Left d Right Extend your program to do the following: • Asks the user to enter his move sequence as a string. For example, entering “sdsdsd” means to move in the sequence down, right, down, right, down, right. • Output the updated state of the world to the user with all visited spaces represented by the letter ‘A’ instead of ‘.’. For example, entering “sdsdsd” will result in the updated state: A... AA.. .AA. ..AA • Note that: o You can assume that users will always enter move sequences that are within the given grid. o It is alright to visit a space more than once. Write your program and test that it works. Save your program as GAMEA_<your name>_<your class>_<index number>.py [7] 11 Use the following test data to test your program: ssddds Take a screen shot of your results and save the screenshot as GAMERESULT_<your name>_<your class>_<index number> Save your file in either .png or .jpg format. [2] 12 Save your program as GAMEB_<your name>_<your class>_<index number>.py Extend your program to a 2-player game by adding the following: • Prompt for Player B’s move sequence after Player A has entered his. • Player B starts at space 15, which is the bottom-right corner of the world. • Output the updated state incorporating both players’ moves. • Show ‘B’ in spaces visited by Player B only. • Show ‘X’ in spaces visited by both Player A and B. Save your program. [5]
8 13 Save your program as GAMEVAR_<your name>_<your class>_<index number>.py Extend your program to work
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

