0% found this document useful (0 votes)
28 views7 pages

SQSS 2018 P2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views7 pages

SQSS 2018 P2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

1

Class: Candidate Name: Candidate Index Number:


o

SHUQUN SECONDARY SCHOOL


2018 Preliminary Examination
SHUQUN SECONDARY SCHOOL
Secondary 4 Express
Computing 7155/02
Paper 2 Practical (lab-based) 13 September 2018

2 hours 30 minutes

Additional Materials: Electronic version of LIBRARY.xlsx data file


Electronic version of RAINFALL.py file
Electronic version of BMI.py file
Insert Quick Reference Glossary

READ THESE INSTRUCTIONS FIRST

DO NOT WRITE IN ANY BARCODES.

Approved calculators are allowed.

Answer all questions.

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.

Programs are to be written in Python.


Save your work using the file name given in the question as and when necessary.

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.

FOR EXAMINER’S USE

Total 50

SQSS 1NT EOYThis


2016document consists of 7 printed
Computer pages, including this cover page.
Applications [Turn over
[Turn over
2

Task 1 (10 marks)


A community library uses a spreadsheet to record the books borrowed by its
members. You are required to complete the setting up the spreadsheet to record the
books that are overdue.

Open the file LIBRARY. You will see the following data.
Save the file as MYLIBRARY_<your name>_<centre number>_<index number>.

1 In cell B3 enter a function to return today’s date. [1]

2 The second to fifth digits of the Borrower ID indicates the date of birth
of the borrower. For example, Borrower ID F19900762 indicates that
the date of birth of the borrower is 1990.
Enter a formula to calculate the age of the borrower and use it to
complete the Age column. [2]

3 Use an appropriate function to search for the Item Type in the Loan
Type table and use it to complete the Due Date column in the
Borrowers List table. [2]

SQSS 4E Prelim 2018 Computing [Turn_over


3

4 Use a conditional statement to check if a borrowed item was overdue,


if an item was overdue put the number of days overdue in the Days
Overdue column else If an item had not been returned or was not due
yet put a value of 0. Complete the Days Overdue column. [2]

5 If an item was overdue for more than 60 days a status value of


SUSPENDED is shown in the Status column else if it was overdue for
more than 30 days but less than or equal to 60 days, a status value of
WARNING is shown. Otherwise an OK status value is shown [2]

6 In the Status column, format the cells to automatically show a red


background when the status value is SUSPENDED and a yellow
background when the status value is WARNING. [1]
Save and close your file.

SQSS 4E Prelim 2018 Computing [Turn_over


4

Task 2 (10 marks)


The following program prompts the user to enter the amount of rainfall recorded in mm
over 1 week and prints out the highest rainfall recorded for that week. The rainfall is
recorded to the nearest mm.

highest_rainfall=0
for day in range(7):
rainfall = int(input("Enter rainfall recorded in mm: "))
if rainfall > highest_rainfall :
highest_rainfall = rainfall
print("Highest rainfall recorded for the week is ",
highest_rainfall)

Open the file RAINFALL.py

Save the file as MYRAINFALL_<your name>_<centre number>_<index number>.

7 Edit the program so that it:


(a) Prints the highest and lowest rainfall for the week. [2]
(b) Prints the average rainfall for the week, the average value
should be rounded to 2 decimal place. [2]
(c) Validates that the rainfall entered is a non-negative integer, and
if not, prompts the user to enter again as necessary. [4]

Save your program.

8 Save your program as


VARAINFALL_<your name>_<centre number>_<index number>.
Edit your program to allow user to specify how many days of rainfall
to enter, calculates and display results based on the number of days
entered. You can assume that the user enters a positive integer. [2]

SQSS 4E Prelim 2018 Computing [Turn_over


5

Task 3 (10 marks)


A recruitment exercise requires that the applicants have a BMI value of between 18.5
to 22.9 kg/m% (inclusive). The following program calculates the number of people
who are accepted and the number of people who are rejected. The program terminates
when a weight of zero or a height of zero is input. The number of people who are
accepted and the number of people who are rejected are then printed.
The program uses the following rules:
• The weight is entered in kilogram (kg) rounded to 1 decimal place and the height
is entered in meters (m) rounded to 2 decimal place. (You can assume that the
user enter these correctly)
• The program uses the following formula for calculating the value of BMI:
𝐁𝐌𝐈 = 𝐰𝐞𝐢𝐠𝐡𝐭 ÷ (𝐡𝐞𝐢𝐠𝐡𝐭 × 𝐡𝐞𝐢𝐠𝐡𝐭).
• The BMI value is rounded to 1 decimal place.
There are several syntax and logical errors in the program.
weight=float(0)
height=float(0)
bmi=float(0)
accepted=0
rejected=10
weight=float(input("Enter weight in kg: ")
height=float(input("Enter height in m: "))
while not weight=0 and not height=0:
bmi= round(weight/(height * height),1)
print("bmi=",bmi)
if bmi >= 18.5 or bmi < 22.9:
accepted = accepted + 1
else:
rejected = rejected - 1
print("Total accepted = ", accepted)
print("Total rejected = ", rejected)

Open the file BMI.py.

Save the file as MYBMI_<your name>_<centre number>_<index number>.

9 Identify and correct the errors in the program so that it works correctly
according to the rules above. [10]

Save your program.

SQSS 4E Prelim 2018 Computing [Turn_over


6

Task 4 (20 marks)


A program is to be written to accept the marks obtained by four
students in four subjects, English, Mother Tongue, Math and Science.
The program will calculate the average marks for each student.

The program should allow you to:

• Prompt user to enter the marks for each student in the format a, b,
c, d, where a is the mark for English, b is the mark for Mother
Tongue, c is the mark for Math and d is the mark for Science.
An example is 67,78,81,75
• The marks entered must be an integer from 0 to 100. Program will
terminate when there is an invalid input.
• After the students’ marks are entered, the program will then
calculate and print each student’s average mark for the four
subjects. The average mark must be rounded to the nearest
integer.

Example of prompts and inputs:

Enter marks for student1: 67,78,81,75


Enter marks for student2: 54,67,48,59
Enter marks for student3: 89,92,87,91
Enter marks for student4: 42,62,42,45

Your output must look like this:

Average marks for student1 is 75


Average marks for student2 is 57
Average marks for student3 is 90
Average marks for student4 is 48

10 Write your program and test that it works.

Save your program as


MARKS1_<your name>_<centre number>_<index number> [10]

SQSS 4E Prelim 2018 Computing [Turn_over


7

11 When your program is working, use the following test data to show
your text results:
67,78,81,75
54,67,48,59
89,92,87,91
42,62,42,45

Take a screen shot of your results and save it as a bitmap


MARKSRESULTS_<your_name>_<index number> [5]

12 Save your program as


MARKS2_<your name>_<centre number>_<index number>.
Extend your program to print the highest marks for each of the four
subjects.
Your output should look like this:

Highest mark for English is 89


Highest mark for Mother Tongue is 92
Highest mark for Math is 87
Highest mark for Science is 91

Save your program. [3]

13 Save your program as


MARKS3_<your name>_<centre number>_<index number>
Extend your program to work for any number of students.
Save your program. [2]

END OF PAPER

SQSS 4E Prelim 2018 Computing *

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy