CS Theory Notes J23 (1)
CS Theory Notes J23 (1)
SOFTWARE ......................................................................................................... 58
INTERNET …………………………………….………….......................................................... 89
Data Representation
Part I
Ch.1: Data Representation Eng. Omar El Safty
Introduction
Computer definition:
A computer is a device that receives input, does processing on that input and then produces
the output.
IMPORTANT
As humans we use analogue data. However, computers can’t process analogue data, they are
KEY TERMS
Analogue Data – Data that is constantly varying. For example, sound waves.
Digital Data – Discrete data that is made up from only two values 0 and 1.
Examples of data:
• Number
• Text
• Image
• Audio/Sound
• Video
1
Ch.1: Data Representation Eng. Omar El Safty
1. Numbers
1.1 Denary
Definition:
1.2 Binary
Definition:
IMPORTANT
2
Ch.1: Data Representation Eng. Omar El Safty
Solution:
This is done using the table method:
2 1s are placed in the appropriate columns so that if column headings are added, the
result is 25.
1 1 0 0 1
16 + 8 + 1 = 25
Another example:
Convert 125 to binary.
Solution:
Scan the following QR code for a more elaborate answer:
3
Ch.1: Data Representation Eng. Omar El Safty
Solution:
1 Powers of 2 (starting by 20) are placed as column headings
1 0 0 1 1 0
32 + 4 + 2 = 38
4
Ch.1: Data Representation Eng. Omar El Safty
Memory Units
Bit
Definition:
Refers to one binary digit.
Example:
For example the following binary number is composed of 5 bits:
11010
Nibble
Definition:
A group of 4 bits.
Byte
Definition:
A group of 8 bits.
5
1
Data Representation
Part II
Ch.1: Data Representation Eng. Omar El Safty
1.3 Hexadecimal
Definition:
Hexadecimal Denary
A 10
B 11
C 12
D 13
E 14
F 15
6
Ch.1: Data Representation Eng. Omar El Safty
Solution:
Each hexadecimal digit is represented in 4 binary digits.
This means that the number 9A is represented in 8 binary digits.
9 A
9
Table method is then used to convert each hexadecimal digit to its equivalent 4 binary digits:
8 4 2 1 8 4 2 1
1 0 0 1 1 0 1 0
9 A
9
The answer is: 1001 1010
Another example:
Convert F0C to binary.
Solution:
Scan the following QR code for a more elaborate answer:
7
Ch.1: Data Representation Eng. Omar El Safty
Solution:
We recall that one hexadecimal digit is represented in 4 binary digits.
For this problem, we need to group every 4 digits and represent them as one hexadecimal
digit.
0001 0 0 1 1 0 1 1 0
After grouping each 4 binary digits, we know that we have 3 hexadecimal digits.
We use the table method to figure them out:
8 4 2 1 8 4 2 1 8 4 2 1
0 0 0 1 0 0 1 1 0 1 1 0
1 3 6
9
8
Ch.1: Data Representation Eng. Omar El Safty
Hexadecimal
Binary
Denary
Example:
Convert the hexadecimal number FB to denary.
Solution:
1 Convert FB to binary:
8 4 2 1 8 4 2 1
1 1 1 1 1 0 1 1
F B
FB = 1111 1011
1 1 1 1 1 0 1 1
128 + 64 + 32 + 16 + 8 + 2 + 1 = 251
9
Ch.1: Data Representation Eng. Omar El Safty
Denary
Binary
Hexadecimal
Example:
Convert the denary number 150 to hexadecimal.
Solution:
1 Convert 150 to binary:
1 0 0 1 0 1 1 0
128 + 16 + 4 + 2 = 150
8 4 2 1 8 4 2 1
1 0 0 1 0 1 1 0
9 6
9
3 The result is 96 in hexadecimal
10
Ch.1: Data Representation Eng. Omar El Safty
Uses of hexadecimal:
• Error messages
• MAC addresses
• IPv6 addresses
• ASCII // Unicode
• Locations in memory
• Debugging
11
1
Data Representation
Part III
Ch.1: Data Representation Eng. Omar El Safty
2. Text
Text is represented using one of the following character sets:
• ASCII (American Standard Code for Information Exchange)
• Unicode
KEY TERMS
Character set – A list of all characters and symbols that can be represented by a
computer system. Each character/symbol is assigned a unique value.
2.1 ASCII
Definition:
• A character set for all the characters on a standard English keyboard
• Each character is represented using 8 bits (1 byte)
The following is the ASCII table in which each character is represented with a unique value:
12
Ch.1: Data Representation Eng. Omar El Safty
Example:
Represent the word Computer in memory.
Solution:
After checking the ASCII table, the word Computer is represented as follows:
In denary:
67 111 109 112 117 116 101 114
In hexadecimal:
43 6F 6D 70 75 74 65 72
In binary:
01000011 01101111 01101101 01110000 01110101 01110100 01100101 01110010
2.2 Unicode
Definition:
• A character set which can represent all the languages of the world
• Each character is represented using up to 32 bits (4 bytes)
Main advantage of using Unicode character set compared to ASCII character set:
• Unicode allows for a greater range of characters and symbols than ASCII (including
Main disadvantage of using Unicode character set compared to ASCII character set:
• Text stored using Unicode takes up more storage space as Unicode requires more bits
13
Ch.1: Data Representation Eng. Omar El Safty
3. Images
Definition:
An image is a series of pixels, each representing one colour, that are converted to binary and
processed by the computer.
Important note:
The file size and quality of the image depends on the image resolution and the colour depth.
KEY TERMS
IMPORTANT
• The higher the image resolution, the more the details that can be shown in the
image
• The higher the colour depth, the more colours that can be represented in the
image
14
Ch.1: Data Representation Eng. Omar El Safty
15
Ch.1: Data Representation Eng. Omar El Safty
Example:
An image is 2048 x 2048 pixels and uses a colour depth of 16 bits.
Find the size of an image taken by this camera in MiB.
Solution:
16
Colour depth in bytes = = 2 bytes
8
2048 ×2048×2
Size of image in MiB =
1024 ×1024
= 2 × 2 × 2 = 8 MiB
16
Ch.1: Data Representation Eng. Omar El Safty
4. Audio
• An audio file is converted to binary using sampling process to be processed by the
computer
• The quality of an audio file depends on the sampling rate and the sampling resolution
KEY TERMS
Sampling Process – The process of determining the amplitude of the sound wave at set time intervals.
Sampling Rate – The number of samples taken in a second.
Sampling Resolution – The number of bits representing each sample.
IMPORTANT
The accuracy of the recording and the file size increases as the sample rate
and sampling resolution increase.
17
Ch.1: Data Representation Eng. Omar El Safty
Sampling rate (in Hz) x Length of audio file (in seconds) x Sampling resolution (in bits)
Example:
An audio file has a length of 80 seconds and sampling rate of 32 samples/sec. Each sample is
represented in 32 bits. Calculate the size of the file in Kibibyte.
Solution:
Size of audio file in bits = 80 × 32 × 32
80 ×32×32 80 ×1024 80
Size of image in KiB = = =
1024 × 8 1024 × 8 8
= 10 KiB
18
1
Data Representation
Part IV
Ch.1: Data Representation Eng. Omar El Safty
5. Binary Operations
5.1 Register
Definition:
A small fast memory location within the CPU that stores data and instructions during
processing.
Example:
In this example a 4-bit register is used to store the binary value 1000.
▪ Bit 4 is called the most significant bit as it has the highest effect on the value of
the register
▪ Bit 1 is called the least significant bit as it has the least effect on the value of
the register
KEY TERMS
19
Ch.1: Data Representation Eng. Omar El Safty
In logical left shift the bits are moved some places to the left.
Example 1:
The register below is to be shifted one place to the left
This means that 1-bit logical left shift causes the denary number to be multiplied by 2
20
Ch.1: Data Representation Eng. Omar El Safty
Example 2:
The register below is to be shifted two places to the left
This means that 2-bit logical left shift causes the denary number to be multiplied by 4 (22)
IMPORTANT
21
Ch.1: Data Representation Eng. Omar El Safty
In logical left right the bits are moved some places to the right
Example 1:
The register below is to be shifted one place to the right
This means that 1-bit logical left shift causes the denary number to be divided by 2
22
Ch.1: Data Representation Eng. Omar El Safty
Example 2:
The register below is to be shifted two places to the right
This means that 2-bit logical left shift causes the denary number to be divided by 4 (22)
IMPORTANT
23
Ch.1: Data Representation Eng. Omar El Safty
In the previous example Bit 8 (most significant bit) has been lost, this causes the value to
become incorrect.
Example 2:
The register below is to be shifted one place to the right
In the previous example Bit 1 (least significant bit) has been lost, this causes the value to
become incorrect.
24
Ch.1: Data Representation Eng. Omar El Safty
0+0 0 0 0+0+0 0 0
0+1 1 0 0+0+1 1 0
1+0 1 0 0+1+0 1 0
1+1 0 1 0+1+1 0 1
1+0+0 1 0
1+0+1 0 1
1+1+0 0 1
1+1+1 1 1
Example 1:
The addition of two 8-bit binary numbers can be done as follows:
Carry 0 0 0 0 1 1 1 0 0
Number 1 0 0 1 0 0 1 1 1
+
Number 2 0 1 0 0 1 0 1 0
Sum 0 1 1 1 0 0 0 1
25
Ch.1: Data Representation Eng. Omar El Safty
Example 2:
The addition of two 8-bit binary numbers can be done as follows:
Carry 1 1 1 1 1 1 1 0 0
Number 1 0 1 1 0 1 1 1 0
+
Number 2 1 1 0 1 1 1 1 0
Sum 1 0 1 0 0 1 1 0 0
Note:
The addition of 0110 1110 & 1101 1110 resulted in a number that is the value is greater
than 255. A number greater than 255 cannot be stored in an 8-bit register. This is called an
overflow error
• A computer or a device has a predefined limit that it can represent or store, for
example 8 bits
• An overflow error occurs when a value outside this limit should be returned
26
Ch.1: Data Representation Eng. Omar El Safty
Example 1:
Represent the negative number -54 in an 8-bit register
1 To convert a negative number, we first convert it as if it was positive:
128 64 32 16 8 4 2 1
0 0 1 1 0 1 1 0
2 Then we flip all the values (each 1 is converted into 0, and each 0 is converted to 1)
128 64 32 16 8 4 2 1
1 1 0 0 1 0 0 1
3 Then add 1 (in the least significant bit) to the binary number
Carry 0 0 0 0 0 0 1 0
Flipped
1 1 0 0 1 0 0 1
number +
Add 1 0 0 0 0 0 0 0 1
Result 1 1 0 0 1 0 1 0
IMPORTANT
The most significant bit in two’s complement represents the sign of the number.
Negative numbers have a most significant bit of 1, while positive numbers have a most
significant bit of 0.
27
Ch.1: Data Representation Eng. Omar El Safty
Example 2:
Convert the two’s complement 8-bit binary number 00111011 to a denary number.
1 Place the binary number in the two’s complement table
128 64 32 16 8 4 2 1
0 0 1 1 1 0 1 1
Note that this number had a most significant bit of 0, so the number is a positive number.
Example 3:
Convert the two’s complement 8-bit binary number 10101001 to a denary number.
Method 1:
1 Place the binary number in the two’s complement table
-128 64 32 16 8 4 2 1
1 0 1 0 1 0 0 1
-128 + 32 + 8 + 1 = -87
28
Ch.1: Data Representation Eng. Omar El Safty
Method 2:
1 Place the binary number in the two’s complement table
128 64 32 16 8 4 2 1
1 0 1 0 1 0 0 1
This number has a most significant bit of 1, so the number is a negative number converting
negative numbers:
2 Take the two’s complement of the number, by flipping the number and adding 1
Carry 0 0 0 0 0 0 0 0
Flipped
0 1 0 1 0 1 1 0
number +
Add 1 0 0 0 0 0 0 0 1
Result 0 1 0 1 0 1 1 1
128 64 32 16 8 4 2 1
0 1 0 1 0 1 1 1
64 + 16 + 4 + 2 + 1 = 87
29
2
Microphone
ADC is needed to convert the microphone’s analogue signals into digital data that the
computer can then process.
Headphones/Speakers
DAC takes digital data from the computer and converts it into analogue signals, which the
loudspeaker then converts into sound.
KEY TERMS
30
Ch.2: Input & Output Devices Eng. Omar El Safty
1. Keyboard
Definition and purpose:
Input device used to type in data (text, numbers and symbols).
2. Optical Mouse
Definition:
3. Microphone
Definition and purpose:
Input device used to input sound to a computer.
Uses:
KEY TERMS
Voice Recognition – A piece of software used to identify a known user from their voice.
Speech Recognition – A piece of software that recognizes spoken words.
4. Digital Camera
Definition:
31
Ch.2: Input & Output Devices Eng. Omar El Safty
5. Scanners
5.1 Two-dimensional (2D) scanner
Definition and purpose:
Input device used to convert hardcopy images/documents into a digital
format.
KEY TERMS
OCR – Software that scans text from a document to be converted into a text file format.
OMR – Software is used to detect the presence of marks in certain positions on a paper form.
6. Barcode scanner
What is a barcode?
• A barcode is a series of black and white lines of varying thickness
• Used to represent numeric digits or characters
32
Ch.2: Input & Output Devices Eng. Omar El Safty
• If the barcode is damaged or not printed clearly it may not scan properly
• The barcode system is more expensive
IMPORTANT
33
Ch.2: Input & Output Devices Eng. Omar El Safty
The following table shows the differences between QR codes and barcodes:
QR codes Barcodes
Uses:
• Advertising products
Uses:
• Giving automatic access to a website or
• Checkouts in supermarkets
contact telephone number
• Libraries
• Storing boarding passes electronically
at airports and train stations
8. Touchscreen
Definition and purpose:
Input device that allows simple touches to carry out many of the functions of a pointing
device (such as mouse).
34
Ch.2: Input & Output Devices Eng. Omar El Safty
• Cheap to manufacture
• Good resistance to dust and water
• Can be used with bare fingers, stylus and gloved hand
35
Ch.2: Input & Output Devices Eng. Omar El Safty
• Expensive to manufacture
• The screen is sensitive to water and dust
• Sometimes sensitive to light interference
36
2
1. Screens
1.1 Light Emitting Diode (LED) screen
Definition:
37
Ch.3: Input & Output Devices Eng. Omar El Safty
2. Digital Projectors
2.1 LCD projector
Definition:
Projector that uses LCD screens and a special prism to project an image.
• Lasts longer
• Smaller and lighter (as they have fewer internal components)
• Run quieter
• Better suited to dusty/smoky atmospheres
38
Ch.3: Input & Output Devices Eng. Omar El Safty
3. Printers
3.1 Inkjet printer
Definition:
A printer that uses liquid ink and a moving printing head to print out data.
Definition:
A laser printer uses toner and static electricity to print out information.
The following table shows the advantages and disadvantages of the two printers:
39
Ch.3: Input & Output Devices Eng. Omar El Safty
3.4 3D printer
Definition:
• Output device used to produce 3D solid objects
• The solid objects are built up layer by layer using materials
such as powdered metal, paper or plastic
The following table shows applications for the different types of printers:
Laser printer Producing a large number of high-quality flyers and posters for
advertising
▪ Produce prototypes
▪ Produce customized items, for example:
3D Printer - Produce prosthetic limbs to exactly fill the recipient
- Produce customized items for surgical equipment
- Making parts for items no longer in production
40
Ch.3: Input & Output Devices Eng. Omar El Safty
5. Actuators
Definition:
• An actuator is a mechanical output device that produces movement
• They can rotate, close, push and pull an object
Advantages:
• They allow remote operation of many devices (for example, pumps in a nuclear reactor
where remote operation is a big safety factor)
• Relatively inexpensive to purchase/manufacture
Disadvantage:
• Because they are usually analogue devices, computer signals need to converted using
a DAC to enable computer control
41
3
1. Primary Memory
Definition:
Main memory inside the computer that is directly accessible by the CPU.
2. Secondary Storage
Definition:
Non-volatile storage that is not directly accessed by the CPU.
Stores boot up instructions and can hold data Stores files and software
whilst processed
42
Ch.3: Storage Devices & Compression Eng. Omar El Safty
43
Ch.3: Storage Devices & Compression Eng. Omar El Safty
• CD
• DVD
• Blu-ray disc
KEY TERMS
44
Ch.3: Storage Devices & Compression Eng. Omar El Safty
• NAND/NOR chips, that are made of transistors, are used to store data
• Transistors are used as control gates and floating gates
45
Ch.3: Storage Devices & Compression Eng. Omar El Safty
3. Cloud Storage
Definition:
• Data is accessible at any time, from any device, anywhere in the world provided
internet access is available
• More available storage space
• Storage capacity can be increased without adding additional physical devices
• Automatic backups can be made
• Users only pay for the storage they use
• No need to carry any storage device so data will not be lost if the storage device is
lost/stolen
46
Ch.3: Storage Devices & Compression Eng. Omar El Safty
IMPORTANT
Last three disadvantages are issues related to the security of data in the cloud.
4. File Compression
4.1 Lossless compression
Definition:
IMPORTANT
47
Ch.3: Storage Devices & Compression Eng. Omar El Safty
Example:
Consider the following:
000001111222333333444444444
It would be encoded to:
5-0, 4-1, 3-2, 6-3, 9-4
Example:
Consider the following text:
THIS SECTION SHOWS YOU HOW THIS WOULD WORK
Data dictionary:
1= THIS, 2=HOW, 3=OU
48
Ch.3: Storage Devices & Compression Eng. Omar El Safty
IMPORTANT
Lossy compression reduces the file size more than lossless compression.
Lossy compression lowers the quality of image/sound/video files but NOT significantly.
49
4
Automated Systems
Ch.4: Automated Systems Eng. Omar El Safty
1. Sensors
Definition of a sensor:
It’s an input device used to measure physical properties of the surrounding environment.
The following table shows some sensors and examples of their uses:
Sensor Uses
50
Ch.4: Automated Systems Eng. Omar El Safty
51
Ch.4: Automated Systems Eng. Omar El Safty
2. Automated Systems
Definition:
A combination of software and hardware designed and programmed to work automatically
without the need for any human intervention.
52
Ch.4: Automated Systems Eng. Omar El Safty
Steps:
53
Ch.4: Automated Systems Eng. Omar El Safty
2.3 Transport
54
Ch.4: Automated Systems Eng. Omar El Safty
• Accelerometer
- Measures and responds to tilting the gaming device
forward/backward and side to side
• Proximity sensor
- In touch pads that can detect finger position thus increasing user awareness
55
Ch.4: Automated Systems Eng. Omar El Safty
2.6 Lighting
Specific Advantages:
• Longer bulb life (due to dimming or switching off when not in use)
56
Ch.4: Automated Systems Eng. Omar El Safty
2.2 Science
57
5
Software
Ch.5: Software Eng. Omar El Safty
1. Examples of Software
Software programs can be System software or Application software.
Examples:
• Spreadsheets
• Word Processors
• Databases
• Internet browsers
• Games
Examples:
• Operating System
• Utility software
• Compiler / Interpreter / Assembler
58
Ch.5: Software Eng. Omar El Safty
Functions:
• Antivirus
• File management
• Disk repair
• Backup software
• Screensaver
59
Ch.5: Software Eng. Omar El Safty
2. Firmware
Definition:
A piece of software that runs directly on the hardware.
Purpose:
• Provides low level control over hardware
• Loads the operating system into the RAM when the computer is switched on
Examples of firmware:
• Bootloader (Bootstrap)
- Software that is responsible for loading the operating system into the RAM
• BIOS (Basic Input/Output System)
- Carries out a hardware check to find out if all the devices are present and
whether they are functional
IMPORTANT
Application software runs on the operating system
Operating System runs on the firmware
Firmware runs on the hardware
60
Ch.5: Software Eng. Omar El Safty
IMPORTANT
61
Ch.5: Software Eng. Omar El Safty
Features:
• Uses mnemonic codes specific to the computer hardware
• Needs to be translated to machine code before being executed
62
Ch.5: Software Eng. Omar El Safty
4. Instruction Set
Definition:
A list of all machine code commands that can be processed by a CPU.
IMPORTANT
63
Ch.5: Software Eng. Omar El Safty
5. Language translators
Definition:
Programs used to convert programming language code to machine code to be executed by
the computer.
Scan the following QR code to watch a video about the difference between compilers and
interpreters:
64
Ch.5: Software Eng. Omar El Safty
IMPORTANT
For interpreters:
− No executable file is produced
− Interpreted programs can’t be used without the interpreter
For compilers:
− The code will not run at all if there are errors in the code
• Changes to the code will require the code to be recompiled which makes programs
take longer time to develop
• Comments in the code is not visible making it more difficult to debug the code
65
Ch.5: Software Eng. Omar El Safty
66
6
Computer Architecture
Ch.6: Computer Architecture Eng. Omar El Safty
1. Primary Memory
Definition:
Main memory inside the computer that is directly accessible by the CPU.
• Volatile memory
• Can read from and written to
• Used to store:
- Instructions that are currently in use
- Data that is currently in use
- Parts of the operating system that are currently in use
KEY TERMS
Volatile – The contents of the memory are lost when the power to the RAM is turned off
Virtual Memory
Definition:
A memory management system that makes use of secondary storage and software to extend
RAM capacity.
67
Ch.6: Computer Architecture Eng. Omar El Safty
KEY TERMS
Page – Block of data that can be transferred from virtual memory to RAM or vice versa.
• ROM is non-volatile
• Can only be read from but no written to
• Stores the firmware
The following table summarizes the differences between RAM and ROM:
RAM ROM
Can be written to and read from Can only be read from but not written to
RAM tends to have greater capacity ROM tends to have smaller capacity
68
Ch.6: Computer Architecture Eng. Omar El Safty
ROM function:
RAM function:
69
Ch.6: Computer Architecture Eng. Omar El Safty
2.2 RAM
RAM is made up of partitions. Each partition consists of an address and
its contents.
Role:
Used to store:
• Instructions that are currently in use
• Data that is currently in use
• Parts of the operating system that are currently in use
Structure
CPU contains the Arithmetic and Logic Unit (ALU) and the Control Unit.
Control Unit
Roles:
70
Ch.6: Computer Architecture Eng. Omar El Safty
IMPORTANT
2.4 Registers
Definition and Role:
They are small fast memory locations within the CPU that stores data and instructions during
processing.
Accumulator (ACC)
Temporarily stores data that is currently being used in a calculation.
71
Ch.6: Computer Architecture Eng. Omar El Safty
2.6 Buses
Definition and Role:
Pathways to transport data, addresses and control signals between the internal components
of the computer.
The following table shows three types of buses used in the Von Neumann architecture:
72
Ch.6: Computer Architecture Eng. Omar El Safty
3. Fetch-Decode-Execute Cycle
Fetch:
1 PC contains the address of memory location of the next instruction to be fetched
2 This address is copied from the PC to MAR using the address bus
3 The contents (instruction) of the memory location contained in MAR is copied to MDR
4 The instruction in MDR is then copied to CIR using the data bus
5 The value of the PC is incremented by one to point to the next instruction that has to
be fetched
Decode:
6 CPU interprets and decodes the instruction
Execute:
7 The CPU then executes the instruction
− Signals are sent using control bus to different components of the computer
− If there is an arithmetic operation, the result is stored in the accumulator
73
Ch.6: Computer Architecture Eng. Omar El Safty
4. Interrupt
Definition:
• A signal sent from a device or software that informs the CPU that its attention is
required
• Interrupts have different priorities
• Interrupts are handled by the ISR (Interrupt Service Routine)
Roles:
74
Ch.6: Computer Architecture Eng. Omar El Safty
KEY TERMS
75
Ch.6: Computer Architecture Eng. Omar El Safty
6. Embedded Systems
Definition:
An embedded system is a combination of hardware and software which is designed to carry
out a specific set of functions.
Examples:
• Domestic appliances
• Cars
• Security Systems
• Lighting Systems
• Vending Machines
IMPORTANT
Note That
76
7
Part I
Ch.7: Communication & Networks Eng. Omar El Safty
1. Data Transmission
Data transmission between two machines is characterized by:
• Wi-Fi
• Universal Serial Bus (USB)
77
Ch.7: Communication & Networks Eng. Omar El Safty
Parallel transimission
Definition:
It refers to the transmission of multiple bits of data over multiple wires all at the same time.
• RAM
• Integrated circuits (IC)
78
Ch.7: Communication & Networks Eng. Omar El Safty
Half-Duplex
Allows data to flow in both directions but • Telephone call where only one
not at the same time person speaks at a time
79
Ch.7: Communication & Networks Eng. Omar El Safty
2. Network hardware
2.1 Network Interface Card (NIC)
Functions:
• Allows a device to connect to a network
• Contains the MAC Address of the computer generated at the
manufacture stage
2.2 Router
Functions:
• Sends data (packets) to a specific destination on a network
• Can assign IP Addresses
• Can connect a local network to the internet
Structure:
Example: 00 – 1C – B3 – 4F – 25 – FF
80
Ch.7: Communication & Networks Eng. Omar El Safty
IPv4
Structure:
• Made of 32 bits
• Written as four groups of denary numbers separated by dots
Example: 192.108.158.1
IPv6
Structure:
Example: A8FB:7A88:FFF0:0FFF:3D21:2085:66FB:F0FA
81
Ch.7: Communication & Networks Eng. Omar El Safty
4. Data Packets
Definition of a data packet:
IMPORTANT
• Packet header
• Payload
• Trailer
82
Ch.7: Communication & Networks Eng. Omar El Safty
Packet header
Includes:
• IP address of sender
• IP address of receiver
• Packet number (allows reordering of data packets)
Payload
Consists of actual data being sent in the packet (usually about 64 KiB)
Trailer
Consists of:
83
7
Part II
Ch.7: Communication & Networks Eng. Omar El Safty
• Interference
- All types of cable can suffer from electrical interference, which can cause data
to be corrupted/lost
• Data loss (during packet switching)
• Data gain (during packet switching)
• Skewing of data
- Occurs during parallel data transmission and can cause data corruption as bits
arrive out of order
84
Ch.7: Communication & Networks Eng. Omar El Safty
If the parity used is even parity, then the parity bit needs to be 0.
That’s because there are already an even number of 1’s (in our case 4).
In this case, the receiver’s byte has three 1s, which means odd number of 1s.
This clearly means an error has occurred during transmission of data.
IMPORTANT
85
Ch.7: Communication & Networks Eng. Omar El Safty
Parity Block
Description:
• A parity byte is sent along with a block of data
• The number of 1s are checked vertically and horizontally against the agreed parity to
locate the error at the receiving end
86
Ch.7: Communication & Networks Eng. Omar El Safty
5.2 Checksum
Checksum steps:
1 A value, called checksum, is calculated from the block of data using an algorithm
2 The checksum is transmitted with the block of data
3 The receiver re-calculates the checksum from the data block received using the same
algorithm
4 A comparison is made between original checksum received and the checksum
calculated
5 If both checksums are different, then an error is detected and a request is sent for the
data to be re-transmitted
IMPORTANT
87
Ch.7: Communication & Networks Eng. Omar El Safty
ARQ steps:
1 Request is sent with data requiring acknowledgment
2 Check is performed on data by the receiver (for example by parity check, checksum)
3 If no error is detected, the receiving device sends positive acknowledgement back to
the sending device
4 If an error is detected, the receiving device sends a negative acknowledgment to the
sending device and requests re-transmission of data
5 If no acknowledgment is sent back to the sending device within certain time frame,
then data is automatically resent by the sending device
6 Data is repeatedly resent by the sending device till a positive acknowledgment is
received or until a pre-defined number of re-transmissions has taken place
KEY TERMS
7
Acknowledgment – Message sent indicating that data has/has not been received correctly
Timeout – The time allowed to elapse before an acknowledgment is to be received
88
8
Internet
Ch.8: Internet Eng. Omar El Safty
1. Internet vs WWW
Internet
Definition:
2.2 Website
Definition:
A collection of related webpages.
89
Ch.8: Internet Eng. Omar El Safty
2.4 Webserver
Definition:
• Computer that contains webpages
• It has an IP address and a domain (name of the website)
Functions:
• Renders HTML
• Provides an address bar
• Provides navigation tools
• Allows the use of multiple tabs
• Stores bookmarks and favorites
• Records user history
• Stores cookies
• Makes use of hyperlinks that allow navigation between websites and web pages
• Sends URL to DNS
• Manages HTTP and HTTPS protocols
KEY TERM
90
Ch.8: Internet Eng. Omar El Safty
91
Ch.8: Internet Eng. Omar El Safty
Structure:
protocol://webserver name/filename
Example:
92
Ch.8: Internet Eng. Omar El Safty
2.7 Protocol
Definition:
Set of rules agreed by the sender and the receiver when data is transferred between devices.
2.8 Cookies
Definition:
93
Ch.8: Internet Eng. Omar El Safty
Session Cookie
Definition:
Persistent Cookie
Definition:
• A cookie that is stored permanently on the user’s hard drive
• It is only deleted by the user or when the cookie expires
• Stored on user’s secondary storage
The following diagram shows how different types of cookies are stored during the first
visit to a website:
94
Ch.8: Internet Eng. Omar El Safty
The following diagram shows how persistent cookies are used when logging to the
website again:
95
9
Cyber Security
Part I
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
1.1 Malware:
Definition:
Programs installed on a user’s computer with the aim of deleting, corrupting
or manipulating data illegally.
• A hacker could have hacked the network and downloaded the malware onto the
network
• Clicking on an attachment from an email that contains malware
• Using an infected software package that could cause the malware to download onto
the network
• Using an infected portable storage device
Examples of Malware:
96
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
The following QR code links to an explanatory video about different malware examples
1.1.1 Virus
Definition:
KEY TERM
Active host – Functioning software that a virus can affect by attaching itself to the code
to allow the virus to carry out its attack.
97
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
1.1.2 Worm
Definition:
• Program that can replicates itself
• Does not need an active host program on the target computer before
they can run and cause harm
• They can spread throughout a network
• Delete/Corrupt files
• Causes a computer to malfunction or become unresponsive
• Fill the HDD/SSD/RAM with useless data
• Cause software errors
• Slow down the network performance
Anti-virus software
The process of detecting a virus:
Features of an antivirus:
98
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
1.1.3 Ransomware
Definition:
• Malware that can encrypt data on a user’s computer
• A decryption key is sent back to the user once they pay a sum of
money (a ransom)
• Can be sent via a trojan horse or by social engineering
1 A link on an untrusted website can be clicked by the user resulting in the download of
the spyware onto the user’s computer
2 The spyware records all the key presses from the user’s keyboard
3 The recorded key presses are sent back to the originator of the spyware
4 The key presses are analyzed and a common pattern is used to identify the password
99
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
Anti-spyware software
Features of an anti-spyware:
• Detects and removes spyware already installed on a device
• Prevents a user from downloading spyware
• Encryption of keyboard presses
• Blocks access to a user’s webcam and microphone
• Deletes/Corrupts files
• Installs other malware (e.g. spyware or ransomware)
• Gives attackers access to personal information
• Opens communication ports, allowing an intruder to control the infected computer
remotely
IMPORTANT
100
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
1.1.5 Adware
Definition:
Malware that floods the end-user with unwanted advertisement.
IMPORTANT
1.2 Hacking
Definition:
The process of gaining unauthorized access to a computer system.
Note That
101
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
1.3 Phishing
Definition:
• The creator sends out a legitimate looking email..
• ..that contains a link when clicked redirects you to a fake website
• ..designed to obtain sensitive data
1.4 Pharming
Definition:
102
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
• Phishing
• Phone calls
• Scareware
- Often done using a pop-up message that claims that the user’s computer is
infected with a virus; the user is told they need to download the fake anti-virus
immediately (relies on user’s fear)
• Instant Messaging
- Malicious links are embedded into instant messages; for example, an important
software upgrade (relies on user’s curiosity)
• Baiting
- Leaving an infected malware memory stick where it can be found
IMPORTANT
103
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
• Compromise privacy
• Attacker can gain sensitive data
104
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
IMPORTANT
Users can protect their computers from becoming bots by using up-to-
date anti-malware.
105
9
Cyber Security
Part II
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
• Use of locks
• Using CCTV cameras
• Security guards
Example:
• Admin level has access to all parts of the system
• Guest level can read some data but cannot write any data
• To stop websites collecting and using browsing data (thus improved security)
• Prevents sharing location data in map apps
• Allows for safer browsing as it can alert the user when accessing a dangerous website
106
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
• Should contain:
Example: Sy12@#TT90kj=0
2.4.2 Biometrics
Definition:
Authentication method that relies on unique physical characteristics of humans to identify a
user.
Examples of biometrics:
• Fingerprint scans
• Retina scans
• Face recognition
• Voice recognition
107
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
• Text passwords are characters typed by a keyboard while biometric passwords are
physical measurments scanned by a device
• Text based passwords are easier to hack than biometric passwords
• Biometric passwords are unique to that person while passwords can be shared
• Text passwords can be forgotten while biometric passwords can not
• The system requires the user to input log-in details from a specific computer
108
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
2.5 Firewalls
Definition:
It is a device/software that sits between the user's computer and an external network and
filters incoming and outgoing traffic based on a given set of criteria.
Tasks of firewall:
• Checks whether incoming and outgoing traffic meets a given set of criteria
• Blocks traffic that doesn’t meet the criteria
• Warns and prevents unauthorized access to the system
• Can prevent viruses being transmitted to the network
• Blocks access to undesirable websites
• Logs all incoming and outgoing traffic
109
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
110
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
2.7 Encryption
Definition:
The process of scrambling characters of a message so that message becomes meaningless to
unauthorized users.
111
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
Key length:
The longer the key length, the more possible combinations there are to generate numbers,
which makes it harder for a hacker to determine what key has been used.
• Type of encryption that uses different keys to encrypt and decrypt data.
• Uses two keys that are mathematically related:
The following QR code links to an explanatory video of symmetric and asymmetric encryption:
112
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty
2 The web server sends the web browser a copy of its digital certificate
4 If it is authentic, then the web browser sends a message back to the web server to
establish a connection
113
10
Emerging Technologies
Ch.10: Emerging Technologies Eng. Omar El Safty
1. Artificial Intelligence
AI Definition:
A branch of computer science dealing with the simulation of intelligent
behaviours by computers.
Characteristics of AI:
• Collection of data and the rules for using that data
• The ability to reason
- The ability to draw reasoned conclusions based on the given situations
• The ability to learn and adapt
Examples:
• Categorizing emails as spam
▪ Collected Data: Data about past spam and non-spam emails
▪ Model Training: Model is trained to predict whether each email is spam or not
▪ Model Evaluation: Model accuracy is measured
• Detecting fraudulent activity
▪ Collected Data: Data about past fraudulent and non-fraudulent activity
▪ Model Training: Model is trained to predict the fraudulent activity
▪ Model Evaluation: Model accuracy is measured
114
Ch.10: Emerging Technologies Eng. Omar El Safty
• Knowledge base
- Database that stores all the knowledge about an area of expertise obtained
from several expert resources
• Rules base
• Inference engine
- Acts like a search engine examining the knowledge base for information that
matches the queries
- Makes use of the rules base to find the matching results from the knowledge
base
115
Ch.10: Emerging Technologies Eng. Omar El Safty
1 Information needs to be gathered from human experts or from written sources such as
textbooks, research papers or the internet
2 The knowledge base is created and information gathered is used to populate the
knowledge bas
3 A rules base is created
4 The inference engine is set up
5 The user interface is created to allow the user and the expert system to interact
6 The expert system is tested against known scenarios and any changes are made
• Medical diagnosis
• Plant and animal identification
• Oil prospecting
• Car engine fault diagnosis
• Chess games
• Financial planning
• Route scheduling for delivery vehicles
116
Ch.10: Emerging Technologies Eng. Omar El Safty
2. Robotics
Robotics definition:
A branch of computer science that includes the design, construction and
operation of robots.
117
Ch.10: Emerging Technologies Eng. Omar El Safty
• Expensive to purchase/setup
• High maintenance cost
• Can lead to higher unemployment in manual labour tasks
• Robots cannot think for themselves, they cannot do non-standard tasks
• May cause deskilling when they take over
• Robots are vulnerable to security risks like hacking
Characteristics of a robot
• Electrical Components
- Sensors, microprocessors and actuators used by robots
• Programmable
- Robots have a programmable controller that determines the action to be
taken by the robot
Specific Advantage:
118
Ch.10: Emerging Technologies Eng. Omar El Safty
The following QR code links to a video on how robots are used in Industry
Transportation
Roles:
• Autonomous vehicles
• Can turn a steering wheel, apply brakes and change gears
Specific Advantages:
• Better for the environment since vehicles will operate more efficiently
• Can reduce traffic congestion
• Can reduce travel time
• Can self-park so it reduces the time to find a parking spot
Specific Disadvantages:
Drones
Definition:
Drones are unmanned (pilotless) flying devices.
Uses of drones:
119
Ch.10: Emerging Technologies Eng. Omar El Safty
Domestic Applicanes
Roles:
Agriculture
Roles:
• Seed planting
• Harvesting/Picking of crops
Medicine
Role:
Entertainment
Roles:
120
Ch.10: Emerging Technologies Eng. Omar El Safty
3. Digital Currency
Definition:
• Currency that exists purely in digital form (it has no physical form)
• Money exists in form of data stored on a computer
• Can be transferred into physical cash when needed
• Traditional
• Cryptocurrency
• Used within credit card payments, online payments, and bank transfers
• Regulated by central banks and governments
• Transactions are not publicly available (only banks and governments can view
transactions)
• Centralized currency
Cryptocurrency
Definition:
121
Ch.10: Emerging Technologies Eng. Omar El Safty
4. Blockchain
Definition:
• Any changes to the data within block will cause the value of the hash to change..
• ..this means that all blocks after the tampered block will be invalid
• All computers on the network must agree before any block is added to the chain
122