ComputerScience
ComputerScience
Number Systems
Binary System
A point to be noted is that the most left bit is called the MSB (Most
Significant Bit)
Denary System
0000 0 0
0001 1 1
0010 2 2
0011 3 3
0100 4 4
0101 5 5
0110 6 6
0111 7 7
Binary Hexadecimal Denary
Value Value Value
1000 8 8
1001 9 9
1010 A 10
1011 B 11
1100 C 12
1101 D 13
1110 E 14
1111 F 15
Number Conversions
12 6 3 1
8 4 2 1
8 4 2 6
1 1 1 0 1 1 1 0
As can be seen it starts from 1 and then goes to 128 from left to
right
Now values with 1 are to be added together, giving the final answer,
as for the example, it is 128 + 64 + 32 + 8 + 4 + 2 = 238
Remainde
2 71 0
r:
Remainde
2 35 1
r:
Remainde
2 17 1
r:
Remainde
2 8 1
r:
Remainde
2 4 0
r:
Remainde
2 2 0
r:
Remainde
2 1 0
r:
Remainde
0 1
r:
When you reach 0, the remainder has to be read from bottom to top
giving us the binary value ( as in this case, it is 1 0 0 0 1 1 1 0 )
Separate each value from each other and convert them to denary
e.g.
Hexadecimal : 2 1 F D
Denary :2 1 15 13
Divide the binary value into groups of 4 starting from the right. If at
the end, the last division is less than 4, add 0s until it reaches 4
For each group, find the denary value as shown above, and then
convert each denary value to its corresponding hexadecimal value
(if less than 10, then itself, else, 10 is A, 11 is B, 12 is C, 13 is D, 14
is E and 15 is F).
After conversion, just put all the hexadecimal values in order to get
the final answer
Given Value : 1 0 0 0 0 1 1 1 1 1 1 1 0 1
Convert the value to binary as shown above, and then convert the
final answer to denary
Binary Calculations
Binary values are not added the way denary values are added, as
when adding 1 and 1, we cannot write two because it doesn’t exist
in binary.
Points to Note:
0+0=0
1+0/0+1=1
1 + 1 = 0 (1 carry)
1 + 1 + 1 = 1 (1 carry)
Overflow
When adding two values, if the solution exceeds the limit of given
values, e.g., the solution has 9 bits, but the question had 8 bits per
value, the 9th bit (most left bit) is called overflow.
This indicates that the memory doesn’t have enough space to store
the answer to the addition done in the previous part.
1. Convert both the bytes into 8 bits (add zero to the left-hand
side to match them).
Carry 1 1 1 1 1 1 1
Byte 1 0 1 1 0 1 1 1 0
Byte 2 1 1 0 1 1 1 1 0
OVERFLO
W
Soluti
1 0 1 0 0 1 1 0 0
on
Note: We move from RHS to LHS, and when adding values, we use the
rules given above. If the bit crosses the limit (overflows), we put the value
in brackets, denoting it is overflow.
Logical Shifts
The logical shift means moving a binary value to the left or the right
When doing a logical shift, keep in mind that the bit being emptied
is going to become 0
Firstly, write the binary value and locate the first one from the right;
e.g., 1101100 would have the first one at the third position from the
right.
Now, switch every value to the left of the first one located above
(not switching the one), e.g., the value in our example becomes
0010100, which is the two’s complement of itself.
1 0 1 1 1 0 1 0
-128 + 32 + 16 + 8 + 2 = -70
Examples:
Memory Dumps
Memory Dumps
Using hexadecimal makes writing code easier, faster, and less error-
prone than binary.
Using machine code (binary) takes a long time to key in values and
is prone to errors.
ASCII
The standard ASCII code character set consists of 7-bit code that
represents the letters, numbers and characters found on a standard
keyboard, together with 32 control codes
0 is at 48
A is at 65
a is at 97
Unicode
Sound
The sound waves are sampled at regular time intervals where the
amplitude is measured. However, it cannot be measured precisely,
so approximate values are stored
Sampling Resolution:
Sampling Rate
Images
Bitmap Images
Colour Depth
An 8-bit colour depth means that each pixel can be one of 256
colours (because 2 to the power of 8 = 256)
A 1-bit colour depth means each pixel can store one colour (because
2 to the power of 1 is 2) - ( This is done as the bit can either be 0 or
1, with 0 being white and 1 being black)
Increasing colour depth increases the size of the file when storing an
image.
Image Resolution
Photographs with a lower resolution have less detail than those with
a higher resolution.
8 bits is a byte
4 bits is a nibble
Conventional System
Name of memory No. of Equivalent Denary
size Bytes Value
The size of a mono sound file is calculated as sample rate (in Hz) ×
sample resolution (in bits) × length of sample (in seconds). (For a
stereo sound file, you would then multiply the result by two.)
File Types
o The first byte is the status byte – which informs the MIDI
device what function to perform
MP3
Use lossy format as the original file is lost following the compression
algorithm
MP4
This format allows the storage of multimedia files rather than just
sound
JPEG will reduce the raw bitmap image by a factor between 5 and 15
All the data bits from the original file are reconstructed again when
the file is uncompressed.
Important for files where the loss of data would be disastrous
(spreadsheet)
No data is lost
Run-Length Encoding
One difficulty is that RLE compression isn't perfect for strings like
"cdcdcdcdcd". We use a flag to solve this; e.g., 255 can be made as
the flag. Now 255 will be put before every repeating value, e.g. our
previous example becomes 255 05 97 255 04 98 255 02 99 255 05
100 where 255 now indicates that the next character/set of
characters is approaching
Data Transmission
Data Packets
Packet Structure -
o Header
o Payload
o Trailer
Error-Checking methods
Advantages Disadvantages
Data Transmission
Serial data transmission is when data is sent one bit at a time over a
single wire
Parallel data transmission is when data of several bits (1 byte) are
sent down several wires at the same time.
Serial Parallel
Advantages Disadvantages
Only fit one way, prevents incorrect Maximum cable length is about
connections 5 metres
Backwards compatible
Industry-standard
Type Types -
0 1 0 1 1 0 1 0
Even though the parity checks would reveal the errors, the bit(s)
changed wouldn’t be identified
Parity Blocks
used.
Checksum
Once the data has been sent, The receiver would calculate the
checksum again with the same set of data and the same algorithm
used before.
The receiver would then compare the value received and the newly
calculated value. If they aren’t matched, A request is made to re-
send the data.
Echo Check
Once the data has been sent, The receiver will send the data back
to the sender for verification.
The sender would compare the received and original data for errors.
Check Digits
Check digits are calculated from all the other digits in the data (ex-
codes). The check digit would be the last digit of the code.
The receiver would check the data for any errors; if none are found,
a positive acknowledgement is sent to the sender. However, if errors
are found, a negative acknowledgement will be sent, and the data
will be sent again.
Encryption
Asymmetric Encryption:
o Uses a public key and a private key. The public key is available
to everyone, whereas the private key is only available to the
user.
o The receiver would have the private key, and they would send
the public key to the sender. The sender can encrypt the
message with the public key, and the data can be decrypted
using the private key.
Hardware
Buses: Carry data through components. The following are its types.
Current
Stores the instruction the CPU is
CIR instruction
currently decoding or executing
register
Memory Concept
MEMORY CONTE
LOCATION NT
0101011
10101010
0
Instruction Set:
An instruction set is a list of all the commands that a CPU can process,
and the commands are machine code
System’s Clock
The clock defines the clock cycle that synchronises all computer
operations. By increasing the clock speed, the computer's
processing speed also increases. This doesn’t mean that the
computer's performance is increased, however.
Overclocking
Using a clock speed higher than the computer was designed for.
The wider the data buses, the better the performance of the
computer
Cache
The larger the cache memory size, the better the CPU
performance
Cores
The more cores in the CPU, the better and faster the performance
But if any number of cores are used, it could slow down the system
performance as the communication between each core increases,
and so do the data cables between each. Which in turn reduces the
potential system performance.
You might have heard about quad and dual cores, not septa or octa
cores.
Input Devices
Two-dimensional Scanners:
o A scan head moves across the document until the whole page
is scanned. An image of the document is produced and sent to
a lens using a series of mirrors
Three-dimensional Scanners
3D scanners can scan solid objects and produce a three-dimensional
image
Key parts of the face are compared (distance between eyes, width of
nose)
Barcode readers/scanners
The left and right-hand sides of the barcode are separate using
guard bars
o Light is reflected off the barcode; dark areas reflect little light,
which allows the bars to be read
Digital Cameras
Photo is captured when light passes through the lens onto a light
sensitive cell
Keyboards
Slow method
Prone to errors
Pointing devices
Mouse/trackball
Microphones
The signal goes to a sound card and is converted into digital values
and stored in a computer
Touchscreens
Resistive (inexpensive)
o When the top polyester is touched, the top layer and bottom
layer complete a circuit
Sensors
(Note: You do not need to know the working principle of the sensor.
But have an idea of their purposes.)
o Lamp switched on
Output Devices
Inkjet Printers
The print head moves across paper printing text/image, four ink
colours sprayed in the exact amount
Laser Printers
Use dry powder ink (toner) and static electricity to produce text and
images
3. The drum is then coated with positively charged toner; it only sticks
to negatively charged parts of the drum
5. The toner on the drum now sticks to the paper to produce a copy of
the page
6. Paper finally goes through a fuser (set of heated rollers); heat melts
the ink so it is permanent
7. The discharge lamp removes all electric charge from the drum,
ready to print on the next page
3D Printers
2D and 3D Cutters
Actuators
Loudspeakers/Headphones
LCD monitors are backlit using Light Emitting Diode (LED) because:
CCFL uses two fluorescent tubes behind the LCD screen, which
supplies the light source
Light Projectors:
o LCD Projector
the number of micromirrors and the way they are arranged on the
DLP chip determines the resolution of the image
When the micromirrors tilt towards the light source they are on
When the micromirrors tilt away from the light source, they are off
A bright white light source passes through a colour filter on its way
to the DLP chip
LCD Projectors
When the white light hits the mirrors, the reflected light has
wavelengths corresponding to red, green, and blue
These three different lights pass through three LCD screens; these
screens show the image to be projected as millions of pixels in
grayscale
When the coloured light passes through the LCD screens, a red,
green and blue version of the grey image emerges
Finally, the image passes through the projector lens onto the screen
Source: Cambridge IGCSE and O Level Computer Science - Second Edition
(Hodder Education)
HDD, SSD, DVD, memory stick, and Blu-ray disc are some examples
Primary Memory:
Features of RAM
The larger the size of the RAM, the faster the computer will operate
Source: Cambridge
IGCSE and O Level Computer Science - Second Edition (Hodder Education)
Virtual memory
The virtual memory can be either HDD or SSD (these storages are
discussed below)
Features of ROM
Secondary Storage:
Each platter will have two surfaces which can be used to store the
data
There are no moving parts, and all data is received at the same time
(not like HDD)
o Very thin
Off-Line Storage:
CD/DVD Disks
Laser (red) light is used to read and write data on the surface of the
disk.
Both systems use a single spiral track that runs from the centre of
the disk to the edge
Blu-ray Disks
Cloud Storage:
Advantages Disadvantages
sometimes
o GPS systems
o Security Systems
o Vending Machines
o Washing Machines
o Oven
o Microwave
Network Hardware
These do not change and are primarily constant for every device
The only difference between the two types is that UAA is made Universally
and cannot be changed, but it is the opposite for LAA.
IP Addresses
IP address allocation:
Static IP addresses:
Dynamic IP addresses:
Router functionality:
Types of Software
System Software:
Application Software:
user can execute the software when they require, and it is mostly
not automatic
Examples
System Software:
Application Software:
Interrupts
Source: Cambridge
IGCSE and O Level Computer Science - Second Edition (Hodder Education)
Utility Software
Anti-virus software checks files before they are run or loaded and
compares possible viruses against a database of known viruses.
Heuristic checking is used to identify possible viruses that are not
yet on the database.
Infected files are put into quarantine for automatic deletion or for
the user to decide.
As an HDD becomes full, blocks used for files become scattered all
over the disk surface, making it slower to retrieve data as the HDD
read-write head needs several movements to find the data.
When a file is deleted or extended, new data does not fill the vacant
sectors immediately, causing the files to become more scattered
throughout the disk surfaces.
Backup Software
There could be three file versions for total security: the current
version stored on the internal HDD/SSD, a locally backed-up copy on
a portable SSD, and a remote backup on cloud storage.
Security Software
Security software is a utility software that manages access control,
user accounts, and links to other utilities such as virus and spyware
checkers.
Access control and user accounts use IDs and passwords to secure
user data and prevent unauthorized access.
Screensavers
Device Drivers
Operating Systems
Operating Systems are designed to establish communication
between the user and the computer
-managing files
– handling interrupts
– providing an interface
– managing memory
– managing multitasking
Source: Cambridge
IGCSE and O Level Computer Science - Second Edition (Hodder Education)
Running of Applications
Interrupts
Signal that causes the operating system to stop what it’s doing and
service a task
High-Level Languages
Low-Level Languages
Source: Cambridge
IGCSE and O Level Computer Science - Second Edition (Hodder Education)
Assembly Language
Translators
Compiler
Interpreter
Executes a high-language program a statement at a time
Assembler
One high-level
One high-level One low-level
language program
language statement language statement
statement may require
can be translated is usually translated
several machine code
into several machine into one machine
instructions to be
code instructions. code instruction.
executed.
Assembled
Compiled programs Interpreted programs
programs are used
are run without the cannot be run without
without the
compiler. the interpreter.
assembler.
Compiler Interpreter Assembler
An assembled
A compiled program An interpreter is often
program is usually
is usually distributed used when a program
distributed for
for general use. is being developed.
general use.
o Code Editor
o Translator
o Debugger
o Error Reports
o Auto-Documenter
o Pretty Printing
Automated Systems
industry
transport
agriculture
weather
gaming
lighting
science
Robotics
Characteristics of a robot -
Types of Robots -
Advantages Disadvantages
Artificial Intelligence
Types of AI -
o Ability to Reason
Types of AI
Advantages Disadvantages
AI Machine Learning