MSHS 2018 P2
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Text from the first pagesClass Index Number Name MARIS STELLA HIGH SCHOOL PRELIMINARY EXAMINATION SECONDARY FOUR COMPUTING 7155/02 Paper 2 Practical (Lab-based) 29 Aug 2018 2 hours 30 minutes Additional Materials: Electronic version of TUITION.XLSX data file Electronic version of SORTNUMBER.PY data file Electronic version of HEIGHT.PY data file Insert Quick Reference Glossary READ THESE INSTRUCTIONS FIRST 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. For Examiner’s Use This document consists of 6 printed pages. 50
2 Task 1 A&J Tuition Agency uses spreadsheet software to record the financial details of the company. You are required to finish setting up the spreadsheet to record the details. Open the file TUITION.XLSX. You will see the following data. Save the file as TUITION_<your name>_<class>_<index number> Click on the Salary Pay-out Table worksheet to do the following questions. 1 Use an appropriate function to search for the Salary Scheme in the Job Scheme Table and use it to complete the Salary Scheme (per Hour) column. [2] 2 Enter a formula to calculate the monthly salary for each worker and use it to complete the Monthly Salary column. [1] 3 In cell E14 enter a formula to calculate the total monthly salary paid out by the agency. [1] 4 In cell B20 enter a formula to calculate the total number of hours of tuition taught by the tutors of the agency. [1] Click on the Bank Loan worksheet to do the following questions. 5 In cell B6 enter a formula to calculate the amount of loan repayment that is required based on the values in cell B3 to B5. [1]
3 Click on the Overall worksheet to do the following questions. 6 In cell E7 enter a formula to calculate the amount of earnings of the agency, from tuition, based on the total number of classes, students per class and amount paid per student. [1] 7 In cell B10 enter a formula to calculate the total earnings of the tuition agency after deduction of the monthly liabilities. [1] 8 In cell B11 enter a conditional statement to identify the total earnings calculated in cell B10. If the total earnings calculated is below $0, put Loss. If it is above $0, put Profit. And if it is equal to $0, put Break Even. [1] Save the file as TUITION_IF_<your name>_<class>_<index number> 9 Use an appropriate feature of spreadsheet to find out how many students per class is required in order for the Total Profits per Month to be at “Break Even” [1] Save and close your file. Task 2 The following program accepts the height in metres(m) for 12 students and prints out the tallest height and the average height. The heights are in the range of 1.2m to 2.85m. highest = 1.2 total_height = 0 no_of_students = 12 for student in range (no_of_students): height = float(input("Enter the height of student in metres(m): ")) if highest < height: highest = height total_height = total_height + height average_height = total_height/no_of_students print("Highest height of student is ", highest) print("Average height of students is ", average_height) Open the file HEIGHT.py Save the file as MYHEIGHT_<your name>_<class>_<index number> 10 Edit the program so that it: (a) Accepts height for 36 students. [1] (b) Prints out the shortest height as well as the tallest height. [4] (c) Test if the height input is between 1.2m and 2.85m (inclusive), and if not, asks the user for input again as necessary. [3] Save your program.
4 11 Save your program as CLASSHEIGHT_<your name>_<class>_<index number> Edit your program so that it works for any number of students. [2] Save your program. Task 3 The following program should read integers from the user until a “q” is entered. Once all of the integers have been read, the program should display: - all of the negative integers, followed by all of the zeros, followed by all of the positive integers - the numbers should be printed in the same order that they were entered by the user - each number should be printed on its own line. There are several syntax errors and logical errors in the program. negative = [ ] positives = [ ] zeros = "" number = input("Enter an integer(enter q to quit): ) while number <> "q": num = str(number) if num < 0: negatives.append(num) elif num >= 0: positives.append(num) else zeros += num number = input("Enter an integer(enter q to quit): )" print("The numbers were: ") for n in negatives: print(negatives[n]) for z in zeros: print(zeros[z]) for p in positives: print(positives[p]) Open the file SORTNUMBER.py Save the file as MYNUMBER_<your name>_<class>_<index number> 12 Identify and correct the errors in the program so that it works correctly according to the rules above. [10] Save your program.
5 Task 4 You have been asked to write a program to verify the check digit of an ISBN number. The last number at the end of the ISBN number is called a check digit. The check digit allows us to check if the ISBN number has been entered correctly. The algorithm for generating the check code is as follows: • Obtain the weighted sum of the ISBN digits using the weights [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3]. For ISBN number 978-0-306-40615-7, the sum is (9 x 1) + (7 x 3) + (8 x 1) + (0 x 3) + (3 x 1) + (0 x 3) + (6 x 1) + (4 x 3) + (0 x 1) + (6 x 3) + (1 x 1) + (5 x 3) = 93 • Find the remainder of the weighted sum when divided by 10. • If the remainder is equal to 0 then the check digit equals to zero • If not, subtract the remainder from 10 to obtain the check digit. The check digit 7 for 978-0-306-40615-7 is correct. The program should allow you to: • Enter an ISBN number in the format 000-0-000-00000-0 • Ensure that only numbers in the correct format is accepted • Calculate the weighted sum of the ISBN number. • Calculate the remainder of the weighted sum. • Calculate the check digit and verify if the ISBN entered is correct. • Display the output on the screen. Your output must look like this: The ISBN no. to check is : 123-3-333-43234-0 Weighted sum is : 70 Calculated check digit: 0 The ISBN number is correct. 13 Write your program and test that it works. [10] Save your program as MYISBN_<your name>_<class>_<index number> 14 When your program is working, use the following test data to show your test results: 123-3-333-43234-0 425-9-594-49137-3 784-2-362-74829-8 Take a screen shot of your results and save it as a bitmap ISBNRESULT_<your name>_<class>_<index number> [5] 15 Save your program as ISBNCON_<your name>_<class>_<index number> Extend your program to continuously check the numbers until “q” is entered Save your program. [2]
6 16 Save your program as ISBNCHANGE_<your name>_<class>_<index number> Extend your program to allow the user to enter the weights and calculate the check digits based on the new weights. The user should be asked to key in weights in the format [x,x,x,x,x,x,x,x,x,x,x,x] (should only be 12 digits) then ask for the ISBN number to be checked. Save your program [3] -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 CPExam Papers · 2024
- BVSS Prelim P1 MSExam Papers · 2024
- CWSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 MSExam Papers · 2024
- computing notesNotes/Practices
- SST 2024 Prelim Paper 1 [revised for 2025] Exam Papers · 2024
- SST 2024 Prelim Paper 1 Ans [revised for 2025] Exam Papers · 2024
- [Notes for Computing] Heavily Compressed TextbookNotes/Practices · 2025
- [Notes for Computing] All Definitions/ TermsNotes/Practices · 2025
- (Notes) Heavily Compressed TextbookNotes/Practices · 2025
- See all Computing notes

