CS Notes 2025
CS Notes 2025
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
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)
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
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
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:
0 1 0 0 0 0 1 1
1 0 1 1 1 1 0 0
1 0 1 1 1 1 0 1
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.
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:
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.
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.
How the size of text files can be reduced using lossless compression?
Lossy compression
The file compression algorithm eliminates unnecessary bits of data as seen in MP3 and jpeg formats; such
as MP3, MP4, JPEG.
How the size of video files can be reduce using lossy compression?
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)
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
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.
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
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.
https://www.cambridge.org/education
Protocol Domain name Web page name
HTML
Hypertext mark-up language (HTML) is an authoring language used to create documents (web pages) to be
viewed on the world wide web.
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.
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
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.
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.
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.
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
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
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.
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.
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
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
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
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.
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.
Operating System:
Software running in the background of a computer system which allows humans to communicate with the
computer hardware in an interactive way.
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
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.
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?
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
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
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
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
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
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
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
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
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.
• 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
Proxy server
proxy servers act as an intermediate between the user and a web server:
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
Once this message is received, the web server acknowledges the web browser, and the SSL-encrypted two-
way data transfer begins
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.
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
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.
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
Artificial intelligence
is the development of programs to simulate human behavior. There is a broad range of areas within 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
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
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:
Programming
Programming Data Types
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.
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
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
A set number of iterations/ A fixed number The loop may never be At least one repeat is
of repetitions executed required
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
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
Highest 0
FOR Count 1 to 50
INPUT Num
IF Num > Highest
THEN
Highest Num
ENDIF
NEXT Count
OUTPUT Highest
Lowest 999999
FOR Count 1 to 50
INPUT Num
IF Num < Lowest
THEN
Lowest Num
ENDIF
NEXT Count
OUTPUT Lowest
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
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
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
Example: Input from a user 10 lines of text and store them in a text file called “file1.txt”.
Example: Open the file “file1.txt” to read and display the first 5 lines on the screen.
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.
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
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
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
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.
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
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.
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.
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
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.
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.
NOT
AND
NAND
OR
NOR
XOR