2018 PRELIM COMPUTING P2
NAME:
CLASS: INDEX NO:
Qn ANSWER:
Task 1
1 =TODAY()
=YEAR($B$3)-MID(B8,2,4)
2
=VLOOKUP(D8,$B$27:$D$30,2,FALSE)+E8
3
=IF(G8-F8>0,G8-F8,0)
4
=IF(H8>60,"SUSPENDED",IF(H8>30,"WARNING","OK"))
5
Use the following conditional formatting :
Task 2
lowest_rainfall = 99999
7a
if rainfall < lowest_rainfall:
lowest_rainfall = rainfal
total_rainfall=0
total_rainfall += rainfall
7b
print("Average rainfall for the week is ",
round(total_rainfall/num_days,2))
while True:
input_str = input("Enter rainfall recorded in mm: ")
7c if input_str.isnumeric()and int(input_str)>=0:
break
num_days = int(input("Enter number of days: "))
8
for day in range(num_days):
Task 3
weight=float(0)
height=float(0)
bmi=float(0)
9 accepted=0
rejected=10
weight=float(input("Enter weight in kg: ")
2018 PRELIM COMPUTING P2
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
weight=float(input("Enter weight in kg: ")
height=float(input("Enter height in m: ")) #
print("Total accepted = ", accepted)
print("Total rejected = ", rejected) #
Task 4
10 Input list of marks saved in variable
Validation for 0 to 100 marks
Variable for total marks for student
Total marks for student updated correctly
Average marks calculation
Rounding
Correct loop for 4 students
11 4 lines of output according to requirements
Results are correct
12 A list is used to capture the marks for each subject
Correct result
13 Variable to capture number of students
Loop for number of students