SPS 2019 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 2019 SECONDARY 4 EXPRESS NAME CLASS INDEX NUMBER COMPUTING Paper 2 Practical (Lab-based) 7155/02 2 September 2019 2 h 30 min Additional Materials: Electronic version of RESORT.xlsx data file Electronic version of DISARIUM.py file Electronic version of RATING.py file Insert Quick Reference Glossary (ANNEX A)
2 [Turn over
3 [Turn over
4 [Turn over Task 1 A holiday resort, Red Resort uses spreadsheet software to calculate the cost of a holiday for each customer. The resort has five types of rooms and offers 20% discount for members. You are required to finish setting up the spreadsheet to calculate the cost for each customer. Open the file RESORT.xlsx. You will see the following data. Save the file as NOVRESORT_<Class>_<Class_Index_Number>_<Your_Name> 1 In cell C20 enter a formula to count the number of customers. [1] 2 In cell C21 enter a formula to count the number of Members. [1] 3 Use an appropriate function to search for the Cost per Night in the Room Type table, and use it to complete the Cost column. The cost must take into consideration the Number of Nights each customer is staying. [2] 4 Use a conditional statement to identify whether a customer will receive the Discount. Only members will receive a 20% discount and the corresponding cells must display this discount. [2] 5 Use a conditional statement to calculate the total cost of each customer’s stay at the resort in the Total Cost column. The Total Cost must take into account any discount given to the customer. [2] 6 In cell H20 enter a formula to calculate the average revenue for the month. If the average revenue exceeds $400, use conditional formatting to fill cell H20 with green colour. [2]
5 [Turn over Task 2 At a particular company, employees are rated at the end of each year. The rating scale begins at 0.0, with higher values indicating better performance and resulting in larger raises. The value awarded to an employee is either 0.0, 0.5, or 0.6. Values between 0.0 and 0.5, and between 0.5 and 0.6 are never used. The meaning associated with each rating is shown in the following table. The amount of an employee’s raise is $2600.00 multiplied by their rating. Rating Meaning 0.0 Unacceptable performance 0.5 Acceptable performance 0.6 Satisfactory performance The program below displays whether an employee’s performance rating and his raise based on the rating entered by the user. RAISE_FACTOR = 2600.00 D = 0.0 C = 0.5 B = 0.6 rating = float(input("Enter the rating: ")) if rating == D: performance = "Unacceptable" elif rating == C: performance = "Acceptable" elif rating == B: performance = "Satisfactory" else: performance = "" if performance == "": print("Invalid rating.") else: print("Based on that rating, the performance is %s." % performance) print("The employee’s raise is $%.2f." % (rating*RAISE_FACTOR)) Open the file RATING.py. Save the file as PERFORMANCE_<Class>_<Class_Index_Number>_<Your_Name>.py 7 Edit the program so that: (a) If the rating is A, the performance is “Meritorious”, where rating A means 0.7 or more. [2] (b) It prompts the user to enter the name of the employee and displays this name before it outputs the performance category and raise. [2] (c) When an invalid rating is entered, the program displays an error message and prompts the user to re-enter using the correct rating. Save your program. [3] 8 Save the file as VARPERFORMANCE_<Class>_<Class_Index_Number>_<Your_Name>.py Edit your program so that it works for any number of employees, as determined by the user. [3]
6 [Turn over Task 3 A number is said to be the Disarium number when the sum of its digits raised to the power of their respective positions becomes equal to the number itself. For example, 175 is a Disarium number as follows: 11+ 72 + 53 = 1+ 49 + 125 = 175 A computing student wrote the following program to display the list of disarium numbers from a user-defined range of numbers. However, there are syntax and logical errors in the program. result = [] limit = int(input("Range of numbers to be tested is 1 to n inclusive. State your n: ") print("The program is now checking for disarium numbers from 1 to {}...".format(limit)) for number in range(1, limit+1) remaining = 0 sum_digits = 0 number_str = number counter = len(number_str) test_number = number while number > 0: remaining = test_number%10 sum_digits += (remaining*counter) test_number = test_number/10 counter -= 1 if sum_digits == number: result = result.append(number) print("The disarium numbers between 1 to {} are {}: ".format(limit, result)) Open the file DISARIUM.py. Save the file as DISARIUM_LIST_<Class>_<Class_Index_Number>_<Your_Name>.py 9 Identify and correct the errors in the program so that it works according to the criteria given. Save your program. [10]
7 End of Paper Task 4 You have been asked to create a program to determine the type of integer triangle from a given set of dimensions. Your program should: • Accept 3 integer lengths (in cm) of the desired triangle as input in the format a, b, c. • Validate that there are exactly 3 positive integers in the input, and asks the user to re-enter the input where necessary. • Determine the type of triangle based on the input. Type of Triangle Condition Output Invalid The longest side of the triangle is greater than the sum of its two shorter sides The dimensions provided cannot form a triangle. Equilateral All 3 sides are identical in length You have entered an equilateral triangle. Isosceles Only 2 of the 3 sides are identical in length You have entered an isosceles triangle. Scalene All sides are different in length You have entered a scalene triangle. 10 Write your program and test that it works. Save your program as MYTRIANGLES1_<Class>_<Class_Index_Number>_<Your_Name>.py [10] 11 When your program is complete, test it for the following: Side Input Expected Output Test 1 2, 4, 10 The dimensions provided cannot form a triangle. Test 2 6, 6, 6 You have entered an equilateral triangle. Test 3 10, 6, 6 You have entered an isosceles triangle. Test 4 3, 4, 5 You have entered a scalene triangle. Take a screenshot of each of the above four tests and save as TEST_<Test_Number>_<Class>_<Class_Index_Number>_<Your_Name> in either .png or .jpg format. [5] 12 It is known from the converse of Pythagoras’ theorem that a triangle is right-angled if the sum of the squares of its two shorter sides adds up to the square of its longest side. It follows that a triangle is obtuse if the sum of the squares of its two shorter sides is smaller than the square of its longest side. Modify the program such that in addition to the aforementioned categories, it should also state in its output if the triangle happens to be right-angled or obtuse. Save your program as MYTRIANGLES2_<Class>_<Class_Index_Number>_<Your_Name>.py [5]
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

