0% found this document useful (0 votes)
5 views58 pages

CS Notes 2025

The document contains summarized notes on Computer Science OL, covering topics such as data representation, communication technologies, and data compression. Key concepts include binary and hexadecimal systems, packet switching, transmission methods, and error checking methods. It also discusses the advantages and disadvantages of various data transmission methods like USB and the differences between lossless and lossy compression.

Uploaded by

alexa1943.andrea
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views58 pages

CS Notes 2025

The document contains summarized notes on Computer Science OL, covering topics such as data representation, communication technologies, and data compression. Key concepts include binary and hexadecimal systems, packet switching, transmission methods, and error checking methods. It also discusses the advantages and disadvantages of various data transmission methods like USB and the differences between lossless and lossy compression.

Uploaded by

alexa1943.andrea
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

Computer Science OL Summarized Notes

Page |1 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Computer Science OL
Notes

Contents
Chapter 1 ............................................................................ 3
Chapter 2 ............................................................................ 8
Chapter 3 .......................................................................... 13
Chapter 4 .......................................................................... 24
Chapter 5 .......................................................................... 27
Chapter 6 .......................................................................... 35
Programming .................................................................... 41

Page |2 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Chapter 1
Data Representation
Analogue data: continuous stream of data that our senses process on a daily basis
Digital data: discrete data that has only 2 values 1s and 0s that the computer can process.
Binary system: it is called base-2 because it can be represented by 2 characters only (1,0)
Denary system: it is called base-10 because it can be represented by 10 characters (0,1,2,3,4,5,6,7,8,9)
Hexadecimal system: it is called base-16 because it can be represented by 16 characters (0,1,2,3,4,5,6,7,8,9,
A, B, C, D, E, F)

Advantages of hexadecimal than binary:


1. Easier for humans to read and understand
2. Easier for humans to debug (finding and locating errors).
3. Fewer digits are used so it takes up less space on screen

Uses of hexadecimal system:


1. Display Memory dumps/Machine Code
2. Used as a notation for colors in HTML
3. Used to display Media Access Control (MAC) addresses
4. Display error codes

Why a computer system can only process data in binary form?


The computers consist of logic gates and switches that only has two states (0 and 1)

Conversions
1- Converting from binary to denary
 Write the power of 2 table from the right below the number
 Multiply each binary digit by the number below it
 Add the multipliers together
Example:
Convert 1001 from binary to denary
st
1
Binary Number 1 0 0 1
23 22 21 20
Power of 2 table
8 4 2 1
2nd
Binary Number 1 0 0 1
Power of 2 table 8 4 2 1
Result 8 0 0 1
3rd
8+0+0+1= 9

2- Converting from Denary to Binary


 Write the power of 2 table from the right to the left until you reach the number below or equal to
the denary number in the question.
 Type 1 below the last number (so we will write 1 below the 8) the deduct the new number from the
original number from the question (9-8) then type another 1 and repeat until you reach the zero.

Page |3 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
Example1:
Convert 9 from denary to binary
1st
Denary Number 9
3 2
2 2 21 20
Power of 2 table
8 4 2 1
2nd
Denary Number 9
Power of 2 table 8 4 2 1
Binary Number 1 0 0 1

3- Converting from binary to hexadecimal


 Add 0s to the left until the number can be divided into groups of 4
 Type the power of 2 table below each group and multiply the values together
Example
Convert 101100 from binary to hexadecimal

0 0 1 0 1 1 0 0
23 22 21 20 23 22 21 20
8 4 2 1 8 4 2 1
0 0 2 0 8 4 0 0

2 12

So, it will be 2C

4- Converting from Hexadecimal to Binary


Same rule applies and we will work with each character individually also remember that each
hexadecimal digit equivalent to 4 binary digit
Example
Convert A2 from hexadecimal to binary
A 2

So, the binary value is 10100010

5- Converting from Denary to hexadecimal


 Convert from denary to Binary
 Convert from Binary to Hexadecimal

6- Converting from Hexadecimal to Denary


 Convert from Hexadecimal to Binary
 Convert from Binary to Denary

Page |4 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
Binary Addition

there are four rules that you will need to use:


0+0 = 0
1+0= 1
1+1= 10
1+1+1=11

Overflow error: a type of error that occurs when a number larger than a register can store is generated

Two’s complement
 We use the two’s complement to represent positive and negative binary numbers.
 A 1-value in the left most bit indicates a negative number and a 0-value indicates a positive
number.
 For Example. 00110011 represents 51 and 11001111 represents -49

Converting negative binary numbers in two’s complement format and converting to denary
Example

By following our normal rules, each time a 1 appears in a column, the column value is added to the total. So,
we can see that in denary this is: -128+16+2+1= -109

Converting negative denary numbers into binary numbers in two’s complement format
1. First convert the number as a positive binary value
2. Invert each binary value
3. Add 1 to the number
Example:

Convert the denary number -67 in two’s complement format

1st we will convert the number as 67

0 1 0 0 0 0 1 1

Then we will invert all the binary numbers

1 0 1 1 1 1 0 0

Then we will add 1

1 0 1 1 1 1 0 1

Page |5 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
Logical binary shifts:

The logical shift means moving the binary number to the left or to the right. Each shift left is equivalent to
multiplying the binary number by 2 and each shift right is equivalent to dividing the binary number by 2. As
bits are shifted any empty positions are replaced with zero.

Example

Show the result of a logical shift 2 places to the left and state the mathematical effect on the number

1 1 0 0 1 0 1 0

0 0 1 0 1 0 0 0

The two left most bits are lost and there are empty spaces on the right so we added zeros and the
equivalent value became incorrect as the number is multiplied by 4.

Representing Text:

Character Set: it contains all the characters that are in that character set and the binary value that is
assigned to each character.

Two systems are used for character representation:

A. ASCII (American Standard Code for Information Interchange) uses only 8 bits, giving a
possible 2 8 (256) characters; it is suitable for standard English but does not contain a large
enough character set for some other languages.

B. Unicode contains many more characters; Unicode uses 16 bits giving 65536 possible
characters.

Representing Pictures:

 Images is converted from analogue to digital using ADC


 Image is converted to pixels
 Each pixel is given a binary value
 Each pixel has a color
 Pixels form a grid (to create the image)
 Pixels are stored in sequence in a file

Pixel: The smallest component of the image, each pixel can be represented as a binary number.
Colour depth: The number of bits used to represent each colour.
Image resolution: The number of pixels that make up an image.

Representing Sounds:
In order to convert analogue signals to digital signals in sounds we use Sampling this is done by recording the
sound at set timed intervals. If the time intervals are closer (more time samples used) the sound track quality
will be higher. And the value of the sample is recorded as a binary value.

Sample Rate: The number of samples taken per second.


Sample resolution: The number of bits per sample
If we increased the sample rate or the sample resolution the sound quality will be better.

Page |6 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
Data compression: manipulating the bit structure of the data to make it smaller in size for the following
reasons:
 To save storage space on devices such as HDD/SSD
 To reduce the time taken to stream a music or video file
 To reduce the time taken to transmit files across a network
 Less bandwidth is required for download/upload

Lossless compression
All the data bits from the original file are reconstructed when the file is again uncompressed. This is
particularly important for files where loss of any data would be disastrous – for example (spreadsheet file-
text files); such as PDF, ZIP.

Run length encoding (RLE)


An algorithm that groups together repeating patterns and indexes them.

How the size of text files can be reduced using lossless compression?

 Lossless compression algorithm is used such as RLE


 Original file can be restored with no loss of data
 Repeated words are identified and are indexed
 Repeated words are replaced with their index
 The positions of the repeated words are stored in the table
 The number of times the word appears is stored in the table

Lossy compression
The file compression algorithm eliminates unnecessary bits of data as seen in MP3 and jpeg formats; such
as MP3, MP4, JPEG.

Perceptual music shaping


a process that is used in lossy compression that removes sounds that are not normally heard by the human
ear.

How the size of video files can be reduce using lossy compression?

 Lossy compression algorithm is used such as Perceptual music shaping


 Redundant data is removed
 Reduce color depth
 Reduce the resolution
 Data is permanently removed

MIDI Musical instrument digital interface


• Non audio recording
• Contains instructions for how the sound should be played
• Stores the notes played not the sound
• File created using digital music instrument
• Used when composing music
MP3
• Digital recording of sound
• Contains samples of the sound wave
• Recorded using microphone
• Used when distributing sound files

Page |7 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Chapter 2
Communication and internet technologies
Data packet: when transmitting data between one device to another it is broken down into very small units
called packets.
Each packet of data contains three different sections:
1- Packet header
It includes information such as:
I. Destination address
II. Packet number
III. Originators address
2- The payload
this is the actual data from the file that you are sending
3- the Trailer/footer
contains two main pieces of information, the first is the marker to indicate it is the end of the packet
and also the data for any error detection systems that are being used.
Packet Switching
The Process of transmitting data packets from one device to another through several pathways across a
network.

Router
A network component that examines a data packet to obtain its destination address and then forward the
packet to this address.
Transmission methods
Serial transmission
 Transfer of the data bits sequentially using a single wire
 More reliable over long distance
 Reduced costs as only single wire needed
 Safer transmission as it is easier to accurately collate (collect&arrange) the bits
together as they are sent one at a time
 Less interference as only single wire is needed
 Slower transmission as data bits are only transmitted one bit at a time over a single
wire
 Example: USB / connecting computer to a modem
Parallel transmission
 Transfer of data bits simultaneously using several wires
 Used over short distance (limited to 5 meters)

Page |8 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

 Increased costs as multiple wires needed


 Less safe transmission as bits is sent simultaneously and errors can occur in collating
them together at the receiver’s side
 More interference as multiple wires are needed that can create crosstalk
 Quicker transmission as data bits is sent simultaneously over multiple wires
 Example: IC (integrated circuits) / Busses (internal data transfer)
What is USB?
• Universal serial bus
• Data transmission method
• It uses serial transmission

Advantages of USB:
 Devices plugged into the computers are automatically detected; device drivers are
automatically uploaded.
 The connectors can only fit one way; this prevents incorrect connections being made.
 Has become the industry standard; this means that considerable support is available to users.
 Newer USB standards are backward compatible with older USB standards.
 Several different data transmission rates are supported.

Disadvantages of USB:
 The maximum cable length is presently about 5 meters
 The present transmission rate is limited to less than 500 megabits per second
 The older USB standard may not be supported in the near future.

Transmission Modes
Simplex transmission
 Data is sent in one direction only
 Example: Television broadcast

Half-duplex transmission
 Data is sent in both directions but only one direction at a time
 Example: Walkie-talkie

