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

CS Theory Notes J23 (1)

The document provides a comprehensive overview of data representation in computing, covering topics such as binary, denary, hexadecimal systems, and character sets like ASCII and Unicode. It explains how different types of data, including text, images, and audio, are represented and processed in a computer, along with the importance of conversion between these formats. Additionally, it discusses memory units and the significance of sampling rates and resolutions in audio and image quality.

Uploaded by

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

CS Theory Notes J23 (1)

The document provides a comprehensive overview of data representation in computing, covering topics such as binary, denary, hexadecimal systems, and character sets like ASCII and Unicode. It explains how different types of data, including text, images, and audio, are represented and processed in a computer, along with the importance of conversion between these formats. Additionally, it discusses memory units and the significance of sampling rates and resolutions in audio and image quality.

Uploaded by

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

TABLE OF CONTENTS

DATA REPRESENTATION PART 1 ................................................................................ 1

DATA REPRESENTATION PART 2 ................................................................................ 6

DATA REPRESENTATION PART 3 ............................................................................... 12

DATA REPRESENTATION PART 4 .............................................................................. 19

INPUT & OUTPUT DEVICES PART 1 .......................................................................... 30

INPUT & OUTPUT DEVICES PART 2 .......................................................................... 37

STORAGE DEVICES & COMPRESSION ..................................................................... 42

AUTOMATED SYSTEMS ......................................................................................... 50

SOFTWARE ......................................................................................................... 58

COMPUTER ARCHITECTURE .................................................................................. 67

COMMUNICATION & NETWORKS PART 1 .................................................................. 77

COMMUNICATION & NETWORKS PART 2 ................................................................. 84

INTERNET …………………………………….………….......................................................... 89

CYBER SECURITY PART 1 ........................................................................................ 96

CYBER SECURITY PART 2 ...................................................................................... 106

EMERGING TECHNOLOGIES .................................................................................. 114


1

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.

Input Processing Output

IMPORTANT

For a computer to process, an input should be supplied first.


Input can be in form of data or instructions.

As humans we use analogue data. However, computers can’t process analogue data, they are

only capable of processing digital data (0s and 1s).

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.

Hardware – Refers to the physical components that make up a computer system.

Software – Refers to programs used to control the hardware.

Examples of data:

• Number
• Text
• Image
• Audio/Sound
• Video

1
Ch.1: Data Representation Eng. Omar El Safty

1. Numbers

1.1 Denary
Definition:

• A base-10 numbering system


• Denary uses values 0 to 9
• Units increase by power of 10

1.2 Binary
Definition:

• A base-2 numbering system


• Binary uses values 0 and 1
• Units increase by power of 2

IMPORTANT

Any form of data needs to be converted to binary to be


understood and processed by the computer.

Why is data stored as binary in computers?


• As computers consist of logic gates
• Logic gates can only process data in two states (0 and 1)

2
Ch.1: Data Representation Eng. Omar El Safty

1.2.1 Conversion from Denary to Binary


Example:
We need to represent the denary number 25 in computer memory.
This means that we need to convert number 25 to binary.

Solution:
This is done using the table method:

1 Powers of 2 (starting by 20) are placed as column headings

512 256 128 64 32 16 8 4 2 1

2 1s are placed in the appropriate columns so that if column headings are added, the
result is 25.

512 256 128 64 32 16 8 4 2 1

1 1 0 0 1

16 + 8 + 1 = 25

This means that denary value 25 is converted to 11001 in binary

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

1.2.2 Conversion from Binary to Denary


Example:
We need to convert the binary number 100110 to denary.

Solution:
1 Powers of 2 (starting by 20) are placed as column headings

512 256 128 64 32 16 8 4 2 1

2 Correctly place a 1 or a 0 for each column

512 256 128 64 32 16 8 4 2 1

1 0 0 1 1 0

3 Add the denary values for columns containing 1s

32 + 4 + 2 = 38

4 This will give a total which is the answer: 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.

The following table shows more memory units:

Name of memory unit Number of bytes Number of bytes

1 Kibibyte (KiB) 210 1024 bytes

1 Mebibyte (MiB) 220 1024 KiB

1 Gibibyte (GiB) 230 1024 MiB

1 Tebibyte (TiB) 240 1024 GiB

1 Pebibyte (PiB) 250 1024 TiB

1 Exbibyte (EiB) 260 1024 PiB

5
1

Data Representation
Part II
Ch.1: Data Representation Eng. Omar El Safty

1.3 Hexadecimal
Definition:

• A base-16 numbering system


• It uses 16 values: (0-9) and (A-F)
• Units increase by power of 16

Hexadecimal Denary

A 10

B 11

C 12

D 13

E 14

F 15

6
Ch.1: Data Representation Eng. Omar El Safty

1.3.1 Conversion from Hexadecimal to Binary


Example:
Convert the hexadecimal number 9A to binary.

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

1.3.2 Conversion from Binary to Hexadecimal


Example:
Convert the binary number 100110110 to hexadecimal.

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

The answer is 136

8
Ch.1: Data Representation Eng. Omar El Safty

1.3.3 Conversion from Hexadecimal to Denary

We convert from hexadecimal to binary first, then from binary to denary.

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

2 Convert the binary number 11111011 to denary:

512 256 128 64 32 16 8 4 2 1

1 1 1 1 1 0 1 1

128 + 64 + 32 + 16 + 8 + 2 + 1 = 251

3 The answer is 251

9
Ch.1: Data Representation Eng. Omar El Safty

1.3.4 Conversion from Denary to Hexadecimal

We convert from denary to binary first, then from binary to hexadecimal.

Denary

Binary

Hexadecimal

Example:
Convert the denary number 150 to hexadecimal.

Solution:
1 Convert 150 to binary:

512 256 128 64 32 16 8 4 2 1

1 0 0 1 0 1 1 0

128 + 16 + 4 + 2 = 150

2 Convert 1001 0110 to hexadecimal

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

Why is hexadecimal preferred to programmers rather than binary?

• Easier for programmers to read and understand


• Easier to debug // Easier to identify errors
• Shorter to represent // Takes up less space on screen
• Fewer errors made in data transcription
• Easier to remember

Uses of hexadecimal:

• HTML colour codes

• 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

different languages and emojis)

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

per character than ASCII

13
Ch.1: Data Representation Eng. Omar El Safty

A sample of Unicode characters are shown in the following table:

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

Pixel – Smallest element used to make up an image


Image Resolution – The number of pixels in an image
Colour Depth – The number of bits representing each colour

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

High-resolution image vs. low-resolution image

Example of different colour depths

15
Ch.1: Data Representation Eng. Omar El Safty

Size of an image file

Image resolution (in pixels) x Colour Depth (in bits)

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

Size of image in bytes = 2048 × 2048 × 2

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

Example of different sampling rates

Size of an audio file

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 Bit 3 Bit 2 Bit 1


1 0 0 0

▪ 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

Most Significant Bit – The left most bit in a binary register/value


Least Significant Bit – The right most bit in a binary register/value

19
Ch.1: Data Representation Eng. Omar El Safty

5.2 Logical Shift


The logical shift is a binary operation that moves bits some places either to the left or to the
right.

5.2.1 Logical Left Shift

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

Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1


Original 0 0 1 0 0 0 1 1

Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1


After
0 1 0 0 0 1 1 0
Shift

Effect of logical left shift:


In the previous example,
▪ The original denary number was 35
▪ The denary value after the shift is 70

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

Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1


Original 0 0 1 0 0 0 1 1

Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1


After
1 0 0 0 1 1 0 0
Shift

Effect of logical left shift:


In the previous example,
▪ The original denary number was 35.
▪ The denary value after the shift is 140

This means that 2-bit logical left shift causes the denary number to be multiplied by 4 (22)

IMPORTANT

The effect of left logical shift is

multiplying the original denary value by 2𝑡ℎ𝑒 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑠ℎ𝑖𝑓𝑡𝑒𝑑 𝑝𝑙𝑎𝑐𝑒𝑠

21
Ch.1: Data Representation Eng. Omar El Safty

5.2.2 Logical Right Shift

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

Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1


Original 0 1 0 1 1 0 0 0

Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1


After
0 0 1 0 1 1 0 0
Shift

Effect of logical left shift:


In the previous example,
▪ The original denary number was 88
▪ The denary value after the shift is 44

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

Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1


Original 0 1 0 1 1 0 0 0

Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1


After
0 0 0 1 0 1 1 0
Shift

Effect of logical left shift:


In the previous example,
▪ The original denary number was 88
▪ The denary value after the shift is 22

This means that 2-bit logical left shift causes the denary number to be divided by 4 (22)

IMPORTANT

The effect of logical right shift is

dividing the original denary value by 2𝑡ℎ𝑒 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑠ℎ𝑖𝑓𝑡𝑒𝑑 𝑝𝑙𝑎𝑐𝑒𝑠

23
Ch.1: Data Representation Eng. Omar El Safty

5.2.3 Issues with Logical Shift


Example:
The register below is to be shifted one place to the left

Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1


Original 1 1 0 0 0 0 1 1

Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1


After
1 0 0 0 0 1 1 0
Shift

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

Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1


Original 0 1 0 1 1 0 0 1

Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1


After
0 0 1 0 1 1 0 0
Shift

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

5.3 Binary Addition


To add two binary digits: To add three binary digits:

Addition Sum Carry Addition Sum Carry

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

0010 0111 + 0100 1010 = 0111 0001

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

Why does overflow occur?

• 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

5.4 Negative Numbers


A computer can represent both positive and negative using two’s complement.

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

The denary number -54 in two’s complement is 11001010

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

2 Add the denary values for columns containing 1s


32 + 16 + 8 + 2 + 1 = 59

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

3 Convert the result from binary to denary normally

128 64 32 16 8 4 2 1

0 1 0 1 0 1 1 1

64 + 16 + 4 + 2 + 1 = 87

4 Place the correct negative sign so the number is -87

29
2

Input & Output Devices


Part I
Ch.2: Input & Output Devices Eng. Omar El Safty

Analogue and Digital data


Why are converters used?

• As humans we use analogue data


• Computers only understand digital data
• Therefore, converters are used to convert from analogue to digital or from digital to
analogue

Analogue to Digital Converter (ADC)

Microphone

ADC is needed to convert the microphone’s analogue signals into digital data that the
computer can then process.

Digital to Analogue Converter (DAC)

Headphones/Speakers

DAC takes digital data from the computer and converts it into analogue signals, which the
loudspeaker then converts into sound.

KEY TERMS

ADC – It is a device that converts analogue data to digital data.


DAC – It is a device that converts digital data to analogue data.

30
Ch.2: Input & Output Devices Eng. Omar El Safty

Definition of an Input Device:


Device used to enter data into a computer system.

1. Keyboard
Definition and purpose:
Input device used to type in data (text, numbers and symbols).

2. Optical Mouse
Definition:

• Input device used to control a pointer/cursor on a screen


• Uses laser and optical sensor to detect the movement

3. Microphone
Definition and purpose:
Input device used to input sound to a computer.

Uses:

• Used to input sound in voice recognition software to enhance security


• Used to input in speech recognition software to convert voice into text

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:

• Input device used to capture digital photographs


• It uses a lens and a sensor to capture light

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.

Software that works with 2D scanners:


• Optical Character Recognition (OCR)
• Optical Mark Recognition (OMR)

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.

5.2 Three-dimensional (3D) scanner


Definition:
Input device used to scan solid objects and produce a 3D digital model.

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

Definition and purpose of barcode scanner:

• Input device used to scan barcodes


• It uses laser and sensors to convert barcode to binary values

32
Ch.2: Input & Output Devices Eng. Omar El Safty

Advantages of using barcodes compared to entering data manually:

• Quicker to input data


• Fewer errors are produced as there is no human input

Disadvantages of using barcode system compared to entering data manually:

• If the barcode is damaged or not printed clearly it may not scan properly
• The barcode system is more expensive

7. Quick Response (QR) scanner


What is QR code?
Matrix of black and white squares that can link to websites, videos, text, etc.

Definition and purpose of QR code scanner:

• Input device used to scan QR codes


• It uses red laser and sensors to convert QR code to binary values

IMPORTANT

QR codes can also be scanned by downloading a QR app and


using the built-in camera on a smartphone/tablet.

Advantages of using QR codes compared to traditional barcodes:


• Can hold more data
• Fewer errors as QR code allows the use of error-checking systems
• QR codes are easier to scan (as can be read using cameras on smartphones)
• QR codes are faster to scan
• It is possible to encrypt QR codes which gives them greater protection

Disadvantage of using QR codes compared to traditional barcodes:


• QR codes can be used to transmit malicious codes
• More than one QR format is available

33
Ch.2: Input & Output Devices Eng. Omar El Safty

The following table shows the differences between QR codes and barcodes:

QR codes Barcodes

QR codes are 2D Barcodes are 1D

QR codes contain squares Barcodes contain vertical lines

Barcodes must be aligned with the


QR codes can be read from any angle
barcode reader to be read

QR codes can hold more data than a barcode

Fewer errors in scanning

QR codes are easier to scan

QR codes are faster to scan

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).

Advantages of using touchscreens compared to using keyboards:


• Does not require peripherals (mouse or keyboard)
• Less chance of input error
• Resistant to weather

34
Ch.2: Input & Output Devices Eng. Omar El Safty

8.1 Capacitive touchscreen


Definition:
Touchscreen that operates by using the conductive properties of the object/finger that is
used to touch the screen.

Advantages of using capacitive touchscreens:


• Better visibility than resistive screens, especially in strong sunlight
• High resistance to scratching (durable surface)
• Allows multi-touch facility

Disadvantages of using capacitive touchscreens:

• Can’t be used while wearing standard gloves


- Only bare fingers, stylus and conductive gloves can be used
• Sensitive to magnetic fields

8.2 Resistive touchscreen


Definition:

• Touchscreen that makes use of two layers


• When the top layer is touched, the top layer and the bottom
layer complete a circuit at the point of touching

Advantages of using resistive touchscreens:

• 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

Disadvantages of using resistive touchscreens:

• Low touch sensitivity


• Doesn’t support multi-touch facility
• Poor visibility in strong sunlight
• Vulnerable to scratches on the screen

8.3 Infrared touchscreen


Definition:

• Touchscreen that uses sensors and infrared beams


• Sensors detect the point of touching through a break in a beam

Advantages of using infrared touchscreens:

• Allows multi-touch facilities


• Has good screen durability
• The operability isn’t affected by a scratched or cracked screen

Disadvantages of using infrared touchscreens:

• Expensive to manufacture
• The screen is sensitive to water and dust
• Sometimes sensitive to light interference

36
2

Input & Output Devices


Part II
Ch.3: Input & Output Devices Eng. Omar El Safty

Definition of an Output Device:


A piece of hardware that produces the processed data to the user.

1. Screens
1.1 Light Emitting Diode (LED) screen
Definition:

• Screen that is made up of tiny LEDs


• LEDs brightness can vary by varying the electric current sent to
each LED

1.2 Liquid Crystal Display (LCD) screen


Definition:
• Screen that is made up of tiny liquid crystals and backlighting
• Backlighting can be either:
− Using LED technology
− Using CCFL (Cold Cathode Fluorescent Lamps) technology

Advantages of LED backlighting over CCFL backlighting:

• LED technology reaches maximum brightness almost immediately


• Give sharper image (greater details can be displayed)
• Monitors using LED technology are much thinner than using CCFL technology
• Less power consumption
• Less heat produced
• More reliable technology as LEDs are long lasting

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.

Advantages of LCD projectors over DLPs:

• Give sharper image (greater details can be displayed)


• Less power consumption
• Less heat produced
• Cheaper to purchase

2.2 Digital Light Projector (DLP)


Definition:
Projector that is composed of millions of micro mirrors on a small DMD chip.

Advantages of DLP projectors over LCD projectors:

• 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.

3.2 Laser printer

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:

Printer Advantages Disadvantages

▪ Higher quality printing of black and white


output
▪ Faster printing speed ▪ More expensive to buy
Laser
▪ Larger paper trays ▪ Produce health hazards such as
printer
▪ Can print on both sides ozone/toner particles in the air
▪ Large toner cartridge ▪ More time to warm-up
▪ Toner is cheaper per page than liquid ink as it
doesn’t run out quickly

