2021 TSS Computing P2 Solutions
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Sec 4 Computing Prelim 2021 P2 Ans Scheme TASK 1 1 One mark: D4=VLOOKUP(C4,$L$4:$N$30,3,FALSE) One mark: Completing D4:D28 and F4:F28 columns 2m 2 G4=IF(LEN(G4)>0,VLOOKUP(G4,$L$4:$N$30,3,FALSE),0) Note: G4:D28 must be completed appropriately 1m 3 One mark for logical condition, one mark for calculation: I4=IF(AND(LEFT(C4)<>LEFT(E4),LEFT(G4)<>LEFT(E4),LEFT(C4)<>LEFT(G4),LEN(G4)>0) ,0.1*SUM(D4,F4,H4),0) Note: I4:I28 must be completed appropriately 2m 4 J4=SUM(D4,F4,H4)-I4 Note: J4:J28 must be completed appropriately 2m 5 One mark: O4=COUNTIF($C$4:$H$28,L4) One mark: Completing O4:O28 column 1m 6 J30=AVERAGE(J4:J28) 2m 7 1m
TASK 2 8a print("The solutions to this quadratic equation are {} and {}.".format(sol1,sol2)) 1m 8b if sol1==sol2: print("The only solution to this quadratic equation is {}.".format(sol1) else: print("The solutions to this quadratic equation are {} and {}".format(sol1,sol2)) 1 mark for checking if-else, 1 mark for appropriate output 2m 8c if (b**2-4*a*c)<0: print("There are no real solutions to this quadratic equation.") else: sol1 = (-b+(b**2-4*a*c)**0.5)/(2*a) sol2 = (-b-(b**2-4*a*c)**0.5)/(2*a) if sol1==sol2: print("The only solution to this quadratic equation is {}.".format(sol1)) else: print("The solutions to this quadratic equation are {} and {}".format(sol1,sol2)) 1 mark for checking if-else, 1 mark for appropriate output 2m 9a while confirm == "N": : confirm = input("The quadratic equation is {}x^2 + {}x + C = 0, correct? (Y/N):".format(a,b,c)) if confirm == "N": print("Please re-enter the values again.") 1 mark for loop control, 1 mark for formatting of input prompt and output 2m
9b 1 mark for each variable a, b and c, i.e. checking and correcting the equation if a == 1: eqn = "x^2 " elif a == -1: eqn = "-x^2 " else: eqn = str(a) + "x^2 " if b == 1: eqn = eqn + "+ x " elif b == -1: eqn = eqn + "- x " elif b < 0: eqn = eqn + "- " + str(-b) + "x " else: eqn = eqn + "+ " + str(b) + "x " if c < 0: eqn = eqn + "- " + str(-c) else: eqn = eqn + "+ " + str(c) confirm = input("The quadratic equation is {}, correct? (Y/N):".format(eqn)) 3m
TASK 3 10 One mark each: age = 2021 - int(input("Enter your year of birth: ")) allergy = input("Do you have any drug allergies? (Y/N): ") eligible_with_appt = [] eligible_without_appt = [] if age >= 60: if allergy == "N": eligible_without_appt = ["Pfizer-BioNTech"] eligible_without_appt += ["Moderna"] else: eligible_without_appt = ["Novavax"] elif age >= 18: if allergy == "N": eligible_with_appt = ["Pfizer-BioNTech"] eligible_without_appt = ["Moderna"]
Content continues in the PDF.
Related notes
- Computing o level notes Notes/Practices · 2023
- BVSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 MSExam Papers · 2024
- BVSS Prelim P1 MSExam Papers · 2024
- computing notesNotes/Practices

