2022 ACSBR Computing P2 Solutions
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Text from the first pagesSecondary 4 Express 1 Computing 7155/02 Anglo-Chinese School (Barker Road) Preliminary 2022 SECONDARY FOUR EXPRESS COMPUTING PRELIMINARY EXAMINATION Task 1 MYCUSTOMER Marking Scheme Paper 2
Secondary 4 Express 2 Computing 7155/02 Anglo-Chinese School (Barker Road) Preliminary 2022 Question Answer Marks 1 One mark for correct working conditional IF formula (in cell B3), One mark for the rest =IF(MID(A20,3,1)="S", "Staff", IF(MID(A20,3,1)="M", "Member", "Non-Member")) [1] [1] 2 One mark for correct working HLOOKUP formula (in cell D3), One mark for the rest =(1-HLOOKUP(B3,$A$23:$D$24,2,TRUE))*C3 [1] [1] 3 One mark for correct working ROUND formula (in cell F3), One mark for the rest =FLOOR.Math(D3,1) [1] [1] 4 One mark for correct working SUMIF formula (in cell B23), One mark for the rest =SUMIF($B$3:$B$20,B23,$E$3:$E$20) [1] [1] 5 One mark for yellow fill for cells with staff, One mark for whole row. =$B3="Staff" [1] [1]
Secondary 4 Express 3 Computing 7155/02 Anglo-Chinese School (Barker Road) Preliminary 2022 Task 2 MYFIB n1 = 0 n2 = 1 fiblist = [] #8 while True: #7 nterms = int(input("Enter the nterm(s): ")) #6 if nterms > 0: #7 break else: print("nterms must be a positive integer.") #7 for i in range(nterms): print(n1) fiblist += [n1] #8 nth = n1 + n2 n1 = n2 n2 = nth print(fiblist)#8 Task 2 INFIB n1 = 0 n2 = 1 fiblist = [] nterms = 100 for i in range(nterms): fiblist += [n1] nth = n1 + n2 n1 = n2 n2 = nth print(fiblist) num = int(input("Enter the number: "))#9 if num in fiblist:#9 print("Yes, it is in the 100th sequence")#9 else: print("No, it is not in the 100th sequence") Question Answer Marks 6 One mark for input of nterms with appropriate message [1] 7 One mark for using while loop One mark for correct condition One mark for appropriate error message [1] [1] [1] 8 One mark for initialisation list One mark for adding terms in the list One mark for printing the list [1] [1] [1]
Secondary 4 Express 4 Computing 7155/02 Anglo-Chinese School (Barker Road) Preliminary 2022 9 One mark for input of the positive integer One mark for checking if the number is in the 100th list One mark for output message is appropriate [1] [1] [1] Task 3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 while True: date = input("Enter the date (DD-MM-YYYY): ") #1 test = date if len(test)== 10 and test[2]=="-" and test[5]=="-": #2 day = int(test[0:2]) month = int(test[3:5]) #3 year = int(test[6:]) check_year = year>1900 and year<=2022 #4 check_month = month>=1 and month<=12 #5 check_day_31 = day<=31 and (month in [1,3,5,7,8,10,12]) check_day_30 = day<=31 and (month in [4,6,9,11]) check_day_Feb = month == 2 and ((day<=29 and year%4==0) or day<=28)#6 if check_year: #7 if check_month: if check_day_31 or check_day_30 or check_day_Feb: #8 break else: print("Error in day") else: print("Error in month") #9 else: print("Error in year") #9 else: print("Error in format") #10 print("Date accepted") Question Answer Marks 10 One mark for correct indent (line 2) [1] One mark for using == to compare len(test)instead of = (line 4) [1] One mark for correct string slicing [3:5] (line 6) [1] One mark for correct current year 2022 instead of 2000 (line 8) [1] One mark for using and instead of or (line 9) [1] One mark for changing month == 2 (line 12) [1] One mark for adding _ for variable check_year (line 13) [1] One mark for adding : at the end of if (line 15) [1] One mark for swapping the “month” and “year” in the output (line 20 & 22) [1] One mark for adding “ for the output (line 24) [1]
Secondary 4 Express 5 Computing 7155/02 Anglo-Chinese School (Barker Road) Preliminary 2022 Task 4 def get_price(item): cake_list = ["A", "B", "C", "D","E","F","G","H"] price_list = [25, 22, 38, 35, 15, 40, 53, 20] position = cake_list.index(item) return price_list[position] def get_input(): while True: choice = input("Enter the choice of cake: ") if choice in ["A", "B", "C", "D","E","F","G","H"]: break else: print("Enter an uppercase letter between A to H only") return choice def get_order(): total = 0 while True: cake = get_input() total += get_price(cake) cont = input("More purchase? Y or N: ") if cont == "N": GST = 0.07 GST_amt = round(GST*total,2) GST_list = str(GST_amt).split(".") cents = GST_list[1] if int(cents[-1])>=5: final_GST = str(GST_list[0])+"."+str(GST_list[1])[0]+"5" else: final_GST = str(GST_list[0])+"."+str(GST_list[1])[0]+"0" final = total + float(final_GST) final_list = str(final).split(".") if len(final_list[1])== 1: final_list[1]+="0" final_display = final_list[0]+"."+final_list[1] else: final_display = str(final) print("") print("Subtotal \t" + "$ " + str(total)) print("GST \t\t" + "$ " + final_GST) print("Total \t" + "$ " + final_display) print("") print("Thank you!") break def get_order2(): total = 0 stock_list = [2,2,2,2,2,2,2,2] available = True cake_list = ["A", "B", "C", "D","E","F","G","H"] while True: cake = get_input() index = cake_list.index(cake) if stock_list[index]>=1: available = True stock_list[index]-=1 else: available = False
Secondary 4 Express 6 Computing 7155/02 Anglo-Chinese School (Barker Road) Preliminary 2022 if available == True: total += get_price(cake) else: print("The cake is not available") cont = input("Another purchase? Y or N: ") if cont == "N": GST = 0.07 GST_amt = round(GST*total,2) GST_list = str(GST_amt).split(".") cents = GST_list[1] if int(cents[-1])>=5: final_GST = str(GST_list[0])+"."+str(GST_list[1])[0]+"5" else: final_GST = str(GST_list[0])+"."+str(GST_list[1])[0]+"0" final = total + float(final_GST) final_list = str(final).split(".") if len(final_list[1])== 1: final_list[1]+="0" final_display = final_list[0]+"."+final_list[1] else: final_display = str(final) print("") print("Subtotal \t" + "$ " + str(total)) print("GST \t\t" + "$ " + final_GST) print("Total \t" + "$ " + final_display) print("") print("Thank you!") break Question Answer Marks 11 Allow user input the choice of cake [1] Correct condition to make sure only A to H is input [1] Return the choice of cake [1] 12 Able to use of get_input() [1] Able to use get_price(option) [1] Able to allow more input(s) of the choice of cake [1] Able to loop until no more additional cake is ordered [1] Able to calculate the subtotal [1] Able to calculate the GST amount [1] Able to calculate the final total [1] Able to display the subtotal [1] Able to display the GST amount [1] Able to display the GST amount to the nearest $0.05 [1] Able to display the final total [1] Able to display the final total to
Content continues in the PDF. Download PDF
Related notes
- SST (for revision practice) 2024 S3 Computing EOY P2 QP_FinalExam Papers · 2024
- Computing o level notes Notes/Practices · 2023
- BVSS Prelim P1 CPExam Papers · 2024
- BVSS Prelim P1 MSExam Papers · 2024
- CWSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 MSExam Papers · 2024
- computing notesNotes/Practices
- SST 2024 Prelim Paper 1 [revised for 2025] Exam Papers · 2024
- SST 2024 Prelim Paper 1 Ans [revised for 2025] Exam Papers · 2024
- [Notes for Computing] Heavily Compressed TextbookNotes/Practices · 2025
- [Notes for Computing] All Definitions/ TermsNotes/Practices · 2025
- (Notes) Heavily Compressed TextbookNotes/Practices · 2025
- See all Computing notes

