SPS 2019 P2
SPS 2019 P2
PATRICK'S SCHOOL
PRELIMINARY EXAMINATIONS 2019
SECONDARY 4 EXPRESS
NAME
CLASS INDEX
NUMBER
COMPUTING 7155/02
Paper 2 Practical (Lab-based) 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)
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.
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.
This document consists of 7 printed pages including this page and ANNEX A.
2
[Turn over
3
[Turn over
4
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.
3 Use an appropriate function to search for the Cost per Night in the Room Type table, and [2]
use it to complete the Cost column. The cost must take into consideration the Number of
Nights each customer is staying.
4 Use a conditional statement to identify whether a customer will receive the Discount. Only [2]
members will receive a 20% discount and the corresponding cells must display this discount.
5 Use a conditional statement to calculate the total cost of each customer’s stay at the resort in [2]
the Total Cost column. The Total Cost must take into account any discount given to the
customer.
6 In cell H20 enter a formula to calculate the average revenue for the month. If the average [2]
revenue exceeds $400, use conditional formatting to fill cell H20 with green colour.
[Turn over
5
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
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))
(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 [2]
outputs the performance category and raise.
(c) When an invalid rating is entered, the program displays an error message and prompts the [3]
user to re-enter using the correct rating.
Save your program.
[Turn over
6
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.
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 = []
remaining = 0
sum_digits = 0
number_str = number
counter = len(number_str)
test_number = number
if sum_digits == number:
result = result.append(number)
9 Identify and correct the errors in the program so that it works according to the criteria given. [10]
[Turn over
7
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.
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.
End of Paper