2022 MSHS Sec 4 Computing SA2 Paper 2 QP
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Text from the first pagesThumb drive No: STL Class/ Index Number / Centre Number/ ‘O’ Level Index Number / Name MARIS STELLA HIGH SCHOOL PRELIMINARY EXAMINATION SECONDARY FOUR COMPUTING 7155/02 Paper 2 Practical (Lab-based) 26 August 2022 2 hours 30 mins Additional Materials: Electronic version of LIBRARY.XLSX file Electronic version of NUMBER.PY file Electronic version of WORD.PY file Electronic version of CONVERTER.PY file Insert Quick Reference for Python READ THESE INSTRUCTIONS FIRST Write your class, index number, Centre number, O level index number and name in the spaces at the top of this page. Answer all the questions. All tasks must be done in the computer laboratory. You are not allowed to bring in or take out any pieces of work or materials on paper or electronic media or in any other form. Programs are to be written in Python. Save your work using the file name given in the question as and when necessary. The number of marks is given in brackets [ ] at the end of each question or part question. The total number of marks for this paper is 50. For Examiner’s Use This document consists of 10 printed pages. 50
2 Task 1 The Chanel Library stores the loan records of its library users. It uses a spreadsheet software to record the details of the loans. You are required to fi nish setting up the spreadsheet to record the loan details for the users of the library. Open the file LIBRARY.xlsx. You will see the following data. Save the file as LOAN_<class>_<index number>_<your name>.xlsx 1 In cell E5, enter a formula that uses an appropriate function to search for the Book Genre in the Genre table. The Loan ID comprises the first six characters of the Book Genre and all characters of the Number field. You may use the symbol & to join them. For example , ="ABCDEF" & "1001" displays the text as ABCDEF1001. The Loan ID of the first record is CHILDR1001. Use it to calculate the Loan ID in column E. [3] 2 In cells H5 to H21, enter a formula to find the total days of the loan using the Date Borrowed and Date Returned fields. [1] 3 In cells J5 to J21, enter a conditional statement to identify if the loan is overdue. If the total days of loan exceeds 21 days, display the text “Overdue”. Otherwise, display the text “Not Overdue”. [2] 4 In cell J22, enter a function to calculate the total number of loan records. [1]
3 5 In cell J23, enter a function to calculate the total number of overdue records. [1] 6 In cells B5 to B21, use a conditional formatting tool to make the cell yellow in the rows that contain platinum members with overdue records. These members need not pay a fine due to their platinum membership. Save and close your file. [2]
4 Task 2 The following progra m allows 10 integers to be entered . The numbers must be wi thin 1 to 100 inclusive, before being classified and printed as Low, Medium or High. for count in range(10): number = int(input('Enter a positive integer: ')) if number >= 1 and number <= 40: print(number, '- Low') elif number > 40 and number <= 70: print(number, '- Medium') elif number > 70 and number <= 100: print(number, '- High') Open the file NUMBER.py Save the file as NUMBER1__<class>_<index number>_<your name>.py 7 Edit the program so that it will accept any number of inputs. Assume that only digits will be entered. [2] 8 Edit the program to test whether the user has entered a number in the correct range. Output a suitable error message that asks the user to enter the number again, and repeat this until the user enters a valid number. [2] 9 Edit the program to store numbers that are classified as high in a list. Each number must be stored in the next available element in the list. Output the list after all the numbers have been entered. Save your program. [3] 10 Save your program as NUMBER2_<class>_<index number>_<your name>.py Edit the program to find the average of the total numbers entered. Output the average. Save your program. [3]
5 Task 3 A program asks the user to enter a word. The program converts the word entered to lower case. The program checks if the word entered is valid or invalid. A word is invalid if it: • begins with the letter 'p'; or • ends with the letter 'h'; or • contains the letter 'e'. The program displays a suitable message to indicate why the word is invalid. This will be for the first error that is found and not for all errors. For example, if the word 'phish' is entered, the error reported is that it begins with the letter 'p'. If the word is valid, the program categorises the word as: • short if the word is 3 characters or less in length • medium if the word is 4 to 10 characters in length • long if the word is more than 10 characters in length. The program displays a suitable message to show the category of the word. There are several syntax errors and logic errors in the program.
6 word = input("Please enter your word: ") word = word.islower() begin_p = word.beginswith("p") end_h = word.endswith("h") contain_e = word("e") word_length = word.length() if not begin_p and not end_h and contain_e = -1: if word_length < 3: print("The length of the word is short.") elif word <= 10: print("The length of the word is medium.") elif: print("The length of the word is long.") if begin_p: print("Invalid. You entered a word that begins with 'p'.") elif end_h: print("Invalid. You entered a word that ends with 'h'.") elif not contain_e: print("Invalid. You entered a word that contains 'a'.") Open the file WORD.py Save the file as MYWORD_<class>_<index number>_<your name>.py 11 Identify and correct the errors in the program so that it works according to the requirements given. Save your program. [10]
7 Task 4 You have been asked to create a network address generator program . This program will create IPv4, IPv6 and M.A.C. addresses using user-defined functions. Open the file CONVERTER.py. You will see the following function which converts a denary number into a binary number. import random def denary_to_bin(decimal): conversion_table = ['0', '1'] binary = '' while decimal>0: remainder = decimal %2 binary = conversion_table[remainder]+ binary decimal = decimal //2 return binary Sample executions: >>> denary_to_bin(0) 0 >>> denary_to_bin(44) 101100 >>> denary_to_bin(255) 11111111 12 Save your program as HEXADECIMAL_<class>_<index_number>_<your name>.py Write a new funct
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 MSExam Papers · 2024
- BVSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 MSExam Papers · 2024
- computing notesNotes/Practices
- SST 2024 Prelim Paper 1 Ans [revised for 2025] Exam Papers · 2024
- SST 2024 Prelim Paper 1 [revised for 2025] Exam Papers · 2024
- [Notes for Computing] All Definitions/ TermsNotes/Practices · 2025
- [Notes for Computing] Heavily Compressed TextbookNotes/Practices · 2025
- All Computing Terms/DefinitionsNotes/Practices · 2025
- See all Computing notes