▪ Small ink cartridge


▪ Higher quality printing of coloured output ▪ Smaller paper trays
Inkjet
▪ Cheaper to buy ▪ Slower at printing than laser
printer
▪ Less time needed to warm-up ▪ Ink is more expensive per page
than toner as it runs out quickly

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

Advantages of using 3D printers than using traditional manufacturing:


• Faster to produce customized items
• Designs can easily be shared by the digital file
• Cost of manufacturing is less than labor costs and other costs involved in traditional
manufacturing

Disadvantages of using 3D printers:

• 3D printers are expensive to purchase


• Dangerous items may be printed as weapons
• Printed items might not be as durable as a similar manufactured product

The following table shows applications for the different types of printers:

Type of printer Applications

Laser printer Producing a large number of high-quality flyers and posters for
advertising

Inkjet printer Printing photographs

▪ 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

4. Speakers and Headphones


Definition:
Output devices that produce sound.

5. Actuators
Definition:
• An actuator is a mechanical output device that produces movement
• They can rotate, close, push and pull an object

Actuators are used for tasks such as:

• Controlling robot arm


• Spinning a fan
• Pumping water

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

Storage Devices & Compression


Ch.3: Storage Devices & Compression Eng. Omar El Safty

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.

Differences between Primary Memory and Secondary Storage:

Primary Memory Secondary Storage

Directly accessible by CPU Not directly accessible by CPU

Faster access speed Slower access speed

Tends to have greater storage

Stores boot up instructions and can hold data Stores files and software
whilst processed

Has both volatile and non-volatile Non-volatile

42
Ch.3: Storage Devices & Compression Eng. Omar El Safty

Technologies of secondary storage:


• Magnetic
• Optical
• Solid-State

2.1 Magnetic storage

Magnetic storage devices have the following in common:

• Data is stored in form of magnetic dots


• Consists of several platters, where magnetic dots are
stored
• Magnetic dots are stored on the platters in sectors and
tracks
• Data is read, written or erased as the magnetic dots pass
under read/write heads

Examples of magnetic storage devices:

• Hard disk drive (HDD)


• Removable hard disk drive
• Magnetic tape drive

How is data read from magnetic devices?


1 Data, in form of magnetic dots, is stored on surface of multiple
platters in sectors and tracks
2 Platters are spun at a high speed
3 A number of electromagnetic read/write heads move quickly back
and forth to access all tracks and sectors
4 Data is read as dots pass under electromagnetic read/write heads

43
Ch.3: Storage Devices & Compression Eng. Omar El Safty

How is data written on magnetic devices?


1 Data, in form of magnetic dots, is stored on surface of multiple platters in sectors and
tracks
2 Platters are spun at a high speed
3 A number of electromagnetic read/write heads move quickly back and forth to access
all tracks and sectors
4 The electromagnetic read/write heads apply suitable magnetic field to control the
magnetic dots

2.2 Optical storage

Optical storage media have the following in common:


• Data is represented on disks as pits and land
• Optical device shines laser on the disk
• An arm is used to move the optical device across the disk

Examples of optical storage devices:

• CD
• DVD
• Blu-ray disc

KEY TERMS

Pit – An indentation on the surface of an optical disk used to represent data.

Land – The raised surface between two pits.

How to write/record data on an optical storage device?

1 The disk is spun


2 A laser beam is shone onto the surface of disk
3 An arm moves the laser across the surface of the disk
4 The laser burns pits onto the surface of the disk
5 Both pits and lands represent the binary two values 1 and 0

44
Ch.3: Storage Devices & Compression Eng. Omar El Safty

How to read data from an optical storage device?


1 The disk is spun
2 A laser beam is shone onto the surface of disk
3 An arm moves the laser across the surface of the disk
4 The laser is used to read the pits and lands on the surface of the disk
5 The reflected light from the laser shining on the disk is captured by a sensor

2.3 Solid-state storage

Solid-state storage devices have the following in common:

• NAND/NOR chips, that are made of transistors, are used to store data
• Transistors are used as control gates and floating gates

Examples of solid-state storage devices:

• Solid-state drive (SSD)


• SD Card
• USB Flash Memory

How data is stored on solid-state devices:


1 NAND/NOR chips are used that made of transistors
2 Data is stored by flashing it onto the chips
3 The flow of electrons is controlled using transistors
4 Data is stored sequentially as 0s and 1s inside the transistors

How data is read from solid-state devices:


1 NAND/NOR chips are used that made of transistors
2 Data is stored by flashing it onto the chips
3 The flow of electrons is controlled using transistors
4 Data is stored sequentially as 0s and 1s inside the transistors
5 Data is read sequentially by retrieving the binary values of transistors

45
Ch.3: Storage Devices & Compression Eng. Omar El Safty

Advantages of using solid-state technology compared to magnetic technology:

• Faster data access speed


• No moving parts so more durable
• Less power consumption
• They run much cooler
• They occupy less physical space
• They are lighter (making them more suitable for a portable computer)
• They run quieter
• Not affected by magnetic fields

Disadvantages of using solid-state technology compared to magnetic technology:


• More expensive than magnetic devices for the same amount of storage
• Solid-state devices have lower longevity for read/write operations

3. Cloud Storage
Definition:

• Online storage platform


• Data is stored in a remote physical location ..
• .. using hundreds of interlinked data servers

Advantages of using cloud storage compared to storing data locally:

• 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

Disadvantages of using cloud storage compared to storing data locally:

• Users must have an internet connection to access data


• Users must have a reliable internet connection to store data
• Cloud storage has an ongoing cost
• Loss of control over the storage of data (storage is controlled by the cloud provider)
• More security issues as multiple copies of the data are stored
• Easier to hack as data always available

IMPORTANT

Last three disadvantages are issues related to the security of data in the cloud.

4. File Compression
4.1 Lossless compression
Definition:

• Method of compression that loses no data in the process


• Used when it is essential that no data is lost during compression process, for example:
− Code
− Text file
− Database file

IMPORTANT

Lossless compression can be used on any file type.

47
Ch.3: Storage Devices & Compression Eng. Omar El Safty

4.1.1 Run-length encoding (RLE)


Definition:
• The repeated patterns of characters/pixels/samples are identified ..
• .. then encoded into two values:
1 The number of identical characters in the run (run count)
2 The value of pattern (run value)

Example:
Consider the following:
000001111222333333444444444
It would be encoded to:
5-0, 4-1, 3-2, 6-3, 9-4

4.1.2 Data Dictionary


Definition:
• The repeated characters/pixels/samples are identified..
• .. then indexed (put in a table)
• .. and then replaced by their index
• The position of repeated characters/pixels/samples in the file is stored in the table
• The number of times the repeated characters/pixels/samples appear in the file is
stored in the table

Example:
Consider the following text:
THIS SECTION SHOWS YOU HOW THIS WOULD WORK

Data dictionary:
1= THIS, 2=HOW, 3=OU

The data is encoded to:


1 SECTION S2S Y3 2 1 W3LD WORK

48
Ch.3: Storage Devices & Compression Eng. Omar El Safty

4.2 Lossy compression


Definition:
• Method of compression where redundant details are permanently removed from the
file without significantly affecting the quality of the file
• Used when there is no requirement for the files to be the same as original file, for
example:
− Images
− Audio files
− Video files

IMPORTANT

Lossy compression reduces the file size more than lossless compression.
Lossy compression lowers the quality of image/sound/video files but NOT significantly.

Advantages of compressing a file using lossy compression compared to lossless


compression:
• Requires less storage space on the computer
• The file is transmitted quicker over the internet
• Less bandwidth is required to send the file over the internet

How to compress an image file using lossy compression:


• A compression algorithm is used..
• ..where redundant details are permanently removed
• Colour depth can be reduced
• Image resolution can be reduced

How to compress a sound file using lossy compression:


• A compression algorithm is used..
• ..where redundant details are permanently removed
• Sampling rate can be reduced
• Sampling resolution can be reduced
• Unnecessary sounds can be discarded (such as removing sounds human ear can’t hear)

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

