BVSS 2022 Prelim 4E Computing P2 MSv3
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
1 Marking scheme (4E Computing Prelim) Task 1 1 =ROUND(AVERAGE(C4:E4), 0) 2 1m for AVERAGE( ) 1m for ROUND( ) 2 ==MAX(F4:F12)-MIN(F4:F12) 1 3 =IF(OR(F4=MAX($F$4:$F$12), F4=LARGE($F$4:$F$12, 2)), "Favourite", "") OR =IF(F4=MAX($F$4:$F$12), "Favourite", IF(F4=LARGE($F$4:$F$12, 2), "Favourite", "") 3 1m for MAX( ) or LARGE( ) 1m for OR( ) 1m IF( ) 1m for MAX( ) or LARGE( ) 1m for IF( ) 1m for nested IF() 4 =(HLOOKUP(F4, $B$17:$E$19, 3, TRUE)+100)/100*B4 OR =(HLOOKUP(F4, $B$17:$E$19, 3, TRUE)/100 + 1)*B4 OR = HLOOKUP(F4, $B$17:$E$19, 3, TRUE)/100*B4 + B4 2 1m for HLOOK( ) 1m for correct calculation 5 Correct conditional formatting 2
2 Task 2 6 message = input("Enter a message: ") encrypted_m = "" for i in range(len(message)): if message[i] in "aeiou": encrypted_m = encrypted_m + message[i].upper() elif message[i] == " ": encrypted_m = encrypted_m + "&" else: encrypted_m = encrypted_m + chr(ord(message[i])+3) print("Encrypted message:", encrypted_m) 1m – check for vowel 1m – convert to upper case 1m – check for space 1m – convert to "&" and include else: for the rest of the cases
3 7 def decrypt(s): original_m = "" for i in range(len(s)): if s[i] in "AEIOU": original_m = original_m + s[i].lower() elif s[i] == "&": original_m = original_m + " " else: original_m = original_m + chr(ord(s[i])- 3) return original_m # main program print("Original message:", decrypt(encrypted_m)) 1m – initialise local variable 1m – check for vowel and convert to lower case 1m – check for "&" and convert to space 1m – convert to 3 characters in front 1m – return decrypted message 1m – call function correctly and print
4 Task 3 8 def correct_range(num, limit): return 0 <= num <= limit print("Time in 24-hour format are entered as 4 digits") valid = False while valid == False: time = input("Enter a time in 24-hour format: ") if len(time) != 4: print("Length of input must be 4") elif time.isdigit() == False: print("Input must be digits only") else: hour_int = int(time[:2]) minute_str = time[2:] if not correct_range(hour_int, 23): print("Hour must be in the range 0 to 23 inclusive") elif not correct_range(int(minute_str), 59): print("Minute must be in the range 0 to 59 inclusive") else: valid = True if correct_range(hour_int, 23) == False: if correct_range(int(minute_str), 59) == False:
5 if 0 <= hour_int <= 11: indicator = "AM" else: indicator = "PM" new_hour = hour_int if hour_int == 0: new_hour = hour_int + 12 elif hour_int >= 13: new_hour = hour_int - 12 converted_time = str(new_hour) + ":" + minute_str + indicator print(conver
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

