SST 2019 Prelim P2 Solution
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
1 2019 SEC 4 COMPUTING PRELIM PAPER 2 MARKING SCHEME Task 1 Question Answer Marks (a) =STDEV(B2:B21) 1 (b) =COUNTIF(B2:B21, “>3000”) 1 (c) =VLOOKUP(C2,$E$27:$G$31,3,TRUE) 2 (d) = B2 * C2 * D2 / 12 2 (e) =IF(AND(B2>3000,C2>24),"YES","NO") 2 (f) =FV(2%/12,48,0,-B2) 2
2 Task 2 Question Answer Marks # Input items in a shopping cart and the quantity # Change of different_items to be 5. different_items = 5 shopping_cart = [] shopping_item = [] for i in range(different_items): new_item = input("Please enter an item: ") new_quantity = input("Please enter the quantity of item: ") # Check that new quantity is positive integer. # A prompt for user of quantity is not integer # Allow user to re-enter the input while not new_quantity.isdigit() or int(new_quantity) <= 0: print("The quantity needs to be positive integer.") new_quantity = input("Please enter the quantity of item: ") # Allow user to input unit cost of item new_cost = input("Please enter the unit cost of item: ") shopping_item = [new_item, int(new_quantity), float(new_cost)] shopping_cart.append(shopping_item) print(shopping_cart) largest_quantity = 0 sequence = 0 for j in range(different_items): if shopping_cart[j][1] > largest_quantity: sequence = j largest_quantity = shopping_cart[j][1] # Initialising smallest_quantity # Determine the item with the smallest quality smallest_quantity = shopping_cart[0][1] sequence2 = 0 for k in range(different_items): if shopping_cart[k][1] < smallest_quantity: sequence2 = k
3 smallest_quantity = shopping_cart[k][1] print("The item with the greatest quantity is ",shopping_cart[sequence][0]) print("There are ",largest_quantity, shopping_cart[sequence][0], "in total.") # Print the item with the smallest quantity and the respective quantity. print("The item with the smallest quantity is ",shopping_cart[sequence2][0]) print("There are ",smallest_quantity, shopping_cart[sequence2][0], "in total.") # Multiply cost of each item with quantity # Add the total cost of items cost = 0 for p in range(different_items): cost += shopping_cart[p][1] * shopping_cart[p][2] print("The total cost is $",cost)
4 Task 3 Question Answer Marks Get the required number from user with appropriate prompt Verify the input, if the verification fails, display appropriate error message and ask the user to re-enter the number Display the subtraction step in a single line. E.g. "721 - 127 = 594" Display the addition step in a single line. E.g. "594 + 495 = 1089" Ask the user if he wants to try again, repeat step 1 if user wants to, otherwise end the p
Content continues in the PDF.
Related notes
- Computing o level notes Notes/Practices · 2023
- BVSS Prelim P1 MSExam Papers · 2024
- BVSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 MSExam Papers · 2024
- computing notesNotes/Practices