• Measures the temperature in a central heating system


Temperature • Measures the temperature of a chemical process

• Measures the temperature in a greenhouse

• Measures the water level in soil in a greenhouse


Moisture
• Measures the moisture levels in a food processing factory

• Measures humidity levels in the air in a greenhouse


Humidity
• Measures humidity levels in a building/factory

• Measures light intensity in automatic street lighting


Light • Measures the brightness of the environment in greenhouse

• Automatically switches on a car's headlights when it gets dark

• Detects intruders in a burglar alarm system


Infra-red/Motion • Counts people entering/leaving a building

• Turns on the windscreen wipers on a car automatically

• Detects intruders in a burglar alarm system


Pressure • Weighs objects (e.g. check the weight of a vehicle)

• Monitors/Controls a process where gas pressure is important

• Picks up noise levels (e.g. footsteps) in a burglar alarm system


Acoustic/Sound
• Detects the noise of liquids dripping in a pipe

• Measures pollution levels in a river or in the air


Gas (e.g. O2 or
• Measures O2 and CO2 levels in a greenhouse
CO2)
• Checks for CO2 leaks in a power station

• Measures oxygen levels in a car exhaust

50
Ch.4: Automated Systems Eng. Omar El Safty

• Used in anti-lock braking systems in motor vehicles


Magnetic field • Any application where detection of changes in a magnetic
field is required (e.g. in cell phones, CD players, etc.)

• Measures the acidity or alkalinity levels in the soil in a


greenhouse
pH
• Pollution monitoring in rivers

• Measures acidity levels in a chemical process

• Used in cars to measure rapid deceleration and apply air


bags in a crash
Accelerometer
• Used in mobile phone to detect change between landscape
and portrait mode

• Detects the presence of a nearby object


Proximity
• Detects when a face is close to a mobile phone screen

• Measures the flow rate of a moving liquid or gas


Flow • Measures gas flow in pipes

• Measures flow in respiratory devices and inhalers in hospitals

• Measures the height of a liquid


Level • Measures the level of a petrol tank in a car

• Detects leaks in air conditioning

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.

An automated system consists of:

• Sensors to take readings


• Microprocessor to process data
• Output devices to display data / Actuators to do mechanical output

General advantages of using automated systems:


• Take more accurate readings than humans
• Higher productivity than humans
• Can work 24/7
• Produce more consistent results than humans
• Work continuously with no breaks so any necessary action is initiated immediately
• Work without human intervention which is safer for humans in hazardous situations
• Less expensive in the long run than employing humans

General disadvantages of using automated systems:

• Faulty sensor can give false results


• Subject to cyber attacks
• Expensive to setup
• Needs more maintenance than traditional systems which is expensive

52
Ch.4: Automated Systems Eng. Omar El Safty

2.1 Domestic applications

Regulating the temperature in an air conditioning system


Steps:
1 Temperature sensor constantly sends data to microprocessor
2 Temperature data is converted to digital using an ADC
3 Microprocessor compares temperature data with stored value/pre-set value
4 If the temperature value is greater than or equal to the stored value, microprocessor
sends signal to an actuator to turn on the cooling unit
5 If the temperature value is less the stored value, microprocessor sends signal to an
actuator to turn off the cooling unit
6 The whole process is a continuous loop until the user switches off the system

Detecting intruders in a burglar alarm system

Steps:

1 Sensors constantly send data to microprocessor:


▪ The infra-red sensor picks up the movement of an intruder in the building
▪ The acoustic sensor picks up sounds such as footsteps or breaking glass
▪ The pressure sensor picks up the weight of an intruder
2 Data from the sensors is converted to digital using an ADC
3 Microprocessor compares data from sensors with stored values
4 If data is inside the acceptable range then no action will be taken
5 If any of the incoming data values are outside the acceptable range, then the
microprocessor sends a signal to:
▪ A siren to sound the alarm
▪ A light to start flashing
6 The alarm continues to sound and lights continue to flash until the system is reset with
a password

53
Ch.4: Automated Systems Eng. Omar El Safty

2.2 Industrial applications

Control of a nuclear power station


Steps:
1 Sensors constantly send data (temperature, pressure, flow, level, etc.) to the
microprocessor
2 Data from the sensors is converted to digital using an ADC
3 Microprocessor compares data from sensors with stored values
4 If values are inside the accepted range, no action will be taken by the microprocessor
5 If any value is outside the accepted range, a signal is sent by the microprocessor..
6 ..to actuators to open/close water pumps, valves, gas pumps, etc.
7 Whole process is continuous

2.3 Transport

Adaptive cruise control


Steps:
1 Proximity sensor on the car constantly send data the
microprocessor
2 Data from the sensors is converted to digital using an ADC
3 Microprocessor calculates the distance to the car in front
4 Microprocessor compares the calculated distance to a stored value (safe distance)
5 If distance between vehicles is less than the safe distance, a signal is sent by the
microprocessor to actuator to:
- Apply brakes
- Reduce throttle
6 If the distance between vehicles is greater than the safe distance, the microprocessor
will send a signal to actuator to:
- Release brakes
- Increase throttle
7 Whole process is continuous

54
Ch.4: Automated Systems Eng. Omar El Safty

2.4 Weather applications

Automated weather stations


Steps:

1 Sensors constantly send weather data to the microprocessor


- The temperature sensor measures temperature
- The light sensor to measure hours of daylight
- The level sensor to measure rain fall
- The pressure sensor to measurer air pressure
2 Data from the sensors is converted to digital using an ADC
3 Microprocessor does any necessary calculations on the received data
4 Microprocessor stores the data from the sensors and the calculated values in a central
database
5 Whole monitoring process is continuous

2.5 Gaming applications

Gaming console controllers


Sensors used:

• 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

Main advantage of automated systems in gaming:


Allow increased human interaction with the game.

55
Ch.4: Automated Systems Eng. Omar El Safty

2.6 Lighting

Controlling automatic street lights


Steps:
1 Light sensor constantly sends data to microprocessor
2 Sensor data is converted to digital using an ADC
3 Microprocessor compares light data with stored value
4 If sensor value is less than the stored value:
▪ Microprocessor sends a signal sent to an actuator to switch on the street lamp
▪ Street lamp remains on for a period of time (30 minutes)
5 If sensor value is greater than or equal to the stored value:
▪ If the street light is on, microprocessor sends a signal to an actuator to switch
off the street lamp
▪ Street lamp remains off for a period of time (30 minutes)
6 The whole process is a continuous loop

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

Monitoring chemical process in a laboratory


Steps:
1 Sensors constantly sends data to microprocessor
- Temperature sensor to measure the temperature
- Pressure sensor to measure the pressure
- pH sensor to measure the pH
- Level sensor to measure the level of the liquids in the experiment
- Flow sensor to measure the flow of the gas and liquid the experiment
2 Sensor data is converted to digital using an ADC
3 Microprocessor compares data from the sensors with stored value/pre-set value
4 If the sensor data is greater than or equal to the stored value, the microprocessor
sends signal to screen to display warning message and to a buzzer to sound an alarm
5 If the sensor data is less than stored value, no action will be taken
6 Whole process is continuous

57
5

Software
Ch.5: Software Eng. Omar El Safty

1. Examples of Software
Software programs can be System software or Application software.

1.1 Application Software


Definition:
Application software provides the services that the user requires

Examples:
• Spreadsheets
• Word Processors
• Databases
• Internet browsers
• Games

1.2 System Software


Definition:
System software provides the services that the computer requires.

Examples:
• Operating System
• Utility software
• Compiler / Interpreter / Assembler

58
Ch.5: Software Eng. Omar El Safty

1.2.1 Operating System


Definition:
A piece of system software that allows the user to communicate with the computer hardware
and performs many basic tasks.

Functions:

• Providing a platform for running applications


• Memory management
• Managing peripherals and drivers
• Manage multitasking
• Handling interrupts
• Provides an interface
• Provides system security
• Manages user accounts
• Managing Files

1.2.2 Utility software


Definition:
A program that performs a specific task required for the operation of a computer system.

Examples of utility programs include:

• 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

3. Types of programming languages


