Summary A level CS 9618 CIE COMPLETE REVISION Paper 3 + 4(88 pages)
53 views 0 purchase
Course
CIE 9618 Computer Science Paper 3 + 4 (9618)
Institution
CIE
Self contained notes, ignore the badly written textbook, memorise everything in this notes, you will get A* definitely
Updated syllabus including Artifical Intelligence (9618) for paper 3 and paper 4, AS (paper 1 + 2) is also available in my account
19 Computational thinking and problem solving 45
19.2 Recursion Error! Bookmark not defined.
20 Further programming 63
Appendix: Python 80
1
,A2 CS Notes Paper 3 + 4 R.Fok L.Lai E.Min
13 Data Representation
13.1 User-defined data types
Show understanding of why user-defined types are necessary
**User defined data types – a data type based on existing data type or other data
types that have been defined by a programmer in a program
User-defined data types are useful for programmers where the nature of the
problem has data which is more complex than those represented by the simple data
types, integer, string, etc.
It can be divided into 1. Non-composite data type 2. Composite data type
Define and use non-composite types, including enumerated, pointer
**Non-composite data type: defined without referencing another data type
Enumerated type
• An enumeration is an ordered listing of all the items in a collection
Pointers
• An array is declared to reserve memory for the storage of the data
• Pointers are designed to overcome the need to reserve memory in advance
• Dynamic memory allocation
o Memory will be allocated as and when required
• Pointers are used to access data which is dynamically created at run-time
2
,A2 CS Notes Paper 3 + 4 R.Fok L.Lai E.Min
• A pointer is variable which stores the address of a variable
You can declare a pointer as follows:
DECLARE OrderPointer : ^Order
#^Order is a pointer data type, pointing to data of type
OrderPointer
Define and use composite data types, including set, record, and class/object
**Composite data type: a data type that refers to any other data types in its
type definition
Sets
• Can be used to check the validity of a user’s input
• Replaces standard IF statement for many conditions
• So instead of IF Choice=1 OR Choice=2 OR Choice=3 OR Choice=4
THEN…
• We can say DECLARE MenuChoice : SET OF (1,2,3,4,5)
o IF Choice IN MenuChoice
Records
TYPE Transaction
Bank_ID : STRING
AccountNumber : INTEGER
TransactionDate : DATE
TransactionTime : INTEGER
TransactionType : CHAR
Amount : REAL
ATM_ID : INTEGER
ENDTYPE
DECLARE Food: Transaction
Food.Amount ⟵ 200
A combination of different data types and group them under 1 identifier
Classes
• Blueprints from which actual objects (called instances) will be created
Objects
• Instances that are created from Classes
3
, A2 CS Notes Paper 3 + 4 R.Fok L.Lai E.Min
**Choose and design an appropriate user-defined data type for a given problem
Usually in the form of a record
13.2 File organization and access
Show understanding of the methods of file organization and select an appropriate
method of file organization and file access for a given problem
Including serial, sequential (using a key field), random (using a record key)
Serial file organization
• Records are written to the file in chronological order, new records are
appended to the end of the file
• Useful for bank transaction logs / telephone logs
• Only appear in the order in which they were created in the file
Bank Transaction 1 Customer 1 Date 1
Bank Transaction 2 Customer 2 Date 2
Bank Transaction 3 Customer 3 Date 3
Sequential file organization (key field)
• Stored in an order based on the key field of the records as it is the unique
identifier
• Example could be gas bill, as customer number probably is the key field
which uniquely defines each record
• Note: record must be added in correct space
Random file organization (record key)
• Stores records of data in a file in any available position
• Allows direct access to a particular record in the file
• For records to be written and read to / from the file in the same file session
• File opened in RANDOM mode
• The user will allocate each record a record key number
• Takes a record key number à hashing function à calculated address
Comparing the different file organization methods
Method Write Read
Serial ✅✅ ❌❌❌
Sequential ❌❌❌ (New records ✅✅
need to be added to
correct place)
4
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller ryanfok. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $14.73. You're not tied to anything after your purchase.