Full duplex/Duplex transmission


 Data is sent in both directions at the same time
 Example: Telephone conversation

Error checking methods


During data transmission
Parity check  The transmitter and the receiver agree whether it will be an even
parity or an odd parity (number of 1s)
 At the transmitter a parity bit (could be 1 or 0) is added to the data as
an extra bit
 At the receiver a check is performed to check the number of 1s to
check if it matches the agreement (even or odd)
 If parity is incorrect, error is detected.
 The parity checking can not detect transposition errors and can not
detect which bit exactly is in error.
 One of the ways around this problem is to use parity blocks. In this
method a block of data is sent and the number of 1-bits are totalled
horizontally and vertically, this method not only identifies that an
error has occurred but also indicates where the error is.
Page |9 Mr. Karim Wahid
01003335612
Computer Science OL Summarized Notes

Checksum The checksum for the bytes is first of all calculated. This value is then
transmitted with the block of data. At the receiving end the checksum is
recalculated from the block of data received, this calculated value is then
compared to the checksum transmitted.
Automatic Repeat Request A check is performed after receiving the data using either parity check or
(ARQ) checksum
If error is detected a request is sent to the transmitter to resend the data
(negative acknowledgement)
This resend request will be sent repeatedly until the packet is received
error free or a limited amount of resend requests is reached or requests
timeout.
The receiver sends a positive acknowledgement when data is received
correctly.
Echo check When data is sent to another device, this data is sent back again to the
sender. The sender compares the two sets of data to check if any errors
occurred during the transmission process.
Error Checking methods - During data entry
 A digit is calculated from the data
 It is appended to the data
Check Digit  Digit is recalculated when data is entered
 Digits are compared to check for errors
 Check digit is a validation method used to check data entry
Internet service provider (ISP)
Companies that provide the user with access to the internet. A monthly fee is usually charged for this service.

Role of ISP:
• Provides access to the internet
• Usually charge a monthly fee
• Monitors internet usage
• Gives users an IP address
• Determine bandwidth
Bandwidth
This is the maximum rate of transfer of data across a network, measured in bits per second.

Web server
A computer that hosts a website and responds to requests to provide information and services over the
internet.
Browser:
A browser is a software that enables users to access/view webpages, documents, other resources on the
internet.
Functions of the web browser
• Displays web pages
• Translates the HTML files
• Provides functions such as bookmarks and history
• Identifies protocols such as HTTPS and SSL
• Stores/retrieves cookies
Network interface card (NIC)
NIC is needed to allow devices to connect to a network such as the internet. It is usually part of the device
hardware and contains the Medica Access Control (MAC) address generated at the manufacturing stage.

P a g e | 10 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
Wireless network interface cards (WNICs)
Same as NICs; they are used to connect devices to the internet or other networks. However, they use wireless
connectivity utilizing an antenna to communicate with networks via microwaves.

IP address (internet protocol address)


When a device connects to a private network, a router assigns a private IP address to it. That IP address is
unique on that network, but might be the same as an IP address on a separate network, however, when a
router connects to the internet it is give a unique public IP address. This is usually supplied by the ISP. No
other device on the internet has the same public IP address. All the devices connected to that router have
the same public IP addresses the router but each have their own different private IP address on that network.

• Internet protocol address


• Numeric ID that gives the location of a device on the internet
• Assigned by the network (Router)
• It can be either Dynamic or static
Static (do not change)
permanently assigned to a device by the ISP; they do not change each time a device logs
onto the internet; usually assigned to:
 Remote servers which are hosting a website
 An online database
 FTP server
Dynamic (change every time a device connects to the internet)

Dynamic Static

Greater privacy since they change each time a Since static IP addresses do not change, they allow
user logs on each device to be fully traceable

Dynamic IP addresses can be an issue when Allow for faster upload and download speed
using, for example, VOIP since this type of
addressing is less reliable as it can disconnect
and change the IP address causing the VOIP More expensive to maintain since the device must be
connection to fail constantly running so that information is always
available

• There are 2 versions:


 IPV4 this is 32 bits binary
 IPV6 this is 128 bits binary
Advantages of IPv6 over IPv4
 Removes the risk of IP address collisions
 Has built in authentication checks
 Allows for more efficient packet routes

Differences between IPv4 and IPv6:


IPv4 IPv6
 IPv4 is usually written as denary  IPv6 usually written as hexadecimal
 IPv4 is separated using dots  IPv6 is separated using colons
 IPv4 is 32-bit  IPv6 is 128-bit
 IPv4 is 4 groups of digits  IPv6 is 8 groups of digits
 IPv4 digits are between 0 and 255  IPv6 are between 0000 and FFFF
 IPv4 has fewer available unique addresses  IPv6 has more available unique addresses

P a g e | 11 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
MAC address
• Media access control address
• Assigned by the device’s manufacturer
• Always fixed
• Uniquely identifies each device connected to the internet
• 12 Hexadecimal digits (48 bits binary) which are shown as six groups of hexadecimal digits
Types of MAC address
Universally Administered MAC Address (UAA)
• This is the most common type of MAC address and this is the one set by the
manufacturer at the factory. It is rare for a user to want to change this MAC
address.
Locally Administered MAC Address (LAA)
• This is when a company or a person changes it is MAC address
Cookies
• Tiny pieces of data stored in a text file
• They are downloaded by a computer when it visits a website
• Cookies are stored by the computer’s browser and accessed by the website whenever is
visited by the client
• Cookies can be deleted from a customer’s computer

There are two types of cookies:

1. Session cookies
When making online purchases they keep a user’s items in a virtual shopping basket stored in the
RAM.
2. Persistent cookies
It remembers a user’s log in details. They are stored on the hard drive of a user’s computer until
the expiry date is reached or the user deletes it.

Why Companies use cookies?


 To store login details and speed up login
 To provide relevant ads
 For virtual shopping cart
 To tailor the user’s experience during the current browsing session, presenting different content
 To store the credit/debit card details

Uniform Resource Locator (URL): text-based address for a website.

https://www.cambridge.org/education
Protocol Domain name Web page name

Hypertext transfer protocol (HTTP)


Is a set of rules must be obeyed when transferring files across the internet, when some form of security
(SSL/TLS) is used, then this changes to HTTPS

HTML
Hypertext mark-up language (HTML) is an authoring language used to create documents (web pages) to be
viewed on the world wide web.

P a g e | 12 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
HTML consists of 2 layers:

Structure layer: is the essential part of the HTML document; it includes the semantics (meaning) and
structural mark-up of the document. Structure instructs how the layout of the content is displayed,
such as the placement of text and the placement of images.

Presentation layer: Is the style of the document; how the document will look (or even sound if it
includes multimedia elements). Presentation instructs how the content will be formatted, such as
the font size, font color and the background color.

Encryption: is a method of securing data for storage or transmission that scrambles it and makes it
meaningless.
Plain text: the name given to data before encryption
Encryption key: a type of algorithm that is used to encrypt data
Cipher text: the name given to data after transmission
Symmetric encryption: a type of encryption that uses the same key to encrypt and decrypt data
Asymmetric encryption: a type of encryption that uses two different keys to encrypt and decrypt data.
Public key: the key we use to encrypt the data and it is known by everyone.
Private key: the key we use to decrypt the data and it is only known to the computer user.

Chapter 3
Hardware
The central processing unit (CPU)
A component in a computer system that processes data and instructions.

Control unit (CU)


The component in the CPU that controls all the operations in the CPU.

Arithmetic and logic unit (ALU):


The component in the CPU that performs all the mathematical and logical operations required when
processing data and instructions.

Registers
Registers is a high-speed storage area within a computer; all data must be presented in a register before it
can be processed.

Program counter (PC) Stores the address where the next instruction to be read can be
found
Memory address register (MAR) Stores the address of the memory location currently being read
from or written to in RAM

Memory data register (MDR) Holds the data or instruction that are fetched from RAM

Current instruction register (CIR) A register that is built into the CU that holds the current
instruction that is being processed in the CPU

P a g e | 13 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Accumulator (ACC) A register that is built into the ALU that stores the result of any
interim calculations

Instruction set
This is a set of all the commands that are understood and can be processed by the CPU. These commands
are in machine code.

Immediate Access store (IAS)


The immediate Access store holds data and instructions when they are loaded from the main memory and
are waiting to be processed

Buses:

Address bus
Carries addresses between the CPU and the memory and it is unidirectional.

Data bus
Sends data between the CPU and the memory unit and the input/output devices and it is
bidirectional.

Control bus
It carries signals from the control unit to all the other computer components and it is bidirectional.

The fetch-decode-execute cycle

1. The program counter (PC) contains the address of the memory location of the next instruction which
has to be fetched.
2. This address is then copied from the PC to the memory address register (MAR); this is done using the
address bus
3. The contents (instruction) at the memory location (address) contained in MAR are then copied
temporarily into the memory data register (MDR).
4. The contents (instruction) of the MDR are then copied and placed into the current instruction register
(CIR).
5. The value in the PC is then incremented by 1 so that it now points to the next instruction which has
to be fetched.
6. The instruction is finally decoded and then executed by sending out signals (via the control bus) to
the various components of the computer system.

P a g e | 14 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
Factors that can affect the performance of a CPU

1. Number of CORES: the core is the part of the CPU that contains all the components that are used to
perform the fetch-decode-execute cycle; Multiple cores also allow a computer to multitask. If it can
process more than one instruction at a time, it can perform more than one task at a time.
2. CLOCK SPEED: the number of fetch-decode-execute cycles that can be performed in a second and it
is measured in gigahertz (GHz). A CPU with a clock speed of 2 GHz can process 2 billion instructions
a second.
3. The size of CACHE: the cache is a type of storage that is built into the CPU, to store the most
frequently used data and instructions. If a computer has a larger cache, so it has more storage space
to store the instructions and data it uses most, then it can store more of them, so will need to spend
less time going to the RAM.

INPUT DEVICES
Keyboard Normal keyboard:
A hardware device used to input data into a computer system.
On-screen keyboard:
Keys are displayed on a screen and when pressure is applied to a “key” they will
enter the data of that key.
Concept keyboard:
A surface that is flat and has a grid of buttons on it where each button can be
programmed to do a specific task.
Frequent use of these devices can lead to injuries such as repetitive strain injury
(RSI) but this can be avoided by using ergonomic keyboard.
Optical Mouse it uses tiny cameras to take 1500 images per second. A red LED is used in the base of
the mouse and the red light is bounced off the surface and the reflection is picked by
a complementary metal oxide semiconductor (CMOS) the CMOS generates electric
pulses to represent the reflected red light and these pulses are sent to a digital signal
processor (DSP). The processor can now work out the coordinates of the mouse based
on the changing image patterns as it is moved about on the surface.
Benefits of an optical mouse over a mechanical mouse:
 No moving parts, therefore it is more reliable
 Dirt cannot get trapped in any of the mechanical components
 There is no need to have any special surfaces