3.1 High-level language
Definition:

• A type of programming language that uses English-like


statements
• A portable language that can be used on different platforms (machine independent)
• One line of high-level language code can perform several low level-language
operations

Example of code written in high-level language:

for (int i = 0; i < 5; i++) {


cout << i << "\n";
}

IMPORTANT

High-language code needs to be translated to machine code to be


executed by the computer.

3.2 Low-level language


Definition:

• A type of programming language that is close to the native language of


the computer
• Code is specific to the type of computer (machine dependent)

For example: assembly language and machine code

61
Ch.5: Software Eng. Omar El Safty

3.2.1 Machine Code


Definition:
The binary instructions that a computer understands and executes directly.

Example of code written in machine code:


10101101
11001110
10110111

3.2.2 Assembly Language


Definition:
A low-level language that uses mnemonic codes to create programs.

Features:
• Uses mnemonic codes specific to the computer hardware
• Needs to be translated to machine code before being executed

Example of mnemonic code written in assembly language:


INP
STA X
INP
ADD X

Advantages of writing a code in high-level language compared to low-level language:

• Closer to human language so:


- Easier and quicker to read, write and understand code
- Easier and quicker to debug
- Less likely to make errors while writing the code
• Code is portable (machine independent) so:
- Can be used on many different platforms
- Only need to learn a single language
• One line of code can carry out multiple commands, so the code is more compact
• It has built-in functions which saves time when writing a program

62
Ch.5: Software Eng. Omar El Safty

Advantages of writing a code in low-level language compared to high-level language:

• Code can be used to directly manipulate hardware


• Code can be executed faster than same code written in high level language
• Code requires less memory than same code written in high level language

4. Instruction Set
Definition:
A list of all machine code commands that can be processed by a CPU.

Purpose and use:


Used to define the commands that can be carried out by the CPU.

IMPORTANT

Instruction set is not a programming language.

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.

Type Description Features and steps

1 The source code is translated all at once


2 An error report is produced at the end of
A program that translates a high-
the attempted translation
level language code to machine
Compiler 3 After correcting all the errors, the source
code
code is re-translated
4 An executable file is then produced that
can run without the compiler

1 The source code is translated line by line


A program that translates a high-
2 The source code is executed line by line
level language code to machine
Interpreter 3 If an error is found, interpreter stops and
code
will continue execution only when error
is fixed

1 Source code is translated all at once


2 An error report is produced at the end of
A program that translates a low-
the attempted translation
level language code to machine
Assembler 3 After correcting the errors, the source
code
code is re-translated
4 An executable file is produced that can
run without the assembler

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

Advantages of compiling a code:

• Code will run without the compiler


• A compiled program is executed faster as statements are not re-translated every time
• Executable file is produced which creates a smaller file size
• Source code cannot be accessed so code cannot be stolen
• Code is portable

Disadvantages of compiling a 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

Advantages of interpreting a code:

• Easier to debug a program as an error is displayed as soon as it is found


• Easier to understand and modify the source code

Disadvantages of interpreting a code:


• Interpreter is needed each time the program is executed
• Interpreted code tends to run slower than compiled code (as it needs to be translated
line by line every time)
• Source code can be accessed, which means that code can be stolen

65
Ch.5: Software Eng. Omar El Safty

6. IDE (Integrated Development Environment)


Definition and role:
A set of programs used to write and test a computer program written in a high-level language

Common functions of IDE:


• Code Editor
• Run-time environment
• Translator (Compiler / Interpreter)
• Error Diagnostics
• Auto-completion
• Auto-correction
• Prettyprint (Syntax highlighting)

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.

1.1 RAM (Random Access Memory)


Definition:

• 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.

How virtual memory is created and used:


• Data on the secondary storage is split into pages
• Pages are copied from the secondary storage to the RAM when needed

67
Ch.6: Computer Architecture Eng. Omar El Safty

Importance of using virtual memory:

• To extend RAM capacity


- So it reduces the need to buy and install more expensive physical RAM memory
• To allow computer to process large amount of data
• Stops programs from crashing when physical RAM is full

KEY TERMS

Page – Block of data that can be transferred from virtual memory to RAM or vice versa.

1.2 ROM (Read Only Memory)


Definition:

• 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 is volatile (temporary) ROM is non-volatile (permanent)

Used to store data, programs or parts of the


Stores the firmware
operating system that are currently in use

RAM tends to have greater capacity ROM tends to have smaller capacity

68
Ch.6: Computer Architecture Eng. Omar El Safty

Application where RAM and ROM are both used


A remote-controlled toy car has a circuitry, which contains both RAM and ROM chips. The
remote control is a hand-held device.

ROM function:

• Stores the factory settings


• Stores the start-up routines when the toy car is first switched on

RAM function:

• Stores the instructions received from the remote-control unit

2. Von Neumann Architecture


The Von Neumann architecture is often referred to as stored program concept.

Stored program concept:


• Programs are stored on a secondary storage device
• Data and instructions are moved to RAM and stored in it.
• Instructions are fetched and executed one after another

69
Ch.6: Computer Architecture Eng. Omar El Safty

The following components related to Von Neumann Architecture:


2.1 Secondary Storage
Role:
Secondary storage stores data and programs that can be used.

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

2.3 Central Processing Unit (CPU)


Definition and role:
A CPU is a type of integrated circuit on a single chip. It processes the instructions.

Structure
CPU contains the Arithmetic and Logic Unit (ALU) and the Control Unit.

Control Unit
Roles:

• Controls the flow of data through CPU


• Controls the interactions between the different parts of the CPU
• Responsible for decoding instructions

70
Ch.6: Computer Architecture Eng. Omar El Safty

Arithmetic and Logic Unit (ALU)


Roles:
• Carries out arithmetic calculations
• Carries out logic operations
• Holds temporary values during calculations in a register called accumulator

IMPORTANT

A central processing unit can also be called microprocessor or processor.

2.4 Registers
Definition and Role:
They are small fast memory locations within the CPU that stores data and instructions during
processing.

Examples of registers and their roles:


Program Counter (PC)
Temporarily stores the address of next instruction to be fetched/executed.

Current Instruction Register (CIR)


Temporarily stores the current instruction during processing.

Accumulator (ACC)
Temporarily stores data that is currently being used in a calculation.

Memory Address Register (MAR)


Temporarily stores address of the instruction to be fetched.

Memory Data Register (MDR)


Temporarily stores the instruction that is in use from address in MAR.

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:

Type of bus Description of bus Signal direction

Transports data between the CPU, memory


Data bus Bidirectional
unit and input/output devices

Transports signals relating to addresses


Address bus Unidirectional
between the CPU and the RAM

Transports signals relating to the control and Can be Unidirectional


Control bus
coordination of activities within the computer or Bidirectional

2.7 Input/Output Devices


Roles:
They are the main method of entering data into and getting the data out of computer
systems.

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:

• Informs the CPU that its attention is required


• Pauses current process until the interrupt is serviced by CPU
• Allows vital tasks to be dealt with immediately based on their priority
• It enables multi-tasking to be carried out on a computer

Examples of hardware interrupts: Examples of Software interrupts:


• A key on a keyboard is pressed • Opening an application
• A mouse button is moved • When switching from one application to
• A device is connected/disconnected another
• A paper has jammed in a printer • Runtime errors (e.g. division by zero)
• A printer runs out of paper • Two processes trying to access the same
• A printer runs out of ink memory location

Interrupt Service Routine (ISR)


Definition:
A piece of software that handles the interrupt.

Steps of handling an interrupt:


1 Interrupt is generated from a device / software, and given a priority
2 Operating system detects an interrupt has been received
3 … so it pauses the current process
4 … and calls the ISR
5 The ISR contains the code that handles the interrupt and executed by the CPU
6 Once the interrupt is fully serviced, the operating system resumes the interrupted
process

74
Ch.6: Computer Architecture Eng. Omar El Safty

5. Factors that determine CPU performance


5.1 Core
Definition:
A unit on a CPU made up of an ALU, control unit and registers.

Effect of increasing the number of cores on CPU performance:


• Allows the CPU to process multiple instructions at the same time..
• .. which will increase the CPU performance

