SRSS Sec 4 COMP PRELIM 2022 PAPER 2
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
Text from the first pagesThis question paper consists of 10 printed pages including the cover page. [Turn over SERANGOON SECONDARY SCHOOL PRELIMINARY EXAMINATION SECONDARY 4 EXPRESS CANDIDATE NAME ( ) CLASS CENTRE NUMBER S INDEX NUMBER COMPUTING 7155/02 Paper 2 29 August 2022 2 hours 30 minutes Additional Material: Quick Reference for Python Setter(s): Mr Adrial Tan READ THESE INSTRUCTIONS FIRST Write your name, class and index number on all the work you hand in. Write in dark blue or black pen. All tasks must be done in the computer laboratory. Programs are to be written in Python. A Quick Reference for Python is provided. Approved calculators are allowed. Answer all questions. 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. Retrieve the template files from the COMPEXAM folder. Save your work inside the COMPEXAM folder using the file names given in the question as and when necessary. For Examiner’s Use 50
2 Task 1 Serangoon Secondary School’s basketball team has several members. The teacher-in-charge uses spreadsheet software to record the details of the members. You are required to finish setting up the spreadsheet to record the details for the members in the team. Open the file BBMEMBERS.xlsx. You will see the following data. Save the file as SSSBBMEMBERS_2022_<Class>_<Index_Number>_<Your_Name>.xlsx 1 In cell B20 enter a formula that uses a function to show how many members are there in the basketball team. [1]
3 2 In cell B21 enter a formula that uses a function to find the height of the members that appear the highest number of times. [1] 3 In cell B22 enter a formula that uses functions to find the average age of the members. The average age must be rounded up to the nearest integer. [2] 4 In the Remarks column enter a formula that uses functions to: • find the tallest member and display the text Captain for that member • find the second tallest member and display the text Vice Captain for that member All other cells in the column must display the text Member. [4] 5 In cells A4 to E18 use a conditional formatting tool to make the text red in the row that contains the shortest member. [2] Save and close your file. Task 2 begins on the next page.
4 Task 2 The minimum height a rider can be to ride on a pony at a zoo attraction is 1.4 metres. The following program checks whether a rider meets the minimum height requirement. The program allows the user to enter the names and heights of 10 riders. It will display a message after each rider’s details are input, to indicate if the rider is tall enough or not. num_rider = 10 min_height = 1.4 for p in range(num_rider): name = input("Enter name of rider: ") height = float(input("Enter height of rider: ")) if height >= min_height: print("Rider is tall enough to ride a pony.") else: print("Rider is not tall enough to ride a pony.") Open the file CHECKHEIGHT.py Save the file as PONYCHECKHEIGHT_2022_<Class>_<Index_Number>_<Your_Name>.py 6 Edit your program so that it will work for any number of riders. The program must display a suitable input message. Save your program. [1] 7 If a child shorter than 1.4 m wants to take the pony ride, an adult needs to accompany the child. All children shorter than 1 m will not be allowed to take the pony ride. Edit the program so that it checks if a child taller than 1 m but shorter than 1.4 m has an adult accompanying him/her to ride the pony. The program must display the following messages: • "The rider is tall enough to ride a pony." if the rider’s height is at least 1.4 m. • "The rider is not tall enough to ride a pony." if the rider’s height is shorter than 1 m. • "Is the rider accompanied by an adult? (Y/N)" and gets an input from the user if the rider’s height is at least 1 m but shorter than 1.4 m. • "The rider is not tall enough but is accompanied by an adult to ride the pony. " if the rider ’s height is taller than 1 m but shorter than 1.4 m , and is accompanied by an adult.
5 • "The rider is not tall enough and is not accompanied by an adult to ride a pony." if the rider’s height is taller than 1 m but shorter than 1.4 m, and is not accompanied by an adult. Save your program. [5] 8 Save your program as CHECKADULT_2022_<Class>_<Index_Number>_<Your_Name>.py Edit the program so that it stores the name of the rider s in a list, only if the rider is tall enough or is accompanied by an adult. Each name must be stored in the next available element in the list. Output the list after all riders have been entered. Save your program . [4] Task 3 begins on the next page.
6 Task 3 A program asks the user to enter a word. The program checks if the word entered is valid or invalid, and converts the word to lower case if it is valid. A word is invalid if it: • contains characters other than letters • does not start with a capital letter The program displays a 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 ‘python’ is entered, the error reported is that it does not begin with a capital letter. 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 8 characters in length • long if the word is more than 8 characters in length. The program displays a message to show the category of the word. word = input("Please enter your word: ") word = word.lower() begin_cap = word.isupper() has_symbols = not word.isalnum() has_digits = True for c in words: if c.digit(): has_digits = True break word_len = word.length() if not begin_cap and not has_symbols and not has_digits: if word_len < 3: print("You entered a short word.") elif word_len <= 8: print("You entered a medium word.") elif: print("You entered a long word.") if begin_cap: print("Error. You entered a word that does not start with a capital letter.")
7 elif has_symbols: print("Error. You entered a word that contain special characters.") elif has_digits: print("Error. You entered a word that contain digits.") Open the file WORDCHECK.py Save the file as MYWORDCHECK_2022_<Class>_<Index_Number>_<Your_Name>.py 9 Identify and correct the errors in the program so that it works co rrectly according to the requirements given. Save your program. [10] Task 4 begins on the next page.
8 Task 4 A cipher is an algorithm that encodes a message so that only the intended recipient is able to read it. The Caesar Shift Cipher is a type of cipher where each letter in the original message is shifted down the alphabet sequence by a fixed number of positions. The table below shows an example where the letters have been shifted down the alphabet sequence by 5 positions. The letters “wrap-around” at the end. Using the table, the message ‘Computing’ would be encoded as ‘Htruzynsl’. Original a b c d e f g h i j k l m n o p q r s t u v w x y z Shifted down by 5 f g h i j k l m n o p q r s t u v w x y z a b c d e Original A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Shifted down by 5 F G H I J K L M N O P Q R S T U V W X Y Z A B C D E The process of encoding the message is called encryption and the encoded message is called the ciphertext. In order to read it, the recipients need to perform an opposite process called decryption to change the ciphertext back to the original message. Open the file CIPHER.py. You will see the following function which shifts a letter down t
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