Scanner An input device that converts a hard copy document into an electronic form to be
stored as a file on a computer.
2D scanner
Used to input hard copy (paper) documents. The image is converted into an
electronic form that can be stored in a computer.
How 2D scanner works
• Scanner shines a light onto the surface of the document
• Reflected light is captured
• 2D scanner uses lenses and mirrors
• Captured imaged is converted into a 2D digital image
3D scanner
Scan solid objects and produce a three-dimensional image used in Computed
tomographic (CT)
How 3D scanner works
• Scanner shines a laser over the surface of a 3D object
• Measures and geometry of the object are input to a computer
system
• A 3D digital model is produced

P a g e | 15 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Optical character Recognition (OCR)


computers equipped with OCR software allow the scanned text from the document
to be converted into a text file format (Digital format).
Optical mark recognition (OMR)
The scanner scans a page and the OMR software notes where marks have been made
on it. The computer records the marks position as inputs. This method is widely used
to automatically mark MCQ.
Digital camera Can automatically carry out the following tasks:
 Adjust the shutter speed
 Focus the image automatically
 Adjust the size of the image
 Remove red eye
How it works?
 The photograph is captured when light passes through the lens onto a light
sensitive cell
 This is captured by a sensor called charge coupled device.
 This cell is made up of tiny elements knows as pixels which determine the size of
the file used to store the photograph.
 The recorded image is then stored on the memory available to the camera and
can be viewed in a screen
 This file can be uploaded to a computer to be stored for future use.
Barcode scanners It is a series of black and white vertical bars (dark and light parallel lines) of varying
thickness, the numbers 0 to 9 are each represented by a unique series of lines.
How it works
• The barcode is read using a barcode reader
• Barcode reader shines light/red laser at barcode
• Light is reflected back off the barcode; black bars reflect less light than white bars
• The reflected light is read by sensors
• A pattern is generated which is converted into digital data (numbers) and a
microprocessor interprets the data
QR codes It is made up of matrix of filled in dark squares on a light background
How it works
 Scan the QR code using the built in camera on a mobile device
 The three large squares are used to define the alignment
 Black squares reflect lee light than white squares
 Scanned image is processed by QR code reader application and the data is
decoded
 Each small square is converted to a binary value
 The code directs to website with information about
Newer QR codes called (frame QR codes) are now being used because
we can add advertising logo to it.
Advantage of QR codes compared to 16Disadvantage of QR codes compared to barcodes
barcodes
 They can hold much more information  More that one QR format is available
 There will be fewer errors; the higher  QR codes can be used to transmit malicious codes-
capacity of the QR code allows the use of known as attagging.
built in error checking systems.
 QR codes are easier to read, can be read
using the cameras on smartphones or
tablets.
 It is easy to transmit QR codes either as
text messages or images.
 It is also possible to encrypt QR codes.
P a g e | 16 Mr. Karim Wahid
01003335612
Computer Science OL Summarized Notes

Touchscreen Advantages of touchscreen


• Does not require peripherals
• Number of possible inputs limited
• Less chance of input errors
• Resistant to weather
Disadvantages of touchscreen
• Hygiene problems
• Limited number of options
Touch screen types:
Resistive
Uses two/multiple layers of material that transmit electric current; When the user
presses on the screen the top layer connects to (is pushed towards) the bottom layer
and the electric current changes; Circuit is completed when layers touch and point of
contact is determined

Benefits
 Cheap to manufacture
 Can use stylus/gloved finger

Drawbacks
 Poor visibility in sunlight
 Does not allow multi-touch facility
 Screen durability is fair; it is vulnerable to scratches

Capacitive
Electrical field/charge is spread across the screen; Sensors are located around the
screen and they used to read the electric field; When finger touches screen, the
charge is transferred to the user as it is affected by the conductivity of another object;
Coordinates of touch determined.

Benefits
 Good visibility in sunlight
 Allows multi-touch facility
 Screen is durable it takes a major impact to break the class
Drawbacks
 Can not use when wearing standard gloves

Infra-red
Infrared rays are sent across screen from the edges; Sensors capture beams
Infrared rays from a grid across the screen; If infrared ray is broken by a finger
blocking a beam. Calculation is made on where beam is broken to locate the touch
Benefits
 Allows multi-touch facility
 Can use stylus/ gloved finger
 Screen is durable it takes a major impact to break the glass
Drawbacks
 Expensive to manufacture
Microphone A microphone can convert sound waves into an electric current. The current
produced is converted to a digital format so that a computer can process it or store
it.
 When sound is created, it causes the air to vibrate
 When a diaphragm in the microphone picks up the air vibrations, the
diaphragm also begins to vibrate
P a g e | 17 Mr. Karim Wahid
01003335612
Computer Science OL Summarized Notes

 A copper coil is wrapped around the cone which is connected to the


diaphragm. As the diaphragm vibrates, the cone moves in and out causing
the copper coil to move backward and forwards.
 This forwards and backwards motion causes the coil to cut through the
magnetic field around the permanent magnet, including an electric current.
 The electric current is then either amplified or sent to a recording device.
The electric current is analogue in nature

OUTPUT DEVICES
Inkjet printer Principles of operation:
 Rollers are used to move the paper through the printer
 Uses cartridges/liquid ink
 Nozzles spray ink in droplets on the paper
 Inkjets/printer head/nozzles are moved across the paper to distribute the ink
 Makes use of thermal bubble/piezoelectric technology
Advantages:
 They are cheaper to buy than most other printers
 Image quality can be excellent when used with photographic paper
Disadvantages
 They are more expensive to run as they can use a lot of ink, which is expensive to
buy
 image quality can be poor when printing on ordinary paper
 They are slow at printing
Laser printer Principles of operation:
 Uses powdered ink/ toner cartridges
 Makes use of static electricity charges
 Uses a charged printing drum
 Uses a fuser to fix/melt ink onto the paper
 Uses a discharge lamp to remove static charge from the drum
Advantages:
 They are cheaper to run as toner cartridges last much longer
 Text printing quality is generally excellent
 They are very quick at printing
 They are suitable for duplex printing. This reduces paper cost
Disadvantages:
 Expensive to buy printer as laser technology is expensive
 Image printing quality on photographic paper is not as good as inkjet printer
 Can be quite large in size
3D printer Principles of operation of 3D printer:
 Produces solid 3D objects
 Used in CAD/CAM
 Makes use of tomography/slices of an object
 Solid built up in thin layers
 Uses resin, powdered metal, paper, plastic
P a g e | 18 Mr. Karim Wahid
01003335612
Computer Science OL Summarized Notes

Uses of 3D printer
 Prosthetic limbs made to exactly fit the recipient
 Items to allow precision reconstructive surgery
 In aerospace
 In fashion and art