KEY TERMS

Single Core CPU – a CPU with one core only.


Dual Core CPU – a CPU with two cores.
Quad Core CPU – a CPU with four cores.

5.2 System clock


Definition:
A signal that synchronizes all the CPU operations.

Effect of increasing the speed of the clock on CPU performance:


• Increasing the processing speed of the CPU ..
• .. which will increase the CPU performance

5.3 CPU Cache


Definition:
A temporary memory inside the CPU that is used to quickly access frequently used data.

Effect on CPU performance:


• Allows the CPU to fetch frequently used data/instructions faster ..
• .. which will increase the CPU performance

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

An embedded system is not a general-purpose computer, a general-purpose computer is


used to perform many different functions

Note That

An embedded system would typically have low processing power


and small RAM capacity compared to a general-purpose computer.

76
7

Communication & Networks

Part I
Ch.7: Communication & Networks Eng. Omar El Safty

1. Data Transmission
Data transmission between two machines is characterized by:

• The method of data transmission (number of bits sent simultaneously)


• The direction of the data transmission

1.1 Methods of data transmission


Serial transimission
Definition:
It refers to data being transmitted one bit at a time over a single wire.

Advantages of serial transmission over parallel transmission:


• A single wire is used so:
- Less chance of interference
- Cheaper to install
- More reliable over long distances
• Data is sent one bit at a time so:
- Less chance of the data being skewed (data can arrive out of order)

Disadvantages of serial transmission over parallel transmission:

• Slower data transmission rate

Examples of serial transmission:

• 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.

Advantage of parallel transmission over serial transmission:

• Faster data transmission rate

Disadvantages of parallel transmission over serial transmission:

• Multiple wires are used so:


- More chance of interference
- More expensive to install
• Multiple bits are sent simultaneously so:
- More likely for data to be skewed
• Parallel cables are not manufactured above 5m

Examples of parallel transmission:

• RAM
• Integrated circuits (IC)

78
Ch.7: Communication & Networks Eng. Omar El Safty

1.2 Types of data transmission

Type Definition Examples

• Sending data to a device (printer,


speaker, monitor)
Simplex Allows data to flow in one direction only
• Sending data from a device
(sensor, webcam, microphone)

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

Allows data to flow in both directions at • Regular telephone call


Full-Duplex
the same time • Instant messaging

2. USB (Universal Serial Bus)


Definition:

• Data transmission method that uses serial transmission to transfer data


between a computer and several devices
• It allows both half-duplex and full-duplex data transmission

Advantages of using USB:

• Devices are automatically detected and configured when initially attached


• Impossible to connect device incorrectly as plug only fits one way
• Has become the industry standard
• Faster transmission compared to wireless
• Allows power to be drawn to charge portable devices
• Later versions are backwards compatible with earlier USB standards
• Uses serial transmission so:
- Less likely for the data to be skewed compared to parallel connection
- Less interference compared to parallel connection

Disadvantages of using USB:


• Cable length is limited to maximum of 5 meters
• Transmission speed is limited to less than 500 megabits/second

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

3. MAC address and IP address


3.1 MAC (Media Access Control) Address
Definition:

• Unique number that identifies a device connected to the internet


• Allocated by the manufacturer
• Normally does not change

Structure:

• Made of six pairs of hexadecimal digits (48 bits):

− First three pairs identifies the manufacturer’s code

− Second three pairs identifies the device serial number

Example: 00 – 1C – B3 – 4F – 25 – FF

80
Ch.7: Communication & Networks Eng. Omar El Safty

3.2 IP (Internet Protocol) Address


Definition:

• Address that specifies location of a device on the internet


• Allocated by the router/network provider
• Can be static or dynamic
− Static: IP address that doesn’t change each time it is connected to the internet
− Dynamic: IP address that changes each time a device is connected to the internet
• There are two version of IP: IPv4 and IPv6

IPv4
Structure:

• Made of 32 bits
• Written as four groups of denary numbers separated by dots

Example: 192.108.158.1

IPv6
Structure:

• Made of 128 bits


• Written as eight groups of hexadecimal numbers separated by colons (:)

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:

A small part of a message/data that is transmitted over a network.

IMPORTANT

All data packets are reordered to form the original


message/data when it reaches its destination

4.1 Packet Structure:


A typical packet consists of:

• 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:

• Some way of identifying the end of the packet


• An error checking method:
− (Parity check, Checksum, Echo check, etc.)

4.2 Packet Switching:


Steps:
1 Data is broken down into number of packets
2 Each packet could take a different route
3 A router controls the route taken by a packet
− The shortest possible path is selected (certain parts of the route may be too
busy or not suitable)
4 Packets may arrive out of order
5 Once the last packet has arrived, packets are reordered by the receiving computer

83
7

Communication & Networks

Part II
Ch.7: Communication & Networks Eng. Omar El Safty

5. Methods of error detection during data transmission


The need to check for errors:
Errors can occur during data transmission due to:

• 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

5.1 Parity Check


Definition:
• An error checking method that relies on counting the number of 1s in each byte of
data received and comparing it to the agreed parity
• Parity can be even or odd

Parity check steps:


1 A parity bit is added to each byte of data before transmission
2 This parity bit is assigned so that the total number of 1s in the byte must be odd/even
(according to the parity used)
3 When data is received, the number of 1s is counted and checked if it is odd/even
4 If the parity is incorrect, an error is detected

84
Ch.7: Communication & Networks Eng. Omar El Safty

Example using even parity:


Consider the following byte:

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).

Therefore, the byte before transmission should be like this:

Now consider that this byte is transmitted from A to B:

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.

Conditions when parity check won’t detect transmission errors:


• Transposition errors (swapped bits)
• Several bits are changed without affecting the parity

IMPORTANT

Parity checks can only detect that there’s an error, but it is


impossible to know exactly where the error has occurred.

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

Example using even parity:


The following table shows how the data arrived at the receiving end:

How to locate the corrupted bit?


• Byte 8 (row 8) has incorrect parity (there are five 1s)
• Bit 5 (column 5) has incorrect parity (there are three 1s)
• The intersection locates the incorrect bit (the bit should be changed to 0)

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

5.4 Echo Check


Echo Check steps:
1 Copy of the data is sent back to the sender
2 The returned data is compared with the original data by the sender’s computer
3 If there are no differences, then the data was sent without error
4 If the two sets of data are different, then an error occurred

IMPORTANT

This method isn’t reliable.


If an error is detected, it isn’t known whether the error occurred when
sending the data in the first place, or when sending data back for checking

87
Ch.7: Communication & Networks Eng. Omar El Safty

6. Automatic Repeat Request (ARQ)


Definition:

• Uses positive and negative acknowledgments and timeout


• An error control protocol

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:

• Worldwide collection of interconnected networks


• Relies on physical infrastructure that allows networks and devices to connect to other
networks and devices

WWW (World Wide Web)


Definition:

• It consists of massive collection of webpages and websites


• Part of the internet that users can access using web browser

Therefore, WWW is only part of the internet

2. General Internet Terms


2.1 Webpage
Definition:
A web document written in HTML.

2.2 Website
Definition:
A collection of related webpages.

2.3 Hypertext mark-up language


Definition:

• A mark-up language used to create webpages


• Uses tags to format content

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)

2.5 Web browser


Definition:
Software that allows a user to view webpages.

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

DNS – A server that stores URLs and their matching IP addresses.

90
Ch.8: Internet Eng. Omar El Safty

Steps to open a website // Operation of HTTP:


1 URL is typed in the web browser
2 The web browser sends the URL to DNS
3 DNS searches the URL to obtain the IP address of webserver
− If URL not found, DNS returns error
4 IP address is sent back to web browser
5 Web browser sends request to the webserver
6 Webserver sends webpage’s HTML code back to web browser
7 Web browser renders HTML to display webpage

91
Ch.8: Internet Eng. Omar El Safty

2.6 Uniform Resource Locator (URL)


Definition:

• A unique text-based address for a web page


• It can contain the protocol, the domain name and the file name

Structure:
protocol://webserver name/filename

• Protocol: Usually http or https


