Pathlight 2020 P2
Pathlight 2020 P2
PRELIMINARY EXAMINATION
SECONDARY 4 EXPRESS
CANDIDATE
NAME
CENTRE
NUMBER S INDEX
NUMBER
COMPUTING 7155/02
Paper 2 Practical (Lab-based) August 2020
2 hours 30 minutes
Additional Materials: Electronic version of FEELOAN.xlsx data file
Electronic version of TEMP_CHECK.py file
Electronic version of INTEGER.py file
Insert Quick Reference Glossary
READ THESE INSTRUCTIONS FIRST
Write your Centre number, Index number and name in the spaces at the top of this page.
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 marks for this paper is 50.
Task 1
BCOC bank provides school fee loan (based on a yearly compounded interest scheme) to new
tertiary students. The bank manager wants to use spreadsheet software to record the details of
the transactions in the first quarter of 2020.
You are required to finish setting up the spreadsheet to record the interest each student needs to
pay back. Do note that the repayment of the loan is only done at the end of the loan period (i.e.
only lump sum payment accepted)
Open the file FEELOAN.xlsx. You will see the following data.
2 The fourth to fifth characters of the Transaction ID indicates the age of the student.
For example, Transaction ID STL23ER indicates that student’s age is 23 years old.
In cells B4 to B18 enter a formula to calculate the age of the student and use it to complete
the Age column.
[1]
3 In cell C21 enter a formula to count the number of transactions made. [1]
3
4 In cell C22 enter a formula to calculate the range of the number of years loaned. [1]
5 In cells E4 to E18 enter a formula that uses an appropriate function to search for the
Interest Rate per Annum in the Rates table and use it to complete the Interest Rate
column. [1]
6 Format all cells in the Interest Rate column to automatically show a red text for values of
more than 1.5%. [1]
7 Enter a formula to calculate the total interest payable by students at the end of the loan
period and use it to complete the Total Interest Payable column.
(Hint: Total interest payable = Total Lump Sum Payment of the Loan – Principal Amount of
the Loan) [2]
8 In cells G4 to G18 enter conditional statement(s), to identify students who have loaned at
least $50,000 or have a loan period of more than 5 years and put ENTITLED in the Free
Laptop column. Otherwise put NO in the Free Laptop column. [2]
Save and close your file.
[Turn over
4
Task 2
The following program checks whether the student is able to attend school. It requires the
input of body temperature for 25 students, an input of any cough or flu symptoms for each
student and prints out if he/she is fit to attend school.
student_no = 25
for i in range(student_no):
temperature = float(input("Enter temperature in degree C: "))
symptom = input("Do you have any flu/cough symptoms? (Y/N): ")
if temperature >= 38:
print("You are having fever. Stay home & consult a doctor ")
if symptom == 'Y':
print("You are having flu/cough symptoms. Stay home &
consult a doctor")
(a) Accepts temperature and flu/cough symptoms input for only 10 students. [1]
(c) Tests if the temperature is between 34 to 42 (inclusive), and if not, asks the user for
temperature input again as necessary. [3]
Edit your program so that it works for any number of students. [2]
Task 3
The following program below reads positive integer(s) entered by a user. It stops when “end” is
entered.
If the user enters anything else, the program will print an error message and ask the user to enter
the input again. Before the program exits, it will print the following:
total = 1
even = 0
count = 0
while True
x = input"Enter a positive integer. Type 'end' to finish."
if x = "end":
break
elif x.isdigit():
print ("Invalid input. Try again.")
else:
x = integer(x)
if x // 2 == 0:
even += 1
total -= x
count += 1
average = round(total/count, 1)
if count == 0:
x = 0
average = "NA"
total = "NA"
10 Identify and correct the errors in the program so that it works accordingly to the rules given.
[10]
Save your program.
[Turn over
7
Task 4
• Player A thinks of a word but will not reveal to Player B who is guessing
• Instead, Player A will reveal the number of characters (asterisks) that corresponds
to the word he/she has in mind.
• Player B then guesses an alphabetical letter.
• If the guess is correct, the letter(s) will reveal themselves.
• If the guess is incorrect, Player B will have used up 1 try
• If all letters are not revealed by the end of 6 tries, Player B will lose and program will
end with an output of a specific message.
• If all letters are revealed before then, Player B will have won the game and program
will end with an output of a specific message.
Below are 2 samples of how the game can be played using the game program.
Do note that the word given for the game program by Player A is ‘mammals’.
Sample 1
Sample 2
Your program should work accordingly to the 2 above mentioned samples. [13]
(Hint: It would be helpful to start your program containing at least 2 variables of suitable data
types)
A programmer has decided to modify the game program such that it works for any word Player A
enters.
Extend your program so that it works for any word Player A enters. [4]
BLANK PAGE
10
BLANK PAGE