LIQUID CRYSTAL LCD does not emit any light, so some form of back lit technology needs to be used, so
DISPLAY/DIODE in LCD uses a cold cathode fluorescent lamp (CCFL) as the backlighting method.
(LCD) screen • LEDs reach their maximum brightness almost immediately (there is no need to
LIGHT EMITTING warm up before reaching full efficiency
DIODE (LED) • LEDs give a whiter light, which sharpens the image and makes the colours appear
more vivid; CCFL had a slightly yellowish tint
• LEDs produce a brighter light, which improves the colour definition
• Monitors using LED technology are much thinner than monitors using CCFL
technology
• LEDs last almost indefinitely; this makes the technology more reliable and makes
for a more consistent product
• LEDs consume very little power, which means they produce less heat
ORAGANIC LIGHT • The plastic, organic layers of an OLED are thinner, lighter and more flexible than
EMITTING the crystal structures used in LEDs or LCDs.
DIODES (OLEDs) • OLEDs give a brighter light than LEDs
• OLEDs do not require backlighting like LCD screen, it generates their own light
• OLEDs have a wider viewing angle than LEDs and LCDs about 170 degrees
• Since OLEDs are essentially plastic, they can be made into large, thin sheets (they
could be used on large advertising boards in airports, subways, and so on)
LCD projector • Older technology than DLP. High Advantages:
intensity beam of light passes  Sharper image than DLP projectors
through LCD display and then onto  Have a better color definition than
a screen. DLPs
• Contains 3 separate LCD glass  Consumes less power, generates less
panels one for each RGB colors in an heat
image. Disadvantages:
• As the light passes through the LCD  Contrast ratios are not as good as
panels, individual pixels can be DLPs
opened to allow light to pass or  Have a limited life
closed to block the light
Digital light • Uses millions of tiny mirrors to Advantages:
processing (DLP) reflect light towards the projection  Higher contrast ratios
projector lens; it uses a digital micromirror  Higher reliability/longevity
device (DMD).  Smaller and lighter than LCD
• Mirrors are laid out in a grid/matrix projectors
• Each mirror creates a pixel in the Disadvantages:
image  Image tends to suffer from shadows
• Mirrors can tilt toward or away when showing a moving image
from light source  DLP do not have grey components in
• The mirrors reflect light toward a the image
projection lens  The color definition is frequently not
• Color is produced using a color as good as LCD projectors
wheel
Actuators When a computer is used to control devices such as a valve it is usually necessary to
use an actuator to open/close the valve. An actuator is a mechanical or
electromechanical device such as a relay or a motor.

P a g e | 19 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Memory and storage


Primary Memory Secondary storage/ Off-line storage
Directly accessed by the CPU  Not directly accessed by the CPU
 All are non-volatile devices
 Includes HDD, SSD, CD/DVD/Blu-ray/Memory stick/Flash memory
cards

Random access memory (RAM) Secondary and off-line storage falls into three categories according to
 Temporary memory devices the technology used:
 Volatile memory  Magnetic (HDD/Removable hard disk)
 Can be written to and read  Solid State (SSD/Memory Stick/Flash memory)
from  Optical (CD/DVD/Blu-ray)
 Used to store data, files, Magnetic
programs, part of OS Hard Disk Drive (HDD)
currently in use  Most common method used to store data on a
 Can be increased in size to computer.
improve operational speed  Data is stored in a digital format on the magnetic
of a computer surface of the disks (platters)
Read Only Memory (ROM)  A number of read-write heads can access all of the
 Permanent memory devices surfaces in the disk drive
 Non-volatile memory  Data is stored on the surface in sectors and tracks
devices  hard disk drives have very slow data access when compared to
 Data stored cannot be RAM
altered  Many applications require the read-write heads to constantly seek
 Always used to store basic for the correct block of data; this means a large number of head
input and output system movements. This causes an issue called latency.
(BIOS) these are known as Removable hard disk drives are essentially HDDs external to the
the startup instructions or computer that can be connected to the computer using one of the USB
bootstrap and other data ports.
needed at start up Solid state
Solid State Drives (SSD)
 SSD uses High speed flash memory is used to store data.
 Solid state storage contains cells and transistors that are laid out in
a grid.
 One of the transistors is called a controls gate (a component that
controls the flow of electric current) and the other one is called a
floating gate (a component that can store electrical charge).
 stores data by flashing it into chips
 Data is stored by controlling the movement of electrons.
 SSD either uses high speed flash memory which uses NAND chips
or EEPROM which uses NOR chips
 NOR chips are faster in operation but more expensive why faster?
EEPROM allows data to be read or erased in single bytes at a time
but the use of NAND only allows block of data to be read or erased.

The main benefits of using SSD rather than HDD:


 Data access is considerably faster than HDD as there is no latency
 They have a lower power consumption
 They are considerably lighter
 They are more reliable (no moving parts)

P a g e | 20 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

 They do not have to get up to speed before they work properly


 They run much cooler than HDD
 Thinner than HDDs

SSD Drawbacks:
 Higher initial cost than HDD
the questionable longevity of the technology. Most solid-state storage
devices are conservatively rated at only 20 GB write operations per
day over a three-year period-this is known as SSD endurance.
USB flash memories/pen drives
 Very small; lightweighted
 Suitable for transferring files between computers
 Can be used as small backup devices
Can be used as a security device (Dongle)
Optical storage Devices:
 CD/DVD uses Laser light is used to read data and to write data on
the surface of the disk.
 The data is stored in PITS and LANDS on the spiral track
 CDs and DVDs can be designated R (Recordable once only) or RW
(Rewritable) or ROM (Read only memory)
 DVD has more storage capacity the CDC that is mainly for 3
reasons:
o Some DVDs use of DUAL LAYERING which considerably
increase the storage capacity
o The PIT size and track width are both smaller. This means that
more data can be stored on the DVD surface.
o DVD uses laser with a shorter wavelength than CD; the
shorter the wavelength the greater the storage capacity.
DVD-RAM
 use a number of concentric tracks
 Use of concentric tracks allows simultaneous read and write
operations to take place.
 They have great longevity (over 30 years)
 They allow numerous simultaneous read and write operations (up
to 100,000 times)
Blu-ray disks
 Uses Blue laser
 Single spiral track
 Pits and lands are much smaller; so greater storage capacity
 Users shorter wave length than CD/DVD; so greater storage
capacity
 comes with a secure encryption system which helps to prevent
piracy.
Virtual Memory
 If the amount of available RAM is exceeded due to multiple programs running, it is likely to cause a
system crash.
 This can be solved by utilizing the hard disk drive (or SSD) if we need more memory.
 Essentially RAM is the physical memory, while virtual memory is RAM+ swap space on the hard disk
drive or SSD

P a g e | 21 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

 A section of the HDD/SSD is partitioned off and is effectively an extra bit for RAM
 When the RAM is full the computer system can transfer some data to the virtual memory to be
held there until it is needed
 It will send the data that is not immediately required.
 The data that is transferred is collected in a structure called a Page
 Once the pages of data are required again, they can be sent back to the RAM to be processed
Benefits of the virtual memory
 Programs can be larger than physical memory and still can be executed
 There is no need to waste memory with data that is not being used
 It reduces the need to buy and install more expensive RAM memory
Cloud Storage
 Data is stored in a remote location and managed/maintained by a third-party company and accessed
using an internet connection
 The same data is stored on more than one server in case of maintenance or repair, allowing clients to
access data at any time. This is known as data redundancy.
 There are three common systems:
o Public cloud: this is a storage environment where the customer/ client and cloud storage
provider are different companies
o Private cloud: this is storage provided by a dedicated environment behind a company firewall,
customer/ client and cloud storage provider are integrate and operate as a single entity.
o Hybrid cloud: this is a combination of the two previous environments, some data resides in
the private cloud while less-sensitive data can be accessed from a public cloud storage
provider.
Advantages:
• customer files stored in the cloud can be accessed at any time from any device anywhere in the world
• There is no need for the customer to carry an external storage device with them
• The cloud provides the user with remote backup of data
• If a customer has a failure of their hard disk or backup device, cloud storage will allow recovery of their
data
• The cloud system offers almost unlimited storage capacity
Disadvantages:
• Servers could be targeted by hackers
• If the customer has a slow or unstable internet connection, they could have problem accessing or
downloading their files
• Costs can be high if a large storage capacity is required
• The potential failure of the cloud storage company is always possible
• Relies on a third party maintaining the hardware

P a g e | 22 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Calculating sizes
Memory size using denary values
Bit 1 binary digit
Nibble 4 bits
1 byte 8 bits
1 kilobyte (KB) 1000 bytes
1 Megabyte (MB) 1000 KB
1 Gigabyte (GB) 1000 MB
1 Terabyte (TB) 1000 GB
1 Petabyte (PB) 1000 TB
1 Exabyte (EB) 1000 PB
IEC memory size system
Bit 1 binary digit
Nibble 4 bits
1 byte 8 bits
1 kibibyte (KIB) 1024 bytes
1 Mebibyte (MIB) 1024 KB
1 Gibibyte (GIB) 1024 MIB
1 tebibyte (TIB) 1024 GIB
1 Pebibyte (PIB) 1024 TIB
1 Exabyte (EIB) 1024 PIB

(1)A security system records video footage. One minute of video requires 180MB of storage. The
recording system can store several hours of video footage.
Calculate how much storage would be needed for 2 hours of video footage. Show your answer in GB
1 minute can store 180 MB
How many minutes in 2 hours?
120 Minutes
120 minutes
* 180 MB
21600 MB
So, 21600 MB / 1000 = 21.6 GB
(2) John wants to store a 16-bit colour image file. The image size is 1000 pixels.
Calculate the size of the file
Give your answer in bytes. Show your working
1 pixel = 16 bits
1 byte = 8 bits
1 pixel = 2 bytes
1000 pixel = 2000 Bytes
(3) An image is to be stored electronically. The image is 256 pixels high by 200 pixels wide with a 16-bit
colour depth.
Calculate the file size of the image in KB, you must show all of your working

Total pixels of the picture = 256*200 = 51200 pixels


1 pixel = 16 bits
1 pixel = 2 bytes
So, 51200 pixels = 102400 Bytes
102400 Bytes/1024
The file size is 100 KB
P a g e | 23 Mr. Karim Wahid
01003335612
Computer Science OL Summarized Notes

Chapter 4
Software
We have 2 types of software:

1. System software
A software that provides services that the computer needs and it allows the hardware to run properly such
as; Operating system, utilities (Anti-virus/anti-spyware/screensaver), Compiler, Device driver and Linker.

General features of system software:

 Set of programs to control and manage the operation of computer hardware


 Provides a platform on which other software can run
 Required to allow hardware and software to run without problems
 Provides a human computer interface (HCI)
 Controls the allocation and usage of hardware resources

2. Application software
A software that provides services that the user needs and it performs a specific task such as; Spreadsheet,
word processer, Presentation software and web browser.

General features of application software:

 Used to perform various applications on a computer


 Allows a user to perform specific tasks using the computer’s resources
 May be a single program or a suite of programs
 User can execute the software as and when they require

Operating System:
Software running in the background of a computer system which allows humans to communicate with the
computer hardware in an interactive way.

Functions of a typical operating system:

 Managing peripheral
 Allocates data to buffers
 Transmits data to hardware
 Receives data from hardware
 Memory and process management
 Allocates memory to processes
 Manages the primary storage (RAM) and allows data to be moved between RAM
and HDD/SSD during the execution of programs
 Keep track of all the memory locations
 Prevents two processes accessing the same memory location
 Security management
 Maintain access rights for all users
 Offering the ability for the recovery of the data when it has been lost or corrupted
 Helping to prevent illegal intrusion into the computer system
 Carrying out operating system updates
 File Management
 Maintain the directory structures

P a g e | 24 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
 Ensuring memory allocation for a file
 File naming conventions
 Performing specific tasks (Create, Open, Close, Delete)

 Provides a platform for running applications


 Allows application software to run on the computer

 Input and output control


 Error handling
 Loading and running of applications
 Management of user accounts
 Interrupt handling
 Provides human computer interface HCI(GUI-CLI)
 Multitasking & Multiprogramming

Firmware:
Instructions that are stored in the ROM and are Loaded when the computer
starts.
Bootstrap
The first commands loaded when a computer Starts, it checks hardware and
loads the Firmware.

Operating systems user interfaces


Command line interface (CLI) Graphical user interface (GUI)
• The user is in direct • The user does not need to
communication with the learn any commands
computer • It’s more user-friendly
• The user is not restricted to a • A pointing device is used to
Advantages
number of predetermined click an icon so it’s much
options easier
• Its possible to alter computer
configuration settings
• The user needs to learn a • It uses up more computer
number of commands to memory than a CLI
carry out basic operations • The user is limited to the
• All commands need to be icons on the screen
Disadvantages typed in which takes time • It needs an operating system
• Each command must be to operate which uses up
typed in using the correct considerable memory
format, spelling and so on

Users Programmers, analyst or


End-users
technician
Interrupts
 A signal sent from a device or from software to the processor
 This will cause the processor to temporarily stop what it is doing and service the interrupt
 They have different levels of priority
 After the interrupt is serviced, the previous process is continued
 It enables multi-tasking to be carried out on a computer

P a g e | 25 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

 Can be hardware based such as (key pressed on a keyboard, mouse click, printer out of paper,
paper jam)
 Can be software based such as (division by 0, two processes attempting to access the same
memory location, data required from memory)

How it works?

 When an interrupt is generated, it is put in a queue according to its priority


 When the processor finishes its current fetch decode execute cycle, it checks the interrupt queue
 It checks whether there is an interrupt with a higher priority than the current task it is processing
 If it is:
 Stores the current process and fetches the interrupt
 Checks the source of the interrupt
 Calls the relevant interrupt service routine (ISR). This is a sequence of instructions that handles
the interrupt
 When finished the stored process is returned to memory or another higher priority interrupt is
fetched.
 If it is not, it runs another FDE cycle.

Buffers
Used in computers as temporary memory area, they are essential in modern computers since hardware
devices operate at much slower speeds than processor, if it was not for buffers processors would spend the
majority of their time idle, waiting for the hardware device to complete its operation.
Syntax
The structure of language statements in a computer program
High level language HLL
• A programming language that is much easier for humans to understand and much closer to natural
language (C++, Java, Python)
• Needs to be translated by a compiler or an interpreter.
Low Level Languages LLL
• There are two main types of low-level language, Machine code and assembly language.
• Assembly language is an in-between stage; it uses mnemonics to represent code, it needs an
assembler to be processed

High level language Low level language


• Easier for humans to understand • More difficult for humans to understand
• Easier for humans to debug code • Harder for humans to debug code
• Portable, Machine independent • Not portable, machine dependent
• It must be converted into a low-level language • Machine code does not need converting
before it can be run • Assembly language must be assembled before
• One statement can represent many low-level execution, but this is faster than from a high-
instructions. level language
• Can not directly manipulate the hardware • Several instructions are needed for each high-
level language statement
• Can directly manipulate the hardware

P a g e | 26 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Translators
Interpreter Compiler
• Translates one line of code into machine code • Translates all lines of code into machine code,
and then executes it before executing the program
• Reports a syntax error as soon as it is picked • Reports all syntax errors at the same time, the
up, and stops the program running until program is not run until all errors are
corrected corrected
• Useful when writing a program • Useful when program has been finished and is
• Code needs to be re-translated each time the ready for testing or distribution
program is run • Code does not need re-translating each time
• Does not produce an executable file the program is run
• Source code is required to run the program • Produces an executable file
• Interpreter software is required to run the • Source code is not required to run the
program program, only the executable file
• You can test part of a program without • No other software is required to run the
completing it all executable file
• You need to finish a section of code before
testing it

Assembler
Same features as Compiler

Integrated Development Environment


IDE is used by programmers to aid the writing and development of programs.
Features:
• Code editor
• Translator
• Auto completion
• Auto correction
• Pretty Print

Chapter 5
The internet and its uses
Internet World wide web
• Users can send and receive emails • It is a collection of multimedia web pages and
• Allows online chatting other information on websites
• Makes use of transmission protocols (TCP) and • http(s) protocols are written using hypertext
internet protocol (IP) mark-up language (HTML)
• It is a worldwide collection of interconnected • Uniform resource locators (URLS) are used to
networks and devices specify the location of web pages
• Web resources are accessed by web browsers
• Uses the internet to access information from
web servers

P a g e | 27 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
The Domain Name Server (DNS)
A special server that contains a database for domain names and their corresponding IP address.

User’s Computer

Digital Currency
• A digital currency is one that exists electronically.
• There are several different forms of digital currency, the most popular are payment using credit
cards, mobile phones and smart watches.
• Digital currency relies on a central banking system
• The problem with centralization is maintaining confidentiality and security
• Cryptocurrency uses cryptography to track transactions; it was created to address the problems
associated with the centralization of digital currency.
• Unlike existing digital currencies, cryptocurrency transactions are publicly available and therefore all
transactions can be tracked and the amount of money in the system is monitored.
• The cryptocurrency system works by being within a blockchain network which means it is much more
secure.

Blockchain
A method that is used to track all the transactions made with a cryptocurrency.

• Decentralized database
• It acts as a ledger (each time a payment is made with the digital currency, a record is added to
the ledger that includes a digital signature with the time and date that the payment is made
• Once these records are added to the digital ledger they can not be changed

Blockchain is used in many areas such as: Cryptocurrency – research – politics – education

How blockchain works


whenever a new transaction takes place, a new block of data is created and it contains the following:

• Data – for example, sender name and recipient, amount of money


• Hash value – a unique value generated by an algorithm
• Previous hash value – these points back to a previous block in the chain
• Time Stamp

P a g e | 28 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Cyber Security
1. Brute Force Attack
When a hacker tries all the different combinations of letters, numbers and other symbols until
eventually they find your password it can be manual or using computer.

Security Solutions:

• Using a strong password to protect your data. A strong password is created by mixing different
uppercase and lowercase letters, numbers and symbols, not using personal information in the
password.
• Limiting the number of times, a password can be entered before the account is locked.
• Using a biometric password
• Using a two-step verification/ two factor authentications.

2. Data Interception
Intercepting data packets as they are transmitted across the network from one device to another.
This is done by using a piece of software called a packet sniffer, this is normally installed onto a piece
of hardware that the packets will pass through, for example a router. This software is used to
examine packets of data that are sent across a network to see if they contain data that looks useful.

Security Solutions:
• Encrypting the data
• Visually checking the URL of a website to see if it uses the HTTPS protocol

P a g e | 29 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

3. Distributed Denial of Service (DDOS) attacks


A type of cyber threat that targets a web server to cause it to crash and prevent access to the web
pages that it stores.
How it works
• A perpetrator will first create a botnet. This is done by sending malware to many computers to
try and get you to accidentally download it
• Once you have downloaded the malware, the computer can then be used as a bot by the
perpetrator
• Whilst the bot is not being used it is often called a ZOMBIE
• Once the perpetrator wants to carry out the attack, they wake up all the zombies to be used as
bots
• Each bot will begin sending multiple requests to access a web server. They are all set to send
requests to the same web server all at the same time.
This floods the web server with too many requests and it begins to struggle to deal with each
request.

Botnet
A network of bots that are created to carry out a DDOS attack.

DDOS aims
• To demand a ransom to stop it
• Revenge
• To affect a company’s reputation
• Entertainment
• To test a system’s resilience

Security Solutions

• Proxy server
• firewall

P a g e | 30 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

4. Hacking
Gaining unauthorized access to a computer system without the user’s permission. This can lead to
identity theft or gaining of personal information; data can be deleted, passed on, changed or
corrupted.

Security Solutions

• Firewall
• Enable automatic software updates
• Strong and frequently changed passwords
• Use biometric passwords
• Use two step verification

5. Malware
is the term used to describe any malicious software that is designed to disrupt your computer or
data
A self-replicating software that infects your computer and attach itself to
Virus your files with the intention of deleting/ corrupting your data or uses up all
the available memory in your computer, causing it to slow down and crash
A self-replicating software that finds vulnerability holes in a network and will
Worm
clog the bandwidth of a network and slow the network down
This is a computer program that is downloaded onto your hard drive and
Spyware/keylogging records all the key presses that you carry out on your keyboard. This data is
software then sent to the perpetrator where it can be analyzed to identify patterns in
your data
A computer program that is designed to look like a harmless piece of
Trojan horse software; such as an application or game, but it contains other malware
such as virus or spyware
a computer program that is designed to automatically created pop up and
Adware banner adverts when you are online; the adware creators are given money
by the companies that appear in the advertisements when you click on them
A computer program that is downloaded onto your hard drive that encrypts
Ransomware
a user’s data to stop them gaining access to it until a ransom is paid
Malware security solutions:
1. Antivirus
This is a software that can be used to scan your computer for viruses. This is a type of
software that scans all of the files in your computer to see if any of them are known to
be a virus. It does this by comparing each file against a known list of viruses to see if any
of the files on your computer match, if it finds a file that matches, it will put it in a special
area called a quarantine area. It will then inform you that it has found what it thinks is a
virus and will ask you if you want to delete the file.
2. Anti-malware
3. Firewall
4. Backup your data on a regular basis to avoid paying a ransom to get access to your data
5. Using a virtual keyboard to type personal data such as passwords to avoid the effect of
keylogging software

P a g e | 31 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

6. Phishing
A type of cyber threat that involves sending a user a fake email that is designed to look genuine. It
will encourage the user to provide their personal data either by clicking a link to a fake website, or
by responding to the email.

Security Solutions

You can help prevent yourself getting fooled by any phishing scams by checking:
• The spelling and tone of the text in the email
• Whether the email has been personalized or if it is addressed in a generic way
• If the URL at the top of the screen is the correct one
• If the site is secured using HTTPS

7. Pharming
malicious code installed on a user’s computer or on an infected website. The code redirects the
user’s browser to a fake website without the user’s knowledge.

Security Solutions

• Use of ant-virus software can detect unauthorized alterations to a website address


• Many modern browsers can alert users to pharming and phishing attacks
• It is very important to check the spelling of websites to ensure the web address used it correct
• use of https or the green padlock symbol in the address bar is an additional form of defense

8. Social Engineering
Occurs when a cybercriminal creates a social situation that can lead to a potential victim dropping
their guard. It involves the manipulation of people into breaking their normal security procedures
and not following best practice.

P a g e | 32 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
Security Solutions

• Use of Access Levels (the amount of direct access a user is given to data and resources. This could
be set to be only certain sections of a whole collection of data and resources)
• Anti malware
Authentication
Authentication refers to the ability of the user to prove who they are. There are three common factors used
in authentication:
Authentication Techniques:
 Passwords and user names
 Biometrics
 Unique physical characteristics
 Very difficult to replicate
 Can not be guessed or forgotten
 Such as Fingerprint, retina scan, face recognition and voice recognition
 Two step verification
 Requires two methods of authentication to verify who a user is
 Extra data is sent to the device
 Making it more difficult for the hacker to obtain it
 Extra layer of security
How to protect your password?
 Passwords should not be easy to crack
 Strong passwords should contain:
o At least one capital letter
o At least one numerical value
o At least one other keyboard character (such as @,#,$,%)
 Change passwords on a regular basis
 Run anti spyware software to make sure that your password are not being relayed back to others
Firewall
a firewall can be either software or hardware. It sits between the user’s computer and an external network
(for example, the internet) and filters information in and out of the computer.
Main tasks carried out by the firewall:
 To examine the traffic between user’s computer and a public network
 Checks whether incoming or outgoing data meets a given set of criteria
 If the data fails the criteria, the firewall will block the traffic and give the user a warning that there
may be a security issue
 The firewall can be used to log all incoming and outgoing traffic to allow later interrogation by the
user
 Criteria can be set so that the firewall prevents access to certain undesirable sites
 It is possible for firewalls to help prevent viruses or hackers entering the user’s computer
 The user is warned if some software on their system is trying to access an external data source

P a g e | 33 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Proxy server
proxy servers act as an intermediate between the user and a web server:

 Allows internet traffic to be filtered; it is possible to block access to a website if necessary


 Keeps user’s IP addresses secret which improves security
 If the internet traffic is valid; access to the web server is allowed
 If the internet traffic is invalid; access to the web server is denied
 It is possible to block requests from certain IP addresses
 Prevents direct access to a web server by sitting between the user and the web server
 If an attack is launched, it hits the proxy server instead- this helps to prevent hacking, DoS, and so
on.

What are the similarities and differences between the firewall and the proxy server?
Similarities
 Check incoming and outgoing signals
 Store whitelist/blacklist websites
 Block access to incoming signals
 Both block unauthorized access
 Both keeps a log of traffic
Differences
 Proxy can hide user’s IP address, firewall does not
 Proxy intention is to divert attack from server, firewall is to stop unauthorized access
 Proxy protects a server/network, firewall protects network/individual computer
 Proxy filters access from items such as websites, firewall block ports

Secure Socket Layer (SSL)


it is a type of protocol – set of rules used by computers to communicate with each other across a network.
This allows data to be sent and received securely over the internet.
What happens when a user wants to access a secure website and receive and send data to it?
 The user’s web browser sends a message so that it can connect with the required website
which is secured by SSL
 The web browser then requests that the web server identifies itself

P a g e | 34 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
 The web server responds by sending a copy of its SSL certificate to the user’s web browser
 If the web browser can authenticate this certificate, it sends a message back to the web server
to allow communication to begin

Once this message is received, the web server acknowledges the web browser, and the SSL-encrypted two-
way data transfer begins

Transport Layer Security (TLS)


TLS is a more modern and more secure version of SSL. TLS is comprised of two main layers:
 Record protocol
This part of the communication can be used with or without encryption (it contains the data being
transmitted over the network)

 Handshake protocol
This permits the web server and client to authenticate each other and to make use of encryption
algorithms (a secure session between client and server is then established)

Chapter 6
Automated and emerging technologies
Embedded system
 A system that is used to perform a dedicated function
 It has a microprocessor
 It has dedicated hardware
 It uses firmware
 It is normally built into a larger device/system
 It does not require much power

e.g. domestic appliances, cars, security systems, lighting systems or vending machines

Microprocessor
Integrated circuit built into a single chip.

Sensors
input devices which read and measure physical properties. These can measure temperature, pressure, acidity
and so on. Real physical data is analogue in nature, this means it is constantly changing and does not have a
discrete value.so it needs to be converted into digital data using an ADC in order for the
computer/microprocessor to understand it.

Sensor type Applications


Acoustic/Sound Security systems
In mobile phones to know which way up it is faced,
to automatically turn the screen on and off.
Accelerometer
To monitor earthquakes
In cars to detect if a crash has occurred
to make sure that the liquid, gas or steam flows at a
Flow constant temperature through an environment,
such as a pipe
This sensor can be used in people’s homes. They can
Gas be set to measure a certain gas, such as carbon
monoxide.

P a g e | 35 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

in farming and agriculture to make sure that the air


in areas such as greenhouses has the correct level
Humidity
of moisture to provide the best growing conditions
for the fruits and vegetables
Infra-red Security systems
in cars to make sure that essential liquids, such as
Level
oil and fuel, do not get too low.
Light automatic lighting systems. Streetlights
Can be used to count how many cars pass through a
Magnetic field
certain area
can also be used in farming and agriculture, to make
Moisture sure that the fruits and vegetables have the best
level of water in the soil to help them grow.
pH Can be used in pollution monitoring
can be used in robots in manufacturing. They allow
Proximity the robots to measure how close they are to
different objects
used in air conditioning systems, they monitor the
Temperature
temperature of a room

Measurement applications
Example: Measuring a patient’s vital signs in a hospital

 Sensors read key vital signs (pulse rate, heart rate, temperature, blood pressure)
 The data from the sensors is converted into digital using an ADC
 The data is stored in the computer’s memory
 The computer compares the data from the sensors with the values stored in its memory (these will
be input by the nurse or doctor for a particular patient)
 The results are output on a screen in the form of graphs and/or numerical
 An alarm is activated if any of the data is outside acceptable input values
 The system continues to measure the patient’s vital signs until the computer is turned off

Control applications
Example: Central heating systems

A gas supply is used to heat water in a boiler. A valve on the gas supply is controlled by a microprocessor and
is opened if the heating levels need to be increased. A water pump hot water around the central heating
system whenever the temperature drops below a pre-set value

How does it work?

 The required temperature is keyed in and this is stored in the microprocessor memory (this is called
the pre-set value)
 The temperature sensor constantly sends data readings to the microprocessor
 The sensor data is first sent to and ADC to convert the analogue data into digital data
 The digital data is sent to the microprocessor
 The microprocessor compares this data with the pre-set value
 If the temperature reading greater than or equal to the pre-set value then no action is taken
 If the temperature reading is less than the pre-set value, then a signal is sent:
o To an actuator (via DAC) to open the gas valve to the boiler
o To an actuator (via DAC) to turn on the water pump
 The process continues until the central heating is switched off
P a g e | 36 Mr. Karim Wahid
01003335612
Computer Science OL Summarized Notes
Example: How sensors and microprocessor are used to control the braking systems in the car
 ANTI-LOCK BRAKING SYSTEMS (ABS) on cars uses magnetic field sensors to stop the wheels locking
up on the car if the brakes haven been applied too sharply
 When one of the car wheels rotates too slowly (locking up) a magnetic field sensor sends signals to
the microprocessor
 Signal is converted from analogue to digital using ADC
 Microprocessor compares the rotation speed of that wheel with the other 3 wheels
 If the other 3 wheels are rotating faster
 Microprocessor sends signals to the braking system and the braking pressure to the affected wheel
is reduced and its rotational Is increased to match the 3 other wheels
 If one of the wheels is rotating too quickly, braking pressure is increased to that wheel until it
matches the other three
 Process is continuous
When evaluating the use of automation, you need to consider:

 Initial cost
 Running cost
 Safety
 Replacing people’s jobs
 Continuous work all day every day
 Precision
Robotics
A robot is a mechanical device that performs an action, usually an action that a human would perform.It
can be controlled by a person, or they might be automated, or a mixture of the two.

 Robots have a range of features:


o A mechanical structure of framework. This is the body of the robot
o Electrical components such as:
 Sensors to record its environment, for example, the position of the components it
is building.
 Microprocessor, to take the reading from the sensor and decide the action to
perform
 Actuators, to make the robot move.
o Robots are programmable.

Advantages Disadvantages
 Robots are capable of working in conditions  High initial cost
that may be hazardous to humans  High maintenance cost
 Robots work 24/7 without breaks  Robots find it difficult to do non-standard
 Low running cost as there will be fewer tasks
salaries to pay  Robots can lead to higher unemployment
 Robots are more productive than humans rate
 Robots are more consistent  Risk of deskilling when robots take over
 Robots are better suited to boring, certain tasks
repetitive tasks

P a g e | 37 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Artificial intelligence
is the development of programs to simulate human behavior. There is a broad range of areas within AI:

 Image recognition: to identify objects or people in an image


 Speech recognition: to identify words spoken and store them
 Natural language: to receive a command or instructions that is not in a set format and perform the
required response.
 Computer games: to move elements or characters independently based upon the environment.
 Diagnosis system: for example, medical diagnosis
Components of AI:

 Collection of data
 A set of programmed rules
 The ability to reason
 The ability to learn and adapt
Machine Learning
Machine learning is a sub-set of artificial intelligence (AI), in which algorithms are trained and learn
from their past experience and examples.
Expert system
Expert systems have been developed to mimic the expertise and knowledge of an expert in a
particular field.

Components:
 User interface
o It is a method by which the expert system interacts with the user
o Interaction can be through dialogue boxes, command prompts or other input
methods
o The questions being asked usually only have yes/no answers and are based on the
responses to previous questions.
 Inference engine
o This is the main processing element of the expert system
o It acts like a search engine examining the knowledge base for information
o It is the problem-solving part of the expert system that makes use of inference rules
in the rule base

P a g e | 38 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
 Knowledge base
o It is a collection of facts/knowledge
o It stores all the knowledge about an area of expertise obtained from a number of
expert resources
 Rules base
o Set of inference rules
o Inference rules are used by the inference engine to draw conclusions
o They follow logical thinking; usually involves a series of IF statements

Examples:
 Car diagnosis
 Medical diagnosis
 Prospecting for oil
 Financial calculations
 Strategy games (chess)
 Identification of plants, animals and chemical compounds
How to set up an expert system

 Experts in the field are interviewed


 Data is then collected from these experts
 A knowledge base is first designed and then created (the knowledge from the experts is used to
populate the knowledge base)
 A rule base is then designed and created and an inference engine is also designed and created
 An explanation system is also developed
 The user interface is also designed (input screen and output format)
 The expert system is tested against known conditions/scenarios
 Experts are interviewed about how effective it is before the expert system goes out on general
release
Medical diagnosis example:

 First of all, interactive screen is presented to the user


 The system asks a series of questions about the patient’s illness
 The user answers the question asked
 A series of questions are asked based on the user’s responses to previous questions
 The inference engine compares the symptoms entered with those in the knowledge base looking
for matches
 The rules base is used in the matching process
 Once a match is found, the system suggests the probability of the patient’s illness being identified
accurately
 The expert system also suggests possible solutions and remedies to cure the patient or
recommendations on what to do next
 The explanation system will give reasons for its diagnosis so that the user can determine the
validity of the diagnosis or suggested treatment
 The diagnosis can be in the form of text or it may show images of human anatomy to indicate
where the problem may be
 The user can request further information from the expert system to narrow down even further
the possible illness and its treatment

P a g e | 39 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
Expert System Advantages:

 They provide consistent answers and are not affected by emotional reasoning
 They never forget to answer a question
 Reduces the time solving a problem
 They indicate the probability of the given solution being accurate
 The potential of saving money exists since there is less need for specialists
 Allows areas of the world access to expertise which they could not normally affords
Expert System Disadvantages:

 Lack of common sense


 Errors in the knowledge base can lead to incorrect decisions being made
 They are expensive to set up in the first place
 Needs considerable training to ensure the system is used correctly

P a g e | 40 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Programming
Programming Data Types

Data Type Description Example

INTEGER A whole number that has no decimal points 3,-5,2000

REAL A number that has decimal points 3.5/-4.3


CHAR A data type that holds only one character (it must be between a single ‘x’,’@’
quote

STRING The name given to a series of characters or symbols (it must be between a “Ahmed”,
double quote ”CS”,
“IGCSE”
BOOLEAN Can have only two values True/false

Arithmetic operators

Addition 5+3

Subtraction 5-3
Multiplication 5*3
Division 5/3
Power 5^3

Principles of programming

1. Sequence
Statements are followed in sequence so the order of the statements in a program is important.
2. Selection/conditional statements
The process of making a decision in a program. This is to allow different routes through a program
dependent on meeting certain criteria.

3. Iteration/Repetition/Loops
Iteration is used when some instructions need to be repeated

4. Totalling
Process of keeping a running total of certain values in a program.

5. Counting
Counting is used if we need to keep a record of how many times something has happened.

Variable: is a memory location that contains a value that may change during the execution of a program.

Constant: is a memory location that contains a value that does not change during the execution of a
program.

P a g e | 41 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
 is an assignment operator (it means it assigns the variables on the right-hand side to the variable on the
left-hand side)

Variable names rules


1. Meaningful
2. Each word must start with a capital letter
3. Should not have spaces between words
4. Should not start with a number
5. Variable name must be the same throughout the whole algorithm

Selection/conditional statements
IF…. THEN…. ELSE…. ENDIF CASE…. OF…. OTHERWISE…. ENDCASE

Used when we have a range of values Used when we have specific discrete values

A condition than can be true or false (only 2 A choice between several different values (more than 2
options) of values)
A statement that allows for multiple sections

Checking for a condition that may be complex

Uses relational operators


<,>,<=,>=,<>,!=,(),AND,OR,NOT

Example:
INPUT Age
IF Age > 18
THEN
OUTPUT “Adult”
ELSE
OUTPUT “Child”
ENDIF
Example:
INPUT MenuNumber
CASE OF MenuNumber
1: OUTPUT “Orange juice”
2: OUTPUT “Chicken”
3: OUTPUT “Beef”
OTHERWISE
OUTPUT “Wrong choice”
ENDCASE
P a g e | 42 Mr. Karim Wahid
01003335612
Computer Science OL Summarized Notes
Iteration/Repetition/Loops

FOR..TO..NEXT WHILE..DO..ENDWHILE REPEAT..UNTIL

Count controlled loop Pre-condition controlled loop Post-condition-controlled


loop

A set number of iterations/ A fixed number The loop may never be At least one repeat is
of repetitions executed required

Standard Methods of solution:


1- Totalling
keeping a total that values are added to or keeping a running total.
Example: input 50 numbers and find their total
Total  0
FOR Count  1 to 50
INPUT Num
Total  Total + Num
NEXT Count
OUPUT Total

2- Counting
Keeping a count of the number of times an action is performed.
Example: input 5o numbers and find how many numbers are greater than 20

Count20  0
FOR Count  1 to 50
INPUT Num
IF Num > 20
THEN
Count20  Count20 + 1
ENDIF
NEXT Count
OUTPUT Count20

3- Finding the Average


Example: input 100 numbers and get the average of the numbers greater than 20.

Total20  0
Count20  0
FOR Count  1 to 100
INPUT Num
IF Num > 20
THEN
Count20  Count20 + 1
Total  Total20 +Num
ENDIF
NEXT Count
Average  Total20/Count20
OUTPUT Average

P a g e | 43 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
4- Finding the Maximum
Example: Input 50 numbers and find the highest number

Highest  0
FOR Count  1 to 50
INPUT Num
IF Num > Highest
THEN
Highest  Num
ENDIF
NEXT Count
OUTPUT Highest

5- Finding the Minimum


Example: Input 5o numbers and find the lowest number

Lowest  999999
FOR Count  1 to 50
INPUT Num
IF Num < Lowest
THEN
Lowest  Num
ENDIF
NEXT Count
OUTPUT Lowest

6- Finding the Maximum and the Minimum


Example: Input 100 grades and output the maximum and the minimum grade

Highest  0
Lowest  99999
FOR Count  1 to 100
INPUT Grade
IF Grade > Highest
THEN
Highest  Grade
ENDIF
IF Grade < Lowest
THEN
Lowest  Grade
ENDIF
NEXT Count

P a g e | 44 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
7- Finding the Maximum and the minimum (Advanced)
Example: Input 100 numbers and output the maximum and the minimum numbers

INPUT Num
Highest  Num
Lowest  Num
FOR Count  1 to 99
IF Num > Highest
THEN
Highest  Num
ENDIF
IF Num < Lowest
THEN
Lowest  Num
ENDIF
INPUT Num
NEXT Count

8- Linear Search
You have a list of 10 unique names stored in an array called Names, the user will input a name and
the algorithm needs to search for it in the array if it is present output “Name Found” if not output
“Name was not found”.
Count  1
Found  False
INPUT SearchName
WHILE Count <=10 AND Found = False DO
IF SearchName = Names[Count]
THEN
Found  True
OUTPUT “Name Fount at position “, Count
ENDIF
Count  Count + 1
ENDWHILE
IF Found = False
THEN
OUTPUT “Name was not found”
ENDIF

9- Bubble Sort
Sort a list of ten unique temperatures stored in an array called Temperature into an ascending order.
REPEAT
Swap  False
FOR Count  1 to 9
IF Temperature [Count] > Temperature [Count+1]
THEN
Temp  Temperature [Count]
Temperature [Count]  Temperature [Count+1]
Temperature [Count+1]  Temp
Swap  True
ENDIF
NEXT Count
UNTIL Swap = False
P a g e | 45 Mr. Karim Wahid
01003335612
Computer Science OL Summarized Notes
Using Condition Controlled Loops
WHILE…DO…. ENDWHILE
REPEAT…..UNTIL

Example:
Input numbers until their total becomes higher than 1000

Total  0
WHILE Total <= 1000 DO
INPUT Num
Using WHILE Total  Total + Num
ENDWHILE
OUTPUT Total

Total  0
REPEAT
INPUT Num
Using Repeat
Total  Total + Num
UNTIL Total > 1000
OUTPUT Total

Example: Input marks until the total of the marks is greater than 500 and get the average of all the marks
Total  0
Count  0
WHILE Total <= 500 DO
INPUT Mark
Total  Total + Mark
Count  Count + 1
ENDWHILE
Average  Total/Count
OUTPUT Average

Example: Input weights until their total is higher than 5oo and get the highest weight and output it

Total  0
Highest  0
WHILE Total <=500 DO
INPUT Weight
IF Weight > Highest
THEN
Highest  Weight
ENDIF
Total  Total + Weight
ENDWHILE
OUTPUT Highest

P a g e | 46 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
Conversion between different types of loops

1. Conversion from FOR TO NEXT to WHILE DO ENDWHILE


 All of the algorithm will be the same except the line that starts with FOR and the line that
starts with NEXT
 Each of the mentioned lines will be divided into 2 lines as you can see in the table below

2. Conversion from WHILE DO ENDWHILE to REPEAT UNTIL


 All of the algorithm will be the same except the line starts with WHILE and the line that starts
with ENDWHILE
 The line that starts with WHILE will be converted to REPEAT
 THE line that starts with ENDWHILE will be converted to UNTIL and you will invert the
condition written next to WHILE so, if it was WHILE Count <=50 it will be UNTIL Count
>50

FOR TO NEXT WHILE DO ENDWHILE REPEAT UNTIL

Total  0 Total  0 Total  0


Count  1 Count  1
FOR Count  1 to 50
WHILE Count <= 50 DO REPEAT
INPUT Num INPUT Num INPUT Num

Total  Total + Num Total  Total + Num Total  Total + Num


Count  Count + 1 Count  Count + 1
NEXT Count
ENDWHILE UNTIL Count >50
OUPUT Total OUTPUT Total OUTPUT Total

Rogue value
Example: Input numbers and get the total of the numbers until the user inputs -1

Total  0
INPUT Num
WHILE Num <> -1 DO
Using While Total  Total + Num
INPUT Num
ENDWHILE
OUTPUT Total
Total  0
REPEAT
INPUT Num
Using Repeat
Total  Total + Num
UNTIL Num = -1
OUTPUT Total+1

P a g e | 47 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Text file handling


How to write in the file
If you need to open the file and write to it use the following command
OPENFILE “filename” FOR WRITE

If you need to write in the file, use the following command


WRITEFILE “filename”, “text you want to type”

If you to close the file, use the following command


CLOSEFILE “Filename”

Example: Input from a user 10 lines of text and store them in a text file called “file1.txt”.

OPENFILE “File1.txt” FOR WRITE


FOR COUNT  1 to 10
INPUT Line
WRITEFILE “File1.txt”, Line
NEXT Count
CLOSEFILE “File1.txt”

How to read from the file


OPENFILE “Filename” FOR READ

How to store the first line in a variable


READFILE “Filename”, Variable name  you cannot read the line directly, you have to store it first in a variable

If you to close the file, use the following command


CLOSEFILE “Filename”

Example: Open the file “file1.txt” to read and display the first 5 lines on the screen.

OPENFILE “File1.txt” FOR Read


FOR Count  1 to 5
READFILE “File1.txt”, Line
OUTPUT Line
NEXT Count
CLOSEFILE “File1.txt”
Arrays
An array is a data structure containing several elements of the same data type; these elements can be accessed
using the same identifier name. the position of each element in an array is identified using the array’s index.

Index Mylist
1 25
2 36
3 45
4 11
5 67
The name of the array is Mylist, The index indicates the position of each element in the array
Dimension: The dimension is the number of indexes required to access an element
Index: The index is the position of the element in the array.

P a g e | 48 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
Example: Inputting data in an array called NumList that has 5 elements
FOR Count  1 to 5
INPUT Numlist [Count]
NEXT Count

Example: Output the data from an array called NumList that has 5 elements
FOR Count  1 to 5
OUTPUT Numlist [Count]
NEXT Count

Example: Input and record 100 numbers and get their total.
Total  0
FOR Count  1 to 100
INPUT NumList [Count]
Total  Total + NumList [Count]
NEXT Count
OUPUT Total

Example: Input and record 500 scores and count the scores greater than 90

Count90  0
FOR Count  1 to 500
INPUT ScoreList [Count]
IF ScoreList [Count] > 90
THEN
Count90  Count90 + 1
ENDIF
NEXT Count
OUTPUT Count90

2D Arrays
A 2-dimensional array is best viewed as a table with rows and columns.
Let’s say we have a 2-D array called numbers
1 2 3 4
1
2
3
4
5

So you need to identify the row and the column number; For Example Numbers [4,3] the first number
identifies the row number and second number identifies the column number.
Example: Input and record 6 test marks for 7 students in the 2D array Marks.
FOR Row  1 to 7
FOR Column  1 to 6
INPUT Marks [Row, Column]
NEXT Column
NEXT Row

P a g e | 49 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
Example: Input and record age, weight and height for 5 students in a 2-D array called StudensInfo
FOR Row  1 to 5
INPUT “Enter Age” StudentInfo [Row,1]
INPUT “Enter Weight” StudentInfo [Row,2]
INPUT “Enter Height” StudentInfo [Row,3]
NEXT Row

Using the StudentInfo array, get the highest weight.


Highest  0
FOR Row  1 to 5
IF StudentInfo [Row,2] > Highest
THEN
Highest  StudentInfo [Row,2]
ENDIF
NEXT Row

Built In Functions/ Library routines


These routines are fully tested and ready to use and it is ready to incorporate into a program.
Mathematical Functions
1. INT (Number with Decimals)  Whole number after REMOVING the decimals
INT (4.6)  4
2. DIV (Dividend, Divisor)  Quotient {to perform integer division, meaning only the whole
number part of the answer is retained}
DIV (10,3)  3
3. MOD (Dividend, Divisor)  Remainder {to perform integer division and find the remainder}
DIV (10,3)  1
4. ROUND (Number with Decimals, Number of Decimal places)  Number with the new decimal
places {to return a value rounded to a specific number of digits, the result will either be rounded
to the next highest or the next lowest value}
ROUND (4.29,1)  4.3
5. RANDOM ()  A random real number between 0 AND 1 { to generate random numbers
usually within a specified range}
RANDOM ()  0.5
String handling functions
1- Length (TEXT)  Counts how many characters
LENGTH (Karim Wahid)  11
2- UPPER/UCASE  Converts to Uppercase
UPPER (karim)  KARIM
UCASE (karim)  KARIM
3- LOWER/LCASE  Converts to lowercase
LOWER (KARIM)  karim
LCASE (KARIM)  karim
4- SUBSTRING (TEXT, Starting Number, Number of Characters)
SUBSTRING (“Hello”, 1, 2)  He

P a g e | 50 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Declaration
A programming statement that assigns a data type to a variable.
Variables:
DECLARE Variable Name: Data Type
DECLARE Total: Integer

1D Array:
DECLARE Array Name: Array [1: last index number] OF Data Type
Let’s declare an array with the name NumList that has 50 numbers that has decimals.
DECLARE NumList: Array [1:50] OF Real

2D Array:
DECLARE Array Name: Array [1: Row numbers,1: Column numbers] OF Data Type
Let’s declare a 2-D array with the name StudentsMarks that has the marks of 5 students in 6 subjects noting
that there are no decimals in the marks.
DECLARE StudentsMarks: Array [1:5,1:6] OF Integer

Constant: A named data location in a program for a value that does not change.
Example: The value of the Pi (π)
How to declare a constant?
Constant Pi = 3.14

Example: Input and record 20 numbers (to 1 decimal place) and get the total. Declare any identifiers used.
DECLARE Total: Real
DECLARE Count: Integer
DECLARE NumberList: Array [1:20] OF Real
Total  o
FOR Count  1 to 20
INPUT NumberList [Count]
Total  Total + NumberList [Count]
NEXT Count
OUTPUT Total

Subroutines or the user defined functions


A subroutine is a self-contained piece of code that has an identifier, and can be called from anywhere in the
main program.
There are two types of subroutines:
1- Procedure: A subroutine that does not return a value to the program that called it.
2- Function: A subroutine that does return a value to the program that called it.
Why we use subroutines?

 They reduce code; you only write the subroutine once and you can it as many times as you need to.
 Save time; instead of having to re-write it every time.
 Reduce errors; Each time you re-write it there is a chance of an error.
Parameters: are the variables that store the values of the arguments passed to a procedure or a function from
the main program

P a g e | 51 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
Example: create a procedure to output stars on the screen.
PROCEDURE Stars (Number: INTEGER)  The variables between the brackets called Parameters
FOR Count  1 to Number
OUTPUT “*”
NEXT Count
ENDPROCEDURE
In order to use the procedure in the main program you will use the following command
CALL Stars (7)  it will display 7 stars on the screen.

Local Variables: Can only be used by the part of the program it has been declared in- its scope is restricted
to that part of the program.
Global Variables: Can be used by any part of a program- its scope covers the whole program.

Example: Create a function to convert a temperature from Fahrenheit to Celsius.


FUNCTION Celsius (Temperature: REAL) RETURNS REAL
RETURN (Temperature – 32) /1.8
ENDFUNCTION
In order to return the value that is produced from the function, it has to be stored in a variable.
MyTemp  Celsius (MyTemp)  you can use any variable name other than the function name.

Program development life cycle


A series of structure step/activities that are followed to produce a system.it is divided to 5 stages: (analysis-
design- coding- testing- maintenance).
We will only discuss the first four stages

Analysis
Before any problem can be solved, it needs to be clearly defined and set out so anyone working on the
solution understands what is needed. This is called the requirements specification for the program. The
analysis stage uses the following tools:

 ABSTRACTION
Abstraction keeps the key elements required for the solution to the problem and discards any
unnecessary details and information that is not required.

 DECOMPOSITION
breaks down a complex problem into smaller parts, which can then be subdivided into even smaller
parts, that can be solved easily.
Component parts when a problem has been decomposed at the analysis stage:
o Inputs
o Processes
o Outputs
o Storage

P a g e | 52 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Design
This includes an overview of the program using a structure diagram, and the designing of algorithms using
flowcharts and pseudocode.
Top-Down design
the decomposition of a computer system into a set of sub-systems, then breaking each sub-system down into
a set of smaller sub-systems, until each sub-system just performs a single action.

Structure Diagram
Structure diagrams can be used to show top-down design in a diagrammatic form., the diagram has the name
of the program at the top, and below this its subprograms. Each subprogram can be split down further as well
if required.

P a g e | 53 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Coding
The program or set of programs is developed. Each module of the program is written using a suitable
programming language and then tested to see if it works.

Testing
The completed program or set of programs is run many times with different sets of test data. This ensures
that all the tasks completed work together as specified in the program design.

Test Data
Normal Data within a given range (should be accepted) Any number between 2 and 99
Abnormal Data outside the given range (should be rejected) 110 / -20
Extreme Data at the edge of what is allowed (should be accepted) 1 and 100
Boundary Data at the edge of being accepted & being rejected For 0 is -1
For 100 is 101

Verification
Checking that data is entered accurately
Double data entry in this method, data is entered twice, using two people, and is then compared
Visual checking this is the checking for errors by the person who is entering the data, they compare
the entered data with the original document.
Example:
INPUT Password
INPUT Password2
WHILE Password <> Password2 DO
OUTPUT “Invalid”
ENDWHILE
Validation
Is the automated checking by a program that data is reasonable before it is accepted into a computer system.

Validation check Description


Range check Checks that only numbers within a specified range are accepted
Length check Checks that data contains an exact number of characters
Type Check Checks that the data entered is of a given data type
Presence check Checks to ensure that some data has been entered and the value has not been left blank
Format check Checks that the characters entered conform to a pre-defined pattern
Check digit Is the final digit included in a code, it is calculated from all the other digits in the code.
When we use it in algorithms, we use it directly after the INPUT statement.

P a g e | 54 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes

Range Check
Example: Input 500 numbers and make sure that numbers are between 0 and 100 inclusive and get the total.

Total  0
FOR Count  1 to 500
INPUT Num
WHILE Num < 0 OR Num > 100 DO
OUTPUT “Invalid Number”
INPUT Num
ENDWHILE
Total  Total + Num
NEXT Count
OUTPUT Total

Length Check
Example: Input a password from the user and make sure the password is 8 characters long

INPUT Password
WHILE LENGTH(Password) <> 8 DO
OUTPUT “Invalid password”
INPUT Password
ENDWHILE

Type Check
Example: Input a number from a user and make sure that it is an integer.

INPUT Num
WHILE Num <> Round (Num,0) DO
OUTPUT “Invalid Number”
INPUT Num
ENDWHILE

Presence Check
Example: Input an email address from the user and make sure that it is entered.

INPUT EmailAddress
WHILE EmailAddress = “” DO
OUTPUT “Required”
INPUT EmailAddress
ENDWHILE

Explain why a program might need to store data in a file?


 Data is not lost when the computer is switched off
 Data can be used by more than one program
 Data can be backed up or archived
 Data can be transported from one place

State the ways the algorithm can be made easier to understand and maintain?
 Use of comments
 Use of procedures and functions
 Use meaningful identifiers
 Use white space and indentation
P a g e | 55 Mr. Karim Wahid
01003335612
Computer Science OL Summarized Notes

Identify three different ways that the design of a solution to a problem can be presented?
 Structure diagram
 Flowchart
 Pseudocode

Flow Charts
Pseudocode is a text-based method of designing programs. It describes a program using a simplified high-level
notation.
Flowcharts are a graphical method of designing programs. It shows the steps representing an algorithm using
various shapes of boxes.

 They allow the designer to see a graphical representation of a problem.


 They are also useful in understanding the logic of complicated problems.

Database
Database: an example of applications software to store and manipulate data.
Table: a set of data about one type of object
Field: an individual piece of data
Record: all of the records in a table about one object.
Data type: the characteristics of a piece of data
Structured query language (SQL): a standard language used to define and manipulate databases.
Script: a set of statements that are executed.
Primary key: is a unique field in a database. This means that it cannot appear twice in different records. It is
used to uniquely identify a record.

SQL Statement Explanation Example


this allows you select a set of SELECT Field Name
SELECT……FROM fields from a table. All of the data FROM Table Name
in each field will be returned.
This has only one condition. The SELECT Field Name
condition needs a logical FROM Table Name
SELECT…..FROM……WHERE
operator WHERE Field Name > 5
>,<.<>,>=,<=,=
P a g e | 56 Mr. Karim Wahid
01003335612
Computer Science OL Summarized Notes
Combining conditions requires a SELECT Field Name
SELECT...FROM…WHERE…. AND
Boolean operator between the FROM Table Name
conditions. WHERE Field Name > 5
SELECT…..FROM…..WHERE…..OR
AND, OR OR Field Name = 7
This command allows you to ORDER BY Field Name
state which order the result will ASC
be displayed in, there are two
ORDER BY
options, ascending (ASC) and ORDER BY Field Name
descending (DESC). DESC

this command will add up the SELECT SUM (Field


SUM field that is written after it. It is Name)
written in the select statement. FROM Table Name
This command will Count how SELECT COUNT (Field
COUNT many records meet the criteria, or Name)
how many fields are in the table. FROM Table Name

Logic gates and Logic Circuit

The basic foundation of a digital circuit that controls the flow of


Logic gate
electronic signals in a predetermined way

Truth Table A way of showing each outcome of a logic gate

An electronic circuit that combines a number of logic gates. The


Logic circuit gates in the logic circuit will control the flow of electricity through
the circuit

P a g e | 57 Mr. Karim Wahid


01003335612
Computer Science OL Summarized Notes
Logic Symbol Logic Truth Table
Gate Statement

NOT

AND

NAND

OR

NOR

XOR

P a g e | 58 Mr. Karim Wahid


01003335612

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy