2018 SRSS P2
Uploaded by IDKWHYBUTIAM · 3 November 2024
Preview
This question paper consists of 7 printed pages and 1 blank page. Name__________________________________ ( ) Class: Sec _________ SERANGOON SECONDARY SCHOOL PRELIMINARY EXAMINATION 2018 SECONDARY 4 EXPRESS COMPUTING 7155/02 PAPER 2 28 Aug 2018 Name of Setter: 2 hour 30 minutes 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. Answer all questions. All tasks must be done in the computer laboratory. Programs are to be written in Python. A Quick Reference Glossary for Python is provided. The number of marks is given in brackets [ ] at the end of each question or part question. Retrieve the template files from the COMPEXAM folder in the thumb drive. Save your work inside the COMPEXAM folder in the thumb drive using the file name given in the question as and when necessary. FOR EXAMINER’S 50
2 Quick Reference for Python This quick reference shows some examples of the Python language constructs. The complete Python language is not limited to these examples. 1. Identifiers When naming functions, variables and modules, the following rules must be observed: Names should begin with character 'a' - 'z' or 'A' - 'Z' or '_' and followed by alphanumeric characters or '_' Reserved words should not be used. User-defined identifiers are case sensitive. 2. Comments and Documentation Strings # This is a comment """ This is a documentation string over multiple lines """ 3. Input/Output print ("This is a string") s = input ("Instructions to prompt for data entry.") 4. Import import <module> e.g. import math 5. Data Type Data Type Notes int integer float real number Bool boolean str string (immutable) list series of values 6. Assignment Assignment Statement Notes a = 1 integer b = c variable d = "This is a string" string mylist = [1, 2, 3, 5, 5] list or array 7. Arithmetic Operators: Operator Notes + - plus, subtract * / multiply, divide % remainder or modulus ** exponential or power // quotient of floor division 8. Relational Operators: Operator Notes == equality != not equal to > >= greater than, greater than or equal to < <= less than, less than or equal to 9. Boolean Expression Boolean Expression Notes a and b logical and a or b logical or not a logical not 10. Iteration while loop for loop while condition(s): <statement(s) for in range(n): <statement(s)> for record in records: <statement(s)>
3 11. Selection Type 1 Type 2 Type 3 if condition(s): <statement(s)> if condition(s): <statement(s)> else: <statement(s)> if condition(s): <statement(s)> elif condition(s): <statement(s)> else: <statement(s)> 12. Built-in functions (a) Basic functions abs( ) chr() float() input() int() ord( ) print( ) range( ) round( ) str( ) format( ) (b) Mathematical functions ceil( ) exp() fabs() floor() log() max( ) min( ) pow( ) sqrt( ) trunc( ) format( ) (c
Content continues in the PDF.
Related notes
- Computing o level notes Notes/Practices · 2023
- BVSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 CPExam Papers · 2024
- CWSS Prelim P1 MSExam Papers · 2024
- BVSS Prelim P1 MSExam Papers · 2024
- computing notesNotes/Practices

