JYSS 2020 Computing P2
JYSS 2020 Computing P2
CANDIDATE NAME
COMPUTING 7155/02
Paper 2 (Practical) 1 Sep 2020
2 hours 30 minutes
Additional Materials: 1 x Thumb Drive
Electronic version of TASK1.xls file
Electronic version of TASK2.py file
Electronic version of TASK3.py file
Insert 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.
Task 1 10
Task 2 10
Task 3 10
Task 4 20
Total 50
This document consists of 7 printed pages, 1 blank page and 2 pages of Python Quick Reference.
[Turn over
2
Task 1
Thorntastic Durian Imports uses a spreadsheet to track its durian sales records. You are
required to finish setting up the spreadsheet to record the monthly sales data for the month of
March.
Open the file TASK1.xlsx. You will see the following data.
Some of the rows in the file have been hidden in the display below.
The Order Code is made up of 13 characters and the breakdown of the code is shown
below.
Separator Separator
I M - M S W 1 2 4 5 - M Y
For the cell range C7:C35, use an appropriate function to extract the Durian
Code from the Order Code. [2]
2 Use an appropriate function to search for the Cost per KG in the Durian Price
table given and use it to complete the Total Sales before Discount ($) column.
The sales must take into consideration the Quantity Ordered (KG). [3]
3 For the cell range F7:F35, use an appropriate function to extract the Country
Code from the Order Code. [1]
4 Use a conditional statement to identify orders that qualify for a discount or incur
a surcharge. If the country code for the order is SG or MY, it qualifies for a
Discount. If the country code for the order is OT, it incurs a Surcharge. [2]
5 Orders that qualify for a discount are given 12% off the total sales while orders
that incur a surcharge have to pay 20% more than their total sales.
Use a conditional statement to calculate the actual sale of each order in the
Actual Sales ($) column. [2]
Task 2
The following program accepts the age in years for five employees and prints out the oldest
age.
oldest = 0
counter = 0
(b) Prints out the oldest age as well as the average age of all employees, rounded
down to a whole number. [4]
(c) Tests if the age is between 21 and 65 inclusive, and if not, asks the user for
another input. [3]
7 Edit your program so that it works for any number of employees. [2]
Task 3
A number is said to be an Armstrong number when the sum of its digits raised to the power of
the length of the number becomes equal to the number itself.
A computing student wrote the following program to display the list of Armstrong numbers from
a user-defined range of numbers. However, there are syntax and logical errors in the program.
result = []
while check != 0:
remainder = number%10
sum_digits += remainder*power
check = check%10
8 Identify and correct the errors in the program so that it works correctly according to
the rules given. Save your program. [10]
Task 4
You have been asked to write a program to simulate the Atbash Cipher.
The Atbash Cipher is a substitution cipher with a specific key where the letters of the alphabet
are reversed; i.e. all 'A's are replaced with 'Z's, all 'B's are replaced with 'Y's, and so on. It was
originally used for the Hebrew alphabet, but can be used for any alphabet.
The table below shows how the cipher works for the Latin alphabet.
10 When your program is working, use the following plaintexts as test data to show
your test results:
Extend your program to also allow user to choose to do a double encryption. [5]
A double encryption will flip the original encrypted message and add ‘%’ after
every two characters. A sample output could look like this:
Enter 1 for Single-level encryption
or 2 for Double-level encryption: 2
Please enter your plaintext: hello world!
Encrypted message: !W%OI%LD% L%OO%VS%
End of Paper
BLANK PAGE