ACSBR 2019 P2
ACSBR 2019 P2
Anglo-Chinese School
(Barker Road)
PRELIMINARY EXAMINATION 2019
SECONDARY FOUR
EXPRESS
COMPUTING
PAPER 2
7155/02
2 HOUR 30 MINUTES
INSTRUCTIONS TO CANDIDATES
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
A company uses a spreadsheet to record the loans from customers. You are required to
finish setting up the spreadsheet to calculate the monthly instalment for each of the account
number.
Open the file LOANS. You will see the following data.
1 Use a function to extract the type of loans from account number and use it to
complete the Loan Type column. The type of loans is the letters from the
account number. [2]
2 Use an appropriate function to search for the Interest rate per annum in the
Rates table and use it to complete the Interest rate per annum column. [2]
3 Use an appropriate function to search for the Processing Fee in the Rates table
and use it to complete the Processing Fee ($) column. The processing fee is a
percentage from the loan amount. [2]
4 Use an appropriate function to calculate the monthly instalment amount and use
it to complete the Monthly Instalment column. [2]
5 Use an appropriate function to find out the number of Car, Cash and Study in
the Loan Types table. [2]
Task 2
The following program accepts positive integer numbers and prints out the factors for the
numbers.
for i in range(2):
factor_count = 0
number = int(input("Enter a number:"))
for i in range(1,number+1):
if number%i==0:
factor_count += 1
(b) Prints out the factors for each of the number in a list. [4]
(c) Tests if the input is a positive number, and if not, asks the user for input
again. [3]
Task 3
The alphabet at the end of a NRIC number is called its check code. As its name suggests,
the check code allows us to check if a NRIC number has been entered correctly. The
algorithm for generating the check code is as follows:
1. Obtain the weighted sum of the NRIC digits using the weights [2, 7, 6, 5, 4, 3, 2].
For NRIC number 9300007, the sum is
(9 × 2) + (3 × 7) + (0 × 5) + (0 × 4) + (0 × 3) + (7 × 2) = 53
2. Find the remainder of the sum when divided by 11: 53 % 11 = 9
3. Subtract the remainder from 11: 11 − 9 = 2
4. Look the check code up:
1 2 3 4 5 6 7 8 9 10 11
A B C D E F G H I Z J
The check code for 9300007 is B.
There are several syntax errors and logical errors in the program.
check = (2, 7, 6, 5, 4, 3, 2)
code = ["A","B","C","D","E","F","G",H,"I","Z","J"]
total = 0
counter = 0
NRIC = input("Enter the NRIC:")
while NRIC.isalnum()== False and len(NRIC)!= 9:
if NRIC.isalnum()== False:
print("Special character is not allowed!")
else:
output("NRIC must be 9 digits")
NRIC = input("Enter the NRIC again:")
while counter<len(NRIC)-1:
for digit in check:
total += digit * NRIC[counter]
counter == 1
remainder = total//11
subtract = remainder - 11
if NRIC[1]==code[subtract-1]:
print("The NRIC is valid.")
else:
print("Invalid NRIC.")
8 Identify and correct the errors in the program so that it works correctly
according to the rules above. [10]
Task 4
• Enter the data in the format a b c d e where they are the attendance from Monday
to Friday. 1 represents present and 0 represents absent. An example is 1 0 1 1 0
• Make sure that the input is in the correct format
• Only allow data entry of 0 and 1
• Calculate the total number of days of present for each student
• Repeat for seven students
• Calculate the present rate for the whole week rounded to 1 decimal place. [Present
rate = total attendance / total possible attendance * 100%]
• Output the student with full attendance of the week
• Display this on the screen. Your output must look like this:
Student 1 3 day(s)
Student 2 4 day(s)
Student 3 3 day(s)
Student 4 5 day(s)
Student 5 4 day(s)
Student 6 3 day(s)
Student 7 5 day(s)
10 When your program is complete, use the following test data to show your test
result:
1 0 1 1 0
0 1 1 1 1
1 1 1 0 0
1 1 1 1 1
1 1 0 1 1
1 0 1 0 1
1 1 1 1 1
Extend your program to calculate the number of students present for each day.
Mon - 6 student(s)
Tue - 5 student(s)
Wed - 6 student(s)
Thu - 5 student(s)
Fri - 5 student(s)
[3]
Save your program.
End of Paper