MFSS 2020 P2
MFSS 2020 P2
Secondary 4 Express
COMPUTING 7155/02
Paper 2 Practical (Lab-based) 1 Sep 2020 (Tue)
Write your name, index number and class in the spaces provided at the top of this page.
Write in dark blue or black pen.
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.
Task 1
A loan broker keeps track of his clients’ housing loans using a spreadsheet. The rates of
three banks are compared and the best (lowest) rate is used to calculate each client’s
Monthly Payment.
Open the file LOANS.xlsx. You will see the following data.
1 In cells F2 to F13 enter a formula that uses an appropriate function to search for
the rate offered by Bank C for each given principal. The rates offered by each
bank is given in the Rates table. [2]
2 In cells G2 to G13 enter a formula to determine the Best Rate among the rates
offered by the three banks. The best rate is the lowest of Rate A, Rate B, and Rate [2]
C
4 In cells I2 to I13 enter a formula to calculate the Total Payment made of a loan
based on the Best Rate. The Total Payment made is the sum of all monthly
payments for the duration of the loan. [2]
5 In cells J2 to J13 enter a formula to calculate the Total Interest paid of a loan
based on the Best Rate. The Total Interest paid is amount of interest that was paid
to the bank for the duration of the loan. [2]
Task 2
The following program is a number guessing game that allows the user to guess a randomly
generated number between 1 and 10 inclusive.
import random
ans = random.randint(1,10)
x = int(input("Enter a number: "))
while x != ans:
if x < ans:
print("Your guess is too low!")
else:
print("Your guess is too high!")
x = int(input("Enter a number: "))
print("Correct!")
(a) Generates a number between 1 and 100, inclusive, instead of 1 to 10. [1]
(b) Counts the number of tries the user has used, and prints it out at the end. [3]
(c) Performs data validation on the user input. Informs the user if his input is not
an integer and allow him to enter again. [4]
Extend your program so that the user can only guess up to 8 times. Output an
appropriate message if he has used up all 8 tries and has yet to correctly guess [2]
the number.
Task 3
The following program calculates the number of Points scored by a 16 year-old male student
doing his Standing Broad Jump station in a NAPFA test. Subjects are given two tries and the
better of the tries is used to determine the score he scores. The score table is shown below.
There are several syntax errors and logical errors in the program.
8 Identify and correct the errors in the program so that it works correctly according to
the rules above. [10]
Task 4
In computer Role Playing Games (RPGs), a world is presented to the user and he
explores it by moving about, picking up valuable items and fighting enemies along the
way.
12 13 14 15
The game starts by presenting the initial state of the world to the user. Each space is
represented by a character:
Character Represents
. Unexplored space
A Space explored by Player A
The player always starts at space 0, which is at the top-left corner of the world.
9 Represent the world in a suitable structure. Construct the initial state of the world
and display it on the screen. Your output must look like this:
A...
....
....
....
[4]
Write your program and test that it works.
10 Movement in the world is done using the keys ‘w’, ’s’, ’a’, ’d’, which correspond to
Key Movement
w Up
s Down
a Left
d Right
ssddds
Extend your program to work with square-shaped worlds of any size, adhering to
the previous rules:
• Player A starts at the top-left corner of the world.
• Player B starts at the bottom-right corner of the world. [2]
End of Paper