• Webserver name:
▪ www
▪ domain name (name of the website)
▪ domain type (.com, .org, .co, .net, .gov)
▪ sometimes a country code is given (.uk, .us)
• Filename

Example:

Protocol (Part 1): http://


Domain (Part 2): cie.org.uk
Filename (Part 3): index.htm
Domain name: cie
Domain type: .org
Country code: .uk

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.

Hyper Text Transfer Protocol (HTTP)


Definition:
The main protocol that controls the transmission of data to and from webservers.

Hyper Text Transfer Protocol Secure (HTTPS)


Definition:
• It’s a protocol used to control the transmission of data to and from webservers
• It uses encryption
• It uses SSL

2.8 Cookies
Definition:

• Small text files ..


• ..that are created and sent by webserver
• ..and stored on a user’s computer by web browser
• There are two types: Session cookies and Persistent cookies

Cookies are used to:

• Save personal details


• Track user preferences to customize the experience
• Store login details to speed up login times
• Store payment details
• Store items in an online shopping basket
• Store progress in online games/quizzes

93
Ch.8: Internet Eng. Omar El Safty

Session Cookie
Definition:

• A cookie that is stored temporarily on a computer


• It is deleted when the browser is closed, or the website session ends
• Stored in temporary memory

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:

How persistent cookies can be used to automatically enter banking details/passwords


in a website:
1 Webserver sends a cookie file to user’s browser
2 User’s login/payment details stored in encrypted text file
3 A persistent cookie file is stored by browser on user’s secondary storage
4 When user revisits website, webserver requests cookie file
5 Web browser then sends cookie file back to webserver to automatically enter the
details

95
9

Cyber Security

Part I
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty

1. Cyber Security Threats

1.1 Malware:
Definition:
Programs installed on a user’s computer with the aim of deleting, corrupting
or manipulating data illegally.

How malware can be introduced to a network:

• 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

General protection against malware:


• Use up-to-date antimalware software
• Enable automatic software updates
• Don’t use software from unknown sources
• Do not click on links on unknown websites (or in emails from unknown sources)
• Scan email attachments
• Scan any external device connected to the computer
• Use a firewall

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:

• Program that replicates itself


• Needs an active host program on the target computer before they
can run and cause harm

Possible effects of a virus:


• Delete/Corrupt files
• Causes a computer to malfunction or become unresponsive
• Fill the HDD/SSD/RAM with useless data
• Cause software errors

Specific protection against viruses:

• Use up-to-date antivirus software

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

Possible effects of a worm:

• 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

Specific protection against worm:

• Use up-to-date anti-virus software

Anti-virus software
The process of detecting a virus:

1 The anti-virus software checks files aginst a database of known


viruses before they run or loaded on a computer
2 If a file is infected, two options appear:
- Delete the file
- Quarantine the file
3 If the quarantine option is chosen, the antivirus attempts to cleanse the infected file

Features of an antivirus:

• Checks software/files before they are run or loaded on a computer


• Can constantly run in background
• Prevents a user from downloading virus/worm
• Can run a scheduled scan
• Notifies user of a possible virus/worm
• Can quarantine a virus/worm
• Can delete a virus/worm

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

Possible effects of ransomware:


Encrypts all the data until a ransom is paid.

1.1.4 Key logging software (Spyware)


Definition:
Software that records the key presses on the user’s keyboard. This data is
then sent to the originator of the software.

Possible effect of key logging software:


Gives the originator the access to all data entered using the user’s keyboard including
sensitive data.

Specific protection against key logging software:

• Use of up-to-date anti-spyware


• Use pointing device (or touch screen) instead of typing

How key logging software can be used to obtain user’s password:

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

1.1.5 Trojan Horse


Definition:

• Malware often disguised as a legitimate software


• Replaces all or part of the legitimate software to carry out some harm
• Needs the user to run the trojan horse to cause harm

Possible effects of a trojan horse:

• 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

Because they rely on tricking end-users, firewalls and anti-malware


are often useless since the user can overrule them and initiate the
running of the malware.

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.

Possible effects of adware:

• Can highlight weaknesses in user’s security defenses


• Can redirect the user to promotional websites
• Can create its own default search requests

IMPORTANT

Adware can defeat most anti-malware software since it can be difficult


to determine whether it is harmful or not.

1.2 Hacking
Definition:
The process of gaining unauthorized access to a computer system.

Possible effects of hacking:

• Misuse of personal information


• Data can be deleted/corrupted
• Data can be changed
• Data can be copied from a system

Protection against hacking:


• Use of firewalls/proxy servers
• Use of strong passwords
• Use of biometrics
• Set access levels
• Use of physical security methods (CCTV cameras, guards and locks)
• Two-factor authentication

Note That

Encryption of a file will NOT prevent unauthorized access to this file.

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

Possible effects of phishing:

• The creator of the email can gain sensitive data


• Credit card fraud

Protection against phishing:

• Use of spam filters


• Check the spelling and tone of the email
• Do not click on links in email from unknown sources
• Do not open email attachments from unknown sources
• Never reveal personal details via email

1.4 Pharming
Definition:

• A malicious code is installed on the user’s computer..


• ..that redirects the user to a fake website ..
• ..designed to obtain sensitive data.

Possible effects of pharming:

• The creator of the malicious code can gain sensitive data


• Credit card fraud

Protection against pharming:

• Check the spelling of URL of the website


• Checking that the URL contains https or a locked padlock sign next it
• Use up-to-date anti-malware

102
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty

1.5 Social Engineering


Definition:
• Criminals creating social situations that can lead a victim to giving
away sensitive data
• Manipulation of people into breaking their normal security procedures

Examples of social engineering:

• 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

Possible effects of social engineering:

• May introduce malware to your computer


• The attacker can gain sensitive data
• Credit card fraud

Protection against social engineering:

• Do not click on links in email from unknown sources


• Do not open email attachments from unknown sources
• Never reveal personal details online or to unknown people
• Scan any external device connected to the computer
• Check the spelling and tone of communication
• Set high privacy settings

IMPORTANT

Social engineering is not considered hacking because the user willingly


gives the cybercriminal access to their computer system.

103
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty

1.6 Brute-force attack


Definition:
• An attempt to crack sensitive data (e.g. password)..
• .. by trying all different combinations of characters

Possible effects of brute-force:


• Attacker can gain sensitive data
• Credit card fraud

Protection against brute-force:

• Use a strong password


• Use biometrics
• Use two-factor authentication
• Set number of attempts

1.7 Data Interception


Definition:
A form of stealing data by tapping into a wired or wireless communication.

Possible effects of data interception:

• Compromise privacy
• Attacker can gain sensitive data

Protection against data interception:


• Use SSL/encryption when transferring data over the internet
• Use firewall
• Use complex password on the wireless router
• Don’t use Wi-Fi in public places (such as an airport)
- As there is no data encryption which means that your data is open to
interception by anyone within the airport

104
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty

1.8 Distributed Denial of services (DDoS)


Definition:
• Attempting to prevent users from gaining access to a website
• Multiple computers that are used as bots
• This is done by sending a large number of requests to a server all at the same time
from multiple computers
• The server will be unable to respond to all requests and will fail as a result

Possible effects of DDoS:


Preventing the user from accessing:
• Their emails
• Websites
• Online services (such as online banking)

Protection against DDoS:


• Using a firewall to restrict traffic to and from the server
• Using a proxy server to divert the attack away from the main server

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

2. Protection against security risks


2.1 Physical security methods
Definition:
It’s type of security that prevents physical access to a computer.

Examples of physical security:

• Use of locks
• Using CCTV cameras
• Security guards

2.2 Access levels


Definition:
Method that allows the formation of a hierarchy of privileges depending on user’s level of
security.

Example:
• Admin level has access to all parts of the system
• Guest level can read some data but cannot write any data

2.3 Privacy settings


Definition:
The controls available on web browsers and websites designed to limit who can access a
user’s personal profile.

Importance of setting high privacy settings:

• 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

2.4 Authentication methods


Definition:
Refers to the ability of a user to prove who they are.

2.4.1 Strong passwords


Definition:
A secret string of characters set by a user to identify them to a computer
system.

Rules of a strong password:

• Should contain:

