Page 1 of 131 Computer Science (9618) CAIE AS Level complete notes No. Chapter 1 Number System, Multimedia and File Compression Page 4 2 Communication and Network 12 3 Input/Output Devices & Memory/Storage 40 4 CPU Architecture & Mnemonics Tables 53 5 System Software 70 6 Security, Privacy and Data Integrity 82 7 Ethics and Ownership 94 8 Databases 99 Page 4 of 131 Chapter 1: Number System, Multimedia and File Compression Binary to Denary to Hexadecimal: Hexadecimal: Binary: 0 1 1 0 1 0 1 12 8 4 2 1 Binary: 6B16 6 11 Denary: 1x20 + 1x21 + 1x23 + 1x25 + 1x26 1 + 2 + 8 + 32 + 64 10710 Hexadecimal: 16 107 Remainder 16 6 11 16 0 6 16 0 0 = 6 11 = 6B16 Denary: 6B16 6 11 6 x 161 + 11x160 96 + 11 10710 Binary Subtraction: 127 – 90 = 37 Value 1: Value 2: Inverse Value 2: Add 1: New Value 2: Carry: Add New Value 2 and 1: 8 4 2 1 0 1 1 0 1 0 1 12 (4+2) (8+2+1) 6 11 6B16 8 4 2 1 8 4 2 1 (4+2) (8+2+1) 0 1 1 0 1 0 1 12 Binary: To Denary: ➢ Multiply by power of original base From Denary: ➢ Divide by the base of the answer required 2 107 Remainder 2 53 1 2 26 1 2 13 0 2 6 1 2 3 0 2 1 1 2 0 1 = 0110 1011 =0 1 1 0 1 0 1 12 0 1 1 1 1 1 1 1 (127) - 0 1 0 1 1 0 1 0 (90) 1010 0101 1 1010 0110 1111 11 1| 0 0 1 0 0 1 0 1 (37) Ignore Overflow Binary 2’s Complement Subtraction: -33 - -61 = 28 Value 1: 1 1 0 1 1 1 1 1 (-33) Value 2: - 1 1 0 0 0 0 1 1 (-61) Inverse Value 2: 0011 1100 Add 1: 1 New Value 2: 0011 1101 Carry: 1111 111 Add New Value 2 and 1: 1| 0 0 0 1 1 1 0 0 (28) Ignore Overflow Negative Denary to Binary: -116 ↓ 116 = 0111 0100 Carry = 11 Inverse = 1000 1011 Add 1 = 1 Answer = 1000 1100 OverFlow: 9th bit is overflow error – the result of carrying out a calculation that produces a value that is too large for the computer’s allocated word size (8-bit, 16-bit, 32-bit etc.) 4 Page 14 of 131 Network has LAN (Local Area Network) and WAN (Wide Area Network): Local Area Network (LAN): A network connecting computers in a single room or in a single building or devices connected over a small geographical area Company-owned infrastructure // Uses dedicated infrastructure // No leasing external infrastructure / transmission media // does not use internet to transmit within the building Wireless LANs (WLANs) : Similar to LANs but there are no cables, wireless communications over fairly short distances (upto 100m) using radio or infrared signals instead of cables Wireless Access Points (WAPs): ❖ Hardware component that provides radio communication from the central device to nodes on the network (and vice versa) ❖ Allowing devices to connect to the LAN instead of using a cable ❖ Are connected into the wired network at fixed locations ❖ Because of the limited range, most commercial LANs (airports etc.), use several WAPs to permit uninterrupted wireless communication ❖ WAPs either use spread spectrum technology (wideband radio frequency with high range) or infrared (short range, easily blocked) and therefore has limited use ❖ The WAP receives and transmits data between the WLAN and the wired network structure ❖ End users access the WLAN through wireless LAN adapters built into the devices or as a plug-in module ❖ Easy to move a device to different location Wide Area Network (WAN): A network connecting computers on different sites, possibly thousands of kilometers apart If a number of LANs are joined togethers using a router or a modem, they can form a WAN The network of ATMs is an example A typical WAN will consist of end systems and intermediate systems: The orange are the end systems and purple are the intermediate systems Metropolitan Area Network (MAN): Network which is larger than a LAN but smaller than a WAN, which can cover several buildings in a single city, such as a university campus Personal Area Network (PAN): Network that is centered around a person or their workspace WAN: 100 km to over 1000 km MAN: 1 km to 100 km LAN: 10 m to 1000 m PAN: 1 m to 10 m 14 Page 24 of 131 Transmission Media: Wired: Advantages: ❖ More reliable and stable network (wireless may be subject to interference) ❖ More secure less interference ❖ Data transfer rates tend to be faster with no ‘dead spots’ ❖ Cheaper overall Disadvantages: ❖ Devices not mobile ❖ Tripping hazards ❖ Overheating of connections, can cause fires ❖ Downtime during routine office cleaning or rearrangement of cables ❖ Permission from authorities and land owners may be required before laying cables underground Copper Cables: Twisted Cable: ❖ It is used mostly in LANs and for connecting telephones to telephones lines, one cable with four twisted pairs ❖ It has the lowest data transfer rate and suffers the most from external interference (such as electromagnetic radiation) ❖ Can be shielded (commercial use) or unshielded (residential use) Benefits of Copper Cable: ❖ Installation cost is low ❖ Easy to set up ❖ More flexible ❖ Easier to terminate ❖ Vast knowledge as it has been around for years ❖ Robust Coaxial Cable: ❖ It is most commonly used in MANs and by cable television companies ❖ The cost of coaxial cables is higher than twisted pair cables but they offer a better data transfer rate (x80 of twisted cables) and are affected less by external interference Drawbacks of Copper Cable: ❖ Less bandwidth rates ❖ Need repeaters ❖ Higher interference 24 Page 34 of 131 For ex., the devices in the Admin and finance department might have hostIDs of 1, 8, 240, 35, 67, 88, 134, and so on, with similar spreads for the other seven departments. It would be beneficial to organise the netIDs and hostIDs so that the network was a lot less complex in nature With sub-netting, the hostID is split as follows: 000 00000, where the first 3 bits are netID expansion and the last 5 bits are the hostIDs. Thus, we have eight sub-nets with the same range of hostIDs: The devices in the Admin and finance department will have IP addresses: 192.200.20.000 00001 to 192.200.20.000 11110 The Humanities department will have IP addresses: 192.200.20.001 00001 to 192.200.20.001 11110 And so on for the other departments… To obtain the netID from the IP address we can apply the AND mask (recall that 1 AND 1 = 1, 0 AND 0 = 0 or 1 AND 0 = 0) Thus, if a device has an IP address of: 11000000.11001000.00010100.011 00011 We can apply the AND mask: 11111111.11111111.11111111.111 00000 Which results in the netID value: 11000000.11001000.00010100.011 00000 (or 192.200.20.03) Hence, we know this computer is from Science department 34 Page 54 of 131 Register: Temporary component in the processor which can be general or specific in its use that holds data or instructions as part of the fetch execute cycle Status Register (SR) (Special Register): ❖ Status register is interpreted as flags for different reasons, such as overflow in addition calculation, or result of a calculation is zero ❖ Used when an instruction requires some form of arithmetic or logical processing ❖ Contains bits which can be set or cleared depending on the operation ❖ It is a special register Flag: ❖ Indicates the status of a bit in the status register, for example, N = 1 indicates the result of an addition gives a negative value. ❖ Each bit is known as a flag ❖ Most systems have 4 flags ➢ Carry flag (C) set to 1 if the answer does not fit in the given register // goes to the 9th bit ➢ Negative flag (N) is set to 1 if the answer is a negative value (leftmost bit 1) ➢ Overflow flag (V) set to 1 if the answer is more than 7 bits and a carry goes to the 8th bit, disturbing the sign bit ➢ Zero flag (Z) set to 1 if the answer is zero on all bits ➢ Other flags include parity flag, half-carry flag and interrupt flag Program Counter (PC) (Special Register): ❖ Program Counter is used to store the address of the next current instruction to be fetched. It is incremented by one as soon as the address is fetched into MAR ❖ (also known as instruction address register – IAR) ❖ A register used to store the address of the instruction which is currently being executed CIR (Current Instruction Register) (Special Register): A register used to contain the instruction which is currently being executed or decoded IX (Index Register) (Special Register): Used when carrying out index addressing operations (assembly code) Stores values that can be added to an address to give another address Interrupt Register (Special Register): Used for interrupt management MAR (Memory Address Register) (Special Register): Stores the address of the memory location currently being read from or written to MDR/MBR (Memory Data/Buffer Register) (Special Register): Stores data which has just been read from memory or data which is about to be written to memory (sometimes referred to as MBR) ACC (Accumulator) (Special/General/Temporary Register): A register used when carrying out ALU calculations, stores temporary result of calculation Core: A unit made up of ALU, CU and registers which is part of a CPU. A CPU may have multiple cores 54 Page 64 of 131 Directive: ❖ An instruction that directs the assembler to do something ❖ A directive is not a program instruction ❖ It is information for the assembler ❖ For example: State the start address for the program // tell the assembler to set aside space for variables // include an external file etc. // Opcode in second pass (instruction set) Instruction Groups: Input and output of data Takes an input from the user // outputs the character of the binary number (IN, OUT, OUTCH) Arithmetic operations Perform addition and subtraction (ADD, SUB, INC, DEC) Unconditional and conditional instructions Move to another instruction (identified by a label) (JMP, JNE, JPN) Compare instructions Compare the result to another value (CMP, CMI) Data Movement: LDM, LDI, LDX, LDD, LDR 64 Page 74 of 131 Defragmentation Software: Utility that reorganizes the sectors on a hard disk so that files can be stored in contiguous data blocks Re-organizes the disk contents Moves split files so they are continuous Creates a larger area of continuous free space ❖ As an HDD becomes full, blocks used for files will become scattered all over the disk surface (in potentially different sectors and tracks as well as different surfaces) ❖ This happens as files are deleted, partially-deleted, extended and so on ❖ The consequence is slower data access time: the HDD read-write head requires several movements just to find and retrieve the data making up the required file ❖ It would be advantageous if files could be stored in contiguous sectors, considerably reducing HDD head movements ❖ Note that, due to their different operation when accessing data, this is less of a problem with SSDs ➢ Consider the following example using a disk with 12 sectors per surface ➢ We have three files (1, 2 and 3) stored on track 8 of the disk surface: ➢ File 2 is deleted by the user and file 1 has data added to it ➢ However, the file 2 sectors which become vacant are not filled up straight away by new file 1 data since this would require ‘too much effort’ for the HDD resources ➢ Hence, we get the following: ➢ File 1 has been extended to write data in sectors 10 and 11 ➢ Now, suppose file 3 is extended with the equivalent of 3.25 blocks of data ➢ This requires filling up sector 9 and then moving to some empty sectors to write the remainder of the data, the next free sectors are on track 11: ➢ If this continues, the files just become more and more scattered throughout the disk surfaces ➢ It is possible for sectors 4, 5 and 6 (on track 8) to eventually become used if the disk starts to fill up and it has to use up whatever space is available A disk defragmenter will rearrange the blocks of data to store files in contiguous sectors wherever possible; however, if the disk drive is almost full, defragmentation may not work ➢ Assuming we can carry out defragmentation, then track 8 now becomes: ➢ This allows for much faster data access and retrieval since the HDD now requires fewer read-write head movements to access and read files 1 and 3 ➢ Some defragmenters also carry out clean up operations ➢ Data blocks can become damaged after several read/write operations (this is different to bad sectors) ➢ If this happens, they are flagged as ‘unusable’ and any subsequent write operation will avoid writing data to data blocks which have become affected 74 Page 84 of 131 Anti-Spyware Software: • • Software that detects and removes spyware programs installed illegally on a user’s computer system The software is either based on rules (it looks for typical features associated with spyware) or based on known file structures which can identify common spyware programs Antivirus Software: Running antivirus software in the background on a computer will constantly check for virus attacks Although different types of antivirus software work in different ways, they all check software or files before they are run or loaded on a computer They compare possible viruses against a database of known viruses They carry out heuristic checking (check software for behavior that could indicate a virus, which is useful if software is infected by a virus not yet on the database) They quarantine files or programs which are possibly infected and ▪ allow the virus to be automatically deleted, or ▪ allow the user to make the decision about deletion (it is possible that the user knows that the file or program is not infected by a virus – this is known as a false positive and is one of the drawbacks of antivirus software) Antivirus software needs to be kept up to date since new viruses are constantly being discovered Full system checks need to be carried out regularly (once a week, for example), since some viruses lie dormant and would only be picked up by this full system scan Biometrics: ✓ Use of unique human characteristics to identify a user (such as fingerprints or face recognition) ✓ In an attempt to stay one step ahead of hackers and malware writers, many modern computer devices use biometrics as part of the password system ✓ Biometrics rely on the unique characteristics of human beings ✓ Examples include fingerprint scans, retina scans (pattern of blood capillary structure), face recognition and voice recognition ✓ Mobile phones use biometrics to identify if the phone user is the owner Fingerprint Scans: ❖ Images of fingerprints are compared against previously scanned fingerprints stored in a database ❖ If they match then access is allowed ❖ The system compares patterns of ‘ridges’ and ‘valleys’ which are fairly unique (accuracy is about 1 in 500) Retina Scans: ➢ Retina scans use infra-red to scan the unique pattern of blood vessels in the retina (at the back of the eye) ➢ It requires a person to stay still for 10 to 15 seconds while the scan takes place ➢ It is very secure since nobody has yet found a way to duplicate the blood vessels patterns’ (accuracy is about 1 in 10 million) Auditing: ❖ Logging all actions / changes to the system ❖ In order to identify any unauthorized use Application / OS security: ➢ Applying regular updates to all software and ensuring latest security patches are being used ➢ Finding, fixing and preventing security vulnerabilities in any installed application Physical Measures: – – – – Locks Guards / Employees Sealed Room CCTVs 84 Page 94 of 131 Chapter 7: Ethics and Ownership Legal: relating to, or permissible by, law Morality: an understanding of the difference between right and wrong, often founded in personal beliefs Ethics: moral principles governing an individual’s or organization’s behavior, such as a code of conduct Culture: the attitudes, values and practices shared by a group of people/society Intellectual property rights: rules governing an individual’s ownership of their own creations or ideas, prohibiting the copying of, for example, software without the owner’s permission Privacy: the right to keep personal information and data secret and for it to not be unwillingly accessed or shared through, for example, hacking Plagiarism: the act of taking another person’s work and claiming it as one’s own Legal, moral, ethical and Cultural Implications: The following definitions are important when considering ethical behavior: ➢ Legal covers the law, whether or not an action is punishable by law ➢ Morality concerns questions of right and wrong, and is more often thought of in relation to personal or individual choices ➢ Ethics also concerns questions of right and wrong, but is more often used in a professional context ➢ Culture refers to the attitudes, values and practices shared by a society or group of people ✓ Anything which breaks the law is termed illegal ✓ Examples include copying software and then selling it without the permission of the copyright holders • • • • • • Immoral does not mean something is illegal (and vice versa) Creating a fake news website, for example, is not illegal, but it may be considered immoral if it causes distress to others If the creator tried to obtain personal and financial data, then it would be become an illegal act Similarly, hacking is generally regarded as immoral, but not illegal However, it becomes illegal if it compromises national security, or results in financial gain, or reveals personal information, for example In short, there is a fine line between an immoral act and an illegal act ❖ Unethical behaviour is the breaking of a code of conduct ❖ For example, if somebody works for a software company and passes on some ideas to a rival company, this would be regarded as unethical behaviour ❖ If the software is related to national security or is formally copyrighted, then it is also illegal ❖ It is essential to be clear whether any law has been broken ❖ The importance of culture is less tangible ❖ When writing computer games, for example, programmers need to be careful that they do not include items which some cultures would find offensive or obscene ❖ Again, this may not be unethical or illegal, but could still cause distress ❖ It is important to realise that boundaries can easily be crossed; in some countries making fun of religion, for example, is illegal Computer Ethics: A set of principles set out to regulate the use of computers 3 factors are considered: ❖ Intellectual property rights, for example, copying of software without the permission of the owner ❖ Privacy issues, for example, hacking or any illegal access to another person’s personal data ❖ Effect of computers on society, for example, job losses, social impacts, and so on ➢ Internet use has led to an increase in plagiarism – this is when a person takes another person’s idea or work and claims it was their own ➢ While it is fine to quote another person’s idea, it is essential that some acknowledgement is made so that the originator of the idea or work is known to others ➢ This can be done by a series of references at the end of a document or footnotes on each page where a reference needs to be made ➢ Software exists that can scan text and then look for examples of plagiarism by searching web pages on the internet 94 Page 104 of 131 Name and describe levels of schema of database: • External Schema ❖ • Conceptual Schema ❖ ❖ • Describe the views which users of the database might have Describes the data as seen by the applications marking use of the DBMS Logical Schema ❖ ❖ ❖ ❖ ❖ ❖ • The individual’s view of database Describe how the relationships will be implemented in the logic structure of the database. the overview of a database structure models the problem / situation ... by using methods such as an ER diagram independent of any particular DBMS a data model for a specific database that is independent of the DBMS used to build that database Physical / Internal Schema ❖ Describes how the data will be stored on the physical media The ways developer interface of a DBMS will help teacher set up the database - Reports can be made to output data, e.g marks of a student - Forms can be set up to input data - Objects such as drop down can be used to make input easier - A menu can be added to select options for different actions Developer Interface To create user friendly features e.g., forms To create outputs e.g. reports for a given date To create interactive features eg. dropdowns 104 Page 114 of 131 Queue: ❖ A list containing several items operating on the first in, first out (FIFO) principle ❖ Items can be added to the queue (enqueue) and removed from the queue (dequeue) ❖ The first item added to a queue is the first item to be removed from the queue Features: ❖ ❖ ❖ ❖ ❖ ❖ Each queue element contains one data item A Pointer to the front / start of the queue A Pointer to the back / end of the queue Data is added at back / end and removed from front / start // works on a FIFO basis May be circular When front and end pointer have same value, there is only one data item in queue 2 Operations and their checks: Operation: Add an item / Enqueue Check: There are unused elements in the array // The queue is not full Operation: Remove an item / Dequeue Check: There are items in the array // The queue is not empty ➢ ➢ ➢ ➢ ➢ ➢ Items are removed from the front (front pointer) and added from the back (rear pointer) Value of the front pointer changes after dequeue Value of the rear pointer changes after enqueue A queue can be implemented using an array and a set of pointers As an array has a finite size, the queue may become full and this condition must be allowed for Position of a queue changes after manipulation so it is a circular queue Manipulation: ❖ Before adding, location of point is changed, then item is stored ❖ For removing, first item is deleted, then location of pointer is changed 114 Page 124 of 131 Structure Chart: ❖ A modelling tool used to decompose a problem into a set of sub-tasks ❖ It shows the hierarchy or structure of the different modules and how they connect and interact with each other ❖ Module relationships / hierarchy / selection / repetition // how a problem is broken down ❖ The parameters that are passed between the sub-tasks / modules // whether a module is a function or a procedure ❖ ❖ ❖ ❖ A filled black arrow means the program is a function with a Boolean return A non-filled black arrow means the program is function with a different return A double sided arrow means By Reference Procedure Repeatedly means a u-turn arrow around the procedure 124