SPS 2020 Computing P2
SPS 2020 Computing P2
PATRICK'S SCHOOL
PRELIMINARY EXAMINATIONS 2020
SECONDARY 4 EXPRESS
NAME
CLASS INDEX
NUMBER
COMPUTING 7155/02
Paper 2 (Lab-based) 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
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 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.
1 The fifth character of each Transaction Number is the Code of the Package Name. In cells [2]
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 In cells E7 to E16 enter a formula that uses an appropriate function to search for the Price in [2]
the Package table. Use it to calculate the Full Cost in currency format.
3 In cells G7 to G16 enter a formula that uses an appropriate function to search for the [2]
Discount in the Discount table. Use it to calculate the Discount given in currency format.
4 In cells H7 to H16 enter a conditional statement to calculate the Revenue. If the Transaction [2]
Type is CORPORATE, apply an additional 2% of the Revenue.
5 In cells F36 to H36 enter a conditional statement to calculate the number of each Transaction [2]
Type.
[Turn over
5
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.
6 Edit the program so that the username is created using the first 5 characters of the user’s [3]
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.
7 The program needs to validate both the password and whether the user has correctly re-
entered their password.
• 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
[3]
enters a valid password.
• 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 [email protected] [4]
[Turn over
6
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".
data
negatives = []
positives = []
zeroes = []
num_zeroes = 0
data = sort()
print("\nThe integers, sorted in ascending order, are: {}\n".format(data))
num_zeroes = count(zeroes)
print("\nThere are {} zeroes.", num_zeroes)
8 Identify and correct the errors in the program so that it works according to the requirements [10]
given.
[Turn over
7
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.
• 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.
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.
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.
End of Paper