NASS S4 2022 Prelim P2
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Text from the first pagesName: ................................ ................................ ........... Register no: ............. Class: ............... NGEE ANN SECONDARY SCHOOL O PRELIMINARY EXAMINATION COMPUTING 7155/02 Paper 2 (Lab-based) 31 August 2022 2 hr 30 min Additional materials: Electronic version of YUMCOM.xlsx file Electronic version of PASSWORD.py file Electronic version of NUMSYS.py file Insert Quick Reference Glossary Instructions to Candidates Write your name, register number and class at the top of this page. Answer all 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. Checked by student: _____________________ Date: _________ This document consists of 8 printed pages and 2 blank pages. For Examiner’s Use Marks /50
2 NAS/2022/PRELIM/4E/COMPUTING(7155/02) Task 1 The following spreadsheet is used to store the particulars of participants who had taken part in a competitive eating competition. You are required to finish setting up the spreadsheet to complete the details of the participants. You may make use of the following EXCEL function to join text s together: CONCATENATE(<text1>,<text2>) Open the file YUMCOM.xlsx. You will see the following data. Save the file as MYYUMCOM_2022_<your name>_<centre number>_<index number>.xlsx
3 NAS/2022/PRELIM/4E/COMPUTING(7155/02) 1 The Tag ID of the participants consists of the last 3 letters of their name in column B, followed by the first 2 letters of the area they represent in column F. In cells D6 to D13, enter a formula that uses functions to create the Tag ID of all the participants. [2] 2 The age of the participants may be approximated to be the difference between the current year and their birth year. In cells E6 to E13, enter a formula that calculates the age (in years) of all the participants. [1] 3 The table in cell range B16:E17 shows the categories in the competition based on the age of the participants. In cells I6 to I13, enter a formula that displays the category of each participant based on their calculated ages. [2] 4 In cells F21 and F22, enter the most appropriate formula for each cell to show the fastest 1st and 2nd timings among all the participants. [2] 5 In cell I24, enter a formula that uses functions to calculate the average age (years) of all the participants, rounded off to the nearest whole number. [2] 6 In cells A6 to I13, use a formatting tool to change the colour of the row to yellow if the participant has Insurance coverage and has time taken that is less than 60 min. [1] Save and close your file.
4 NAS/2022/PRELIM/4E/COMPUTING(7155/02) Task 2 The following program is written to help set a new password whenever the existing password has expired. The password is to be made up of alphanumeric characters. past_words = ["PopeyetheSailorm00n", "123qweasd", "Str0ngestpassw0rd"] final = False while final == False: alpha_chk = False num_chk = False p1 = input("Enter new password: ") for i in p1: if i.isalpha(): alpha_chk = True elif i.isdigit(): num_chk = True elif not i.isalnum(): alpha_chk = False num_chk = False break if alpha_chk == False or num_chk == False: print("Password has to be alphanumeric.") if (alpha_chk and num_chk): print("Password set.") final = True Open the file PASSWORD.py Save the file as MYPASSWORD_2022_<your name>_<centre number> <index number>.py 7 The password has to be at least 8 characters long. Edit the program so that it checks if the password is at least 8 characters in length. The program must display a suitable output message to inform users about the criteria if it is not met. Save your program. [3]
5 NAS/2022/PRELIM/4E/COMPUTING(7155/02) 8 Passwords used previously cannot be reused. The list variable, past_words contains three previously used passwords. past_words = ["PopeyetheSailorm00n", "123qweasd", "Str0ngestpassw0rd"] Edit the program so that it checks if the new password has been reused. The program must display a suitable output message to inform users about the criteria if it is not met. Save your program. [3] 9 The new password has to be re-entered by the user to verify that it is correct. Edit the program so that it prompts for the password to be entered again. The entire password setting process would have to restart if the re -entered password is not the same. The program must display suitable input and output messages to inform users. Save your program. [4]
6 NAS/2022/PRELIM/4E/COMPUTING(7155/02) Task 3 The program below is written to convert either a positive integer input into its binary number format or a binary number input into its corresponding denary number. choice = input("Press B for conversion to Binary and D for conversion to Denary: ") choice = choice.upper() while (choice != 'D' or 'B'): print("Wrong input.") choice = input("Press B for conversion to Binary and D for conversion to Denary: ") choice = choice.upper() if choice == "D": denary = input("Enter denary number: ") denary = (denary) binary = "" while True: r = denary%2 binary += str(r) denary = denary%2 if denary == 0: continue print("The binary number is:", binary[-1::]) elif choice == "D": denary = 0 binary = input("Enter denary number: ") binary = binary[::-1] for n in range(binary): denary += int(binary[n])*2*n print("The denary number is:", denary) Open the file NUMSYS.py Save your program as MYNUMSYS_2022_<Your name>_<Centre number>_<Index number>.py 10 Identify and correct the errors in the program so that it works according to the requirements given. Save your program. [10]
7 NAS/2022/PRELIM/4E/COMPUTING(7155/02) BLANK PAGE This page is intentionally left blank
8 NAS/2022/PRELIM/4E/COMPUTING(7155/02) Task 4 A typical deck of poker cards has four different patterns (Diamond, Club, Heart, Spade), each numbered from 2 to 10 and additional cards labelled “Jack”, “Queen”, “King” and “Ace”. For the purpose of this task, “Jack”, “Queen”, “King”, “Ace” and each pattern will be represented by their starting letter, namely, “J”, “Q”, “K”, “A”, “D”, “C”, “H”, and “S”. “Ace” also represents number 1. A two-player game using such a deck requires each player to be dealt 26 cards each. The players will calculate their total points based on a number of rules: • For every pair of numbered cards (“Ace” to 9) that total up to 10, the player gets 5 points. • For every pair of Jacks or pair of Queens or pair of Kings, the player gets 10 points. • For every one card tha t shows number 10 or card that cannot be paired, the player gets -1 point. 11 Write a function deal(), which generates and shuffles the deck of cards each time it is called. [4] Save your program as DEAL_2022_<Your name>_<Centre number>_<Index number>.py Sample executions: >>> deal() ['2D', '7S', '9H', '4S', '2C', 'KS', 'KC', '9C', 'QH', '4H', 'AC', '10S', 'AH', 'QC', '8D', 'KH', '4C', '6S', 'KD', '6H',
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