- At least one capital letter


- At least one digit
- At least one special character/symbol
• Should be at least eight characters long

• Not a previously used password

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

Differences between text passwords and biometric passwords:

• 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

2.4.3 Two-factor authentication // Two-step verification


Definition and purpose:

• A form of verification which requires two methods of authentication to verify a user


• It adds an extra level to hack making it harder to access the system

Example 1 of two-factor authentication:


• A code is sent to a device that is pre-set by the user
• The system requires the user to input this code in order to log-in

Example 2 of two-factor authentication:

• 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

Situations when firewalls can’t filter harmful traffic:

• Disabling the firewall


• Incorrect configuration of firewall

How firewall can block access to undesirable websites:


1 Undesirable websites are listed as blocked by a user/company
2 The firewall checks any traffic leaving the network
3 If firewall detects traffic requesting a listed website, it will block access to it
4 Keeps a log of all attempts to access blocked websites

How firewall can block unauthorized access to a network:

1 User sets criteria for the traffic


2 Firewall checks any traffic entering the network
3 If the traffic doesn’t meet the criteria, the traffic is blocked
4 Firewall warns the user of the unauthorized access

109
Ch.8: Cyber Security
Ch.9: Eng. Omar El Safty

2.6 Proxy servers


Definition:
A server that acts as an intermediary between the user and a web server.

Tasks of proxy server to protect a webserver:


• Prevents direct access to the webserver
• Filters Internet traffic and directs invalid traffic away from the webserver
• Can help prevent hacking and DDOS attacks on the webserver
• Can block requests from certain IP addresses
• Can protect the webserver from malware using malware checker

Tasks of proxy server to protect a user computer:

• Keeping the user's IP address secret which improves security


• Can block access to a website

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.

2.7.1 Symmetric encryption


Definition:
Type of encryption that uses the same key to encrypt and decrypt data.

Symmetric encryption steps:

1 An encryption algorithm is used to scramble the data


2 The original data is called plain text
3 The algorithm uses key to encrypt plain text to a cypher text
4 The key is transmitted separately from the cypher text
5 The key is then used to decrypt the cypher text after transmission

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.

Key distribution problem:


The problem with symmetric encryption is that the key could be intercepted when the sender
sends the key to the recipient.

2.7.2 Asymmetric encryption


Definition:

• Type of encryption that uses different keys to encrypt and decrypt data.
• Uses two keys that are mathematically related:

− Public key is made available to everybody


− Private key is only known by the computer user

Steps of asymmetric encryption:


Suppose that computer A wants to send a private message to computer B

1 Computer A requests the public key of computer B


2 Computer A uses computer B’s public key to encrypt the message
3 The encrypted message is sent to computer B
4 Computer B uses its own private key to decrypt the message sent from computer A

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.8 Secure Socket Layer (SSL)


Definition:
A security protocol that uses encryption to allow data to be exchanged securely
between two devices over the Internet.

Steps of a web browser attempting to connect to a website secured by SSL:


1 The web browser requests the web server to identify itself

2 The web server sends the web browser a copy of its digital certificate

3 The web browser authenticates the digital certificate

4 If it is authentic, then the web browser sends a message back to the web server to
establish a connection

5 Any data sent is asymetrically encrypted

How to check that a website is secure:


• Check that URL begins with HTTPS
• Check for locked padlock symbol
• Check that the digital certificate is valid

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

4.1 Machine Learning


Definition:
Subset of AI in which a program has the ability to automatically adapt its own processes
and/or data.

Machine Learning Process:


1 A machine learning algorithm collects data
2 Redundant data is removed
3 A machine learning model is built ..
4 .. and trained on the collected data using real world examples
5 The machine learning model is then evaluated

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

How a machine learning algorithm could help in detecting spam emails:


1 A machine learning algorithm collects data about emails (such as email content,
headers, senders name/email address, etc.)
2 The collected emails are cleaned to remove punctuation and leaving only the relevant
data
3 Certain words/phrases are frequently used in spam (for example, lottery, earn,
full refund) and indicate that the incoming email is very likely to be spam
4 The machine learning model is built..
5 .. and trained on the collected data using past spam emails
6 The model is then evaluated

4.2 Expert System


Definition:
Sub-set of AI that allows a computer program to act as a human expert in a particular field.

Expert system’s components:


• User interface

- Allows users to interact with the expert system

• Knowledge base

- Database that stores all the knowledge about an area of expertise obtained
from several expert resources

• Rules base

- Set of inference rules used by the inference engine to draw conclusions

• 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

How to set up an expert system:

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

Examples of expert systems:

• 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

Medical Diagnosis Expert System Steps


1 The system, through the user interface, asks a series of questions about the patient’s
illness
2 The user answers the questions asked (either as multiple-choice or yes/no questions)
3 The next questions asked are based on the previous response(s) input by the user
4 Inference engine compares symptoms entered with those in the knowledge base
looking for matches
5 The rules base is used in the matching process
6 Once a match is found, the system suggests the probability of the patient’s illness
being identified accurately

Plant/Animal Identification Expert System Steps


1 The system, through the user interface, asks a series of questions about
characteristics of the plant/animal
2 The user answers the questions asked (either as multiple-choice or yes/no questions)
3 The next questions asked are based on the previous response(s) input by the user
4 Inference engine compares characteristics entered with those in the knowledge base
looking for matches
5 The rules base is used in the matching process
6 Once a match is found, the system outputs name of the plant/animal with percentage
of accuracy of the identification

2. Robotics
Robotics definition:
A branch of computer science that includes the design, construction and
operation of robots.

Advantages of using robots in general:

• More accurate than humans


• Higher productivity than humans
• Can work 24/7
• Safer as they can replace humans working in a dangerous environment
• Can produce more consistent results than humans
• Reduces running costs such as wages and overheads

117
Ch.10: Emerging Technologies Eng. Omar El Safty

Disadvantages of using robots in general:

• 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

• Mechanical Structure// Framework


- Robots may have wheels, gears or pistons to allow movement

• Programmable
- Robots have a programmable controller that determines the action to be
taken by the robot

Roles of robots in different fields


Industry (Facrtories)
Roles:

• Paint spraying a car body


• Welding parts together
• Manufacturing electrical goods
• Automatic warehouses

Specific Advantage:

• Can lift larger and heavier equipment than a human

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:

• Sensors could fail to function in heavy harsh conditions


• Any bug or issue would be catastrophic
• Reluctance to use new technology

Drones
Definition:
Drones are unmanned (pilotless) flying devices.

Uses of drones:

• Taking aerial photographs


• Parcel Delivery
• Investigate weather phenomena
• Search and rescue people and animals in natural disasters

119
Ch.10: Emerging Technologies Eng. Omar El Safty

Specific advantages of using drones:

• Safer to use than human life being risked S


• Drones can be used in areas that would be inaccessible to humans
• Drones can cover a greater area than a human in the time available
• They are portable and can be transported from place to place easily

Domestic Applicanes
Roles:

• Autonomous vacuum cleaners


• Autonomous grass cutting

Agriculture
Roles:

• Seed planting
• Harvesting/Picking of crops

Medicine
Role:

• Robotic surgery allows surgeons to perform complex procedures


with more precision and control than the standard techniques.

Entertainment
Roles:

• Entertainment Park robots


• Doing stunts in movies instead of using graphics

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

Types of digital currencies:

• Traditional
• Cryptocurrency

Traditional Digital currency


Definition:

• 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:

• Relies on the blockchain to validate transactions


• Regulated by the community itself (everyone who use the cryptocurrency)
• Transactions are publicly available
• Decentralized currency

The following QR code links to an explanatory video about blockchain

121
Ch.10: Emerging Technologies Eng. Omar El Safty

4. Blockchain
Definition:

• A digital ledger (decentralized database)..


• .. that is a timestamped series of records
• … that cannot be altered

Structure of each block:

How blockchain is used to track digital currency transactions:

1 Whenever a new transaction takes place, a new block is created


2 A new unique hash value is created with a timestamp
3 The new block’s previous hash points to the previous block in the chain
4 All computers on the network must agree before any block is added to the chain

How blockchain prevents tampering with data:

• 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

You might also like