Tie Computer Science Form Six
Tie Computer Science Form Six
Science
for
Advanced Secondary Schools
Student’s Book
Form Six
Published 2022
ISBN: 978-9987-09-590-2
Mobile numbers: +255 735 041 170 /+255 735 041 168
E-mail: [email protected]
Website: www.tie.go.tz
All rights reserved. No part of this textbook may be reproduced, stored in any
retrieval system, or transmitted in any form or by any means, whether electronic,
mechanical, photocopying, recording, or otherwise, without prior written permission
of the Tanzania Institute of Education.
ii
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Acronyms and Abbreviations............ v Chapter Three
Acknowledgements.......................... vii Data communication and
Preface..............................................viii networking...................................... 113
Concept of data communication...... 113
Chapter One Computer networks.......................... 127
Data structures and algorithms ....... 1 Client-server network architecture .. 141
Concept of data structure..................... 1 Transmission media......................... 168
Primitive data structure........................ 3 Chapter Summary ........................... 193
Non-primitive data structure................ 4 Revision exercise ............................ 198
Static data structure.............................. 6
Pointers.............................................. 11 Chapter Four
Dynamic data structure...................... 23 Visual programming...................... 200
Algorithms......................................... 34 Concept of visual programming....... 200
Recursive algorithms......................... 37 Visual Basic .NET and the .NET
Iterative algorithm.............................. 40 Framework....................................... 201
Searching algorithm .......................... 42 Components of the Visual Studio
2022 IDE.......................................... 209
Sorting algorithm............................... 45
Programming in Visual Basic .
Chapter summary .............................. 55
NET ................................................ 226
Revision exercise .............................. 56
Visual basic control structures......... 236
Visual Basic .NET procedures and
Chapter Two functions........................................... 248
Information systems......................... 59 Linking visual Basic .NET form
Overview of Information Systems..... 59 to data source................................... 252
Types of information systems............ 70 Chapter summary ............................ 263
Database systems............................... 74 Revision exercise ............................ 264
Types of database models.................. 77 Chapter Five
Relational database............................ 79
Entity-relationship model................... 90 Computer security and privacy...... 265
Normalisation..................................... 96 The concept of computer security ... 265
Database management..................... 103 Data protection................................. 268
General database administration...... 110 Attacks............................................. 275
Chapter summary ............................ 111 Authorization and access control
techniques........................................ 290
Revision exercise ............................ 111
iii
Student’s Book Form Six Tanzania Institute of Education (TIE)
iv
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
1NF First Normal Form
2NF Second Normal Form
3D Three (3) Dimension
3NF Third Normal Form
4D Four (4) Dimension
4IR Fourth Industrial Revolution
5D Five (5) Dimension
ACK Acknowledgment
ACL Access Control List
ADSL Asymmetrical Digital Subscriber Line
AI Artificial Intelligence
AR Augmented Reality
ASCII American Standard Code for Information Interchange
CAD Computer-Aided Design
CIDR Classless Inter-Domain Routing
CPS Cyber-Physical Systems
CRC Cyclic Redundancy check
DBMS Database Management System
DHCP Dynamic Host control protocol
DoS Denial of service
DSL Digital Subscriber Line
DSS Decision Support System
EIS Executive Information System
ERD Entity Relational Diagram
FDM Frequency Division Multiplexer
FTP File Transfer Protocol
IoT Internet of Things
v
Student’s Book Form Six Tanzania Institute of Education (TIE)
vi
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The Tanzania Institute of Education (TIE) would like to acknowledge the contributions
of all organisations and individuals who participated in designing and developing
this textbook. In particular, TIE wishes to thank the University of Dar es Salaam
(UDSM), Mzumbe University (MU), The Open University of Tanzania (OUT),
Dar es Salaam Institute of Technology (DIT), The Mwalimu Nyerere Memorial
Academy (MNMA), the National Examinations Council of Tanzania (NECTA),
School Quality Assurance (SQA) Department, Teachers’ Colleges and Secondary
Schools. Besides, the following individuals are acknowledged:
Writers: Mr Chacha M. Nsaho (Mpwapwa Teachers’ College),
Dr Edephonce N. Nfuka (OUT), Dr-Eng. Morice D. Tegeje (MU),
Dr Fabian G. Mahundu (MNMA), Mr Justine J. Nnko (DIT),
Mr Leonard T. Mkama (Kilakala S.S), & Mr Robert Chassama
(Morogoro Teachers’ College).
Editors: Dr Jabhera Matogoro and Dr Ally S. Nyamawe, (UDOM),
Dr Theophil B. Assey, (IAA), Ms Zawadi L. Tito, (Iyunga Technical
Secondary School), Mr Mussa M. Gunda (Korogwe TC),
Dr Michael A. Mashauri (UDSM-Language) & Dr Rafiki Y. Sebonde
(UDOM-Language).
Designer: Ms Eva G. Kwai
Illustrators: Chacha M. Nsaho & Alama Art and Media Production Co. Ltd
Coordinator: Chacha M. Nsaho (Mpwapwa Teachers’ College)
TIE also appreciates secondary school teachers and students who participated in
the trial phase of the manuscript of this book. Likewise, TIE would like to thank
the Ministry of Education, Science and Technology for facilitating the writing and
printing of this textbook.
Dr Aneth A. Komba
Director General
Tanzania Institute of Education
vii
Student’s Book Form Six Tanzania Institute of Education (TIE)
This textbook, Computer Science for Advanced Secondary Schools Student’s Book
Form Six, is explicitly written for form six students in the United Republic of
Tanzania.
It is written following the 2010 Computer Science Syllabus for Advanced Secondary
Education, Form V-VI issued by the then Ministry of Education and Vocational
Training. The book consists of seven chapters: Data structure and algorithms,
Information systems, Data communications and networking, Visual programming,
Computer security and privacy, Information technology career and environments,
and Emerging technologies. In addition to textual descriptions, each chapter contains
illustrations, activities, and exercises. You are encouraged to do all activities and
exercises in this book and other assignments provided by your teacher. This will
enable you to develop the intended competencies.
viii
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Introduction
In form five, you learnt about problem-solving, the concepts of algorithms and
pseudocode, and programming. You demonstrated how to program in C++
language, which is essential in understanding data structures and algorithms.
Such data structures and algorithms are essential in developing efficient software
programs. In this topic, you will learn how data may be structured and instructions
sequenced in algorithms, programs and the relationship between appropriate data
and control structures. Studying data structures and algorithms helps to understand
the basic concepts involved in organising and storing data and the relationship
among the data sets. It helps to determine how information is stored, retrieved, and
modified in a computer’s memory. The competencies developed from data structures
and algorithms will help you to write efficient programs intended to retrieve and
store massive data of various types.
1
Student’s Book Form Six Tanzania Institute of Education (TIE)
2
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
homogeneous (heterogeneous) based on
the similarity of structures.
Classification of data structure In this book, as depicted in Figure 1.1, the
The data structure can broadly be data structure is broadly classified based
categorised into two distinct types: on the nature of the operation that can
A primitive data structure and a non- be conducted on the unit of respective
primitive data structure. In other books, data. The primitive data structure can
data structures have been classified store only values of the same data type,
based on various aspects, for instance,
while non-primitive data structures can
linear data structure and non-linear
store values with more than one data
data structure based on the arrangement
or organisation of the structure; static type. Figure 1.1 shows the classification
data structure and dynamic data of primitive and non-primitive data
structure based on the memory size of structures with examples.
Data Structure
Primitive Non-Primitive
Data Structure Data Structure
3
Student’s Book Form Six Tanzania Institute of Education (TIE)
structures as tools. They are directly used in the program for any specific task. The
user does not define them. Examples of primitive data structures are integers, floats,
doubles, characters, Boolean, pointers, and strings. Primitive data structure stores
only one type of data or may contain empty values. Figure 1.2. illustrates the sub-
category of primitive data structures.
Primitive Data
Character Boolean
Number
4
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
It should have a specific function. at compile time. Accessing individual
The non-primitive data structure is data elements within a static structure
further classified into two categories, is speedy as their memory location is
namely; linear and non-linear data fixed. A static data structure stores a set
structures based on the arrangement and of amounts of data, usually user-defined.
organisation of data. An example of a static data structure is
an array.
Linear data structure
The linear data structure stores data in a
sequence, one after another and the data Dynamic data structure
is accessed from one place and continues In a dynamic data structure, the size
to others sequentially. The linear data of the structure is not fixed and can be
structure is the data structure in which its modified when operations are executed
elements are linked with the subsequent on it. Dynamic data structures aim to
one sequentially. A data structure is linear facilitate the change of data structures in
if its features are combined to form any the run time. Examples of dynamic data
specific order. There are two techniques structures are stacks, Linked lists, and
for representing linear structure queues.
within a memory. The first technique
is to represent the linear relationships
Non-linear data structure
among all the elements described using
linear memory location. These linear In a non-linear data structure the
structures are termed as arrays. The element may link to more than one
second technique represents the linear element, although their data items are
relationship among all the elements not sequential. This structure mainly
using pointers or links. This technique represents data with a hierarchical
of representing linear structures is relationship among various components.
termed linked lists. Furthermore, the An example of a non-linear data structure
linear data structure is classified into two is a tree.
types based on how data can be stored:
static and dynamic data structures. The Exercise 1.1
arrays, stack, linked list, and queue are
examples of linear data structures. Answer the following questions:
1. What is the data structure?
Static data structure 2. Explain the importance of data
The static data structure is a method of structure.
storing data where the amount of data 3. Explain any three features of data
stored and the memory used to hold structures.
it are fixed. In a static data structure, 4. Briefly describe the classification
the content of the data structure can of data structure.
be modified without changing the
5
Student’s Book Form Six Tanzania Institute of Education (TIE)
6
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
than statically. of the array. Static arrays are the
Types of static data structure fundamental array type in most older
procedural languages, such as Fortran,
As seen earlier, the static data structure Basic, and C, and many newer object-
is a method of storing data where the oriented languages as well, such as Java.
amount of data stored and the memory
used to hold it are fixed. An example of The following are essential terms to
a static data structure is an array. understand the concept of an array:
(a)
Element – refers to every item
Arrays stored in an array.
The term array is generally used in (b) Index − used to identify the location
computer programming to mean a of the element.
contiguous chunk of memory locations
where each memory location holds one Classification of arrays in algorithm
fixed-length data item. By this meaning, and data structure
an array is a physical data structure. Arrays must be classified before being
However, the array can also mean a used in a process. They are classified
logical data type composed of a typically into two dimensions as follows:
homogeneous collection of data items,
each identified by an index number. One-dimensional array: This
(a)
array has one row of elements
An array is a list or table of data with and is stored in ascending storage
a variable name identifying such a list location in its table.
or table. Each item in the table is called
an element. An array can have many Multidimensional arrays: This
(b)
dimensions. However, most arrays are kind of array includes as many
either one-dimensional, in which they indices as required because they
form a list or can be two-dimensional, are not bound to two indices or
visualised as a table. The array is a two dimensions. Examples of
container that can hold a fixed number multidimensional arrays are:
of items. These items should be of the (i) Two-dimensional (2-D) arrays
same data type. For example, integers or matrix arrays
only or float only or string only. Most of
the data structures make use of arrays to (ii) Three-dimensional (3-D)
implement their algorithms. arrays
In some programming languages, the One-dimensional array structure
size of an array must be established once One-dimensional arrays can be declared
and for all during the program designing in various ways in different languages.
time and cannot change during the For example, from the C++ array
execution. Such arrays are called static declaration, the structure of a one-
arrays. The chunk of memory that is dimensional array is as follows:
big enough and sufficient to hold all the
values in the array is allocated when the
7
Student’s Book Form Six Tanzania Institute of Education (TIE)
int array [8] = {32, 43, 12, 21, 56, 26, 89, 77 };
Type Size
As per the previous example, the following are important points to be considered:
(a) The index starts with 0.
(b) The array length is 10, which means it can store maximum 10 elements.
(c) Each element can be accessed via its index. For example, you can fetch an
element at index 6 as 36.
When you declare an array in a program, assign initial values to each of its elements
by enclosing the values in braces {}.
int Num[10] = {2, 9, 12, 78, 34, 23, 1, 29, 50, 13}, this declaration will create the
following array:
Num 2 9 12 78 34 23 1 29 50 13
Example 1: Add all elements of an array using C++ language.
#include <iostream>
using namespace std;
int schools [3] = {5, 9, 10};
int n, result=0;
int main ()
{
for ( n=0 ; n<3 ; n++ )
{
result += schools[n];
}
cout<< result;
return 0;
}
8
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Figure 1.3: Out of the program to add element of the array
Two-dimensional array (2-D array) Entering data in two-dimensional
Two-dimensional (2-D) arrays are arrays:
indexed by two subscripts, one for the A nested loop is used to enter data in 2-D
row and one for the column. The Syntax arrays. It depends upon the programmer
of the two-dimensional array is as which loop they want to use, which
follows: can be a While loop or a For loop. The
outer loop acts as the number of rows of
(Data type) (Name of Array)
a matrix and the inner loop acts as the
[Number of rows] [number of columns]; number of columns of a matrix.
For example: Example of a C++ program to enter and
display a two-dimensional array is as
int matrix [7] [7]; follows:
When you type this statement, the #include <iostream>
compiler will generate a 2-D array of a using namespace std;
matrix which consists of 7 rows and 7 int main () {
columns. int test [3][3];
// For taking integer
Accessing location of two-dimensional inputs in a matrix //
array elements for (int i=0 ; i<3 ; i++)
To store values in a C++ two-dimensional {
for (int j=0 ; j<3 ; j++)
array, the programmer has to specify the {
number of rows and columns of a matrix. cout<<”Enter Integer :”;
To access each matrix location to store cin>>test [i][j];
the values, the user must also provide }
}
the exact number of rows and columns. cout<<endl;
For example: // use of nested for
int matrix [3][3]; loop
// access rows of the
test[0][0] = 45 array
for (int i = 0; i < 3;
test[0][1] = 12 ++i) {
test[0][2] = 67 // access columns
of the array
test[1][0] = 78 for (int j = 0; j
test[1][1] = 34 < 3; ++j) {
cout << “test[“ << i <<
test[1][2] = 78 “][“ << j << “] = “ <<
test[2][0] = 89 test[i][j] << endl;
}
test[2][1] = 23 }
return 0;
test[2][2] = 67 }
9
Student’s Book Form Six Tanzania Institute of Education (TIE)
10
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The pointer can be declared as follows:
its originals
Datatype*variable_name;
(d) Expanding the size of the cluster is
a period taking cycle. It is not easy (a) The datatype is the base type of
to grow the size of the exhibit at the pointer, which has to be a valid
run time. C++ data type in the case of C++.
(b) The variable_name should be the
name of the pointer variable.
Pointers
(c) An asterisk (*) used above in the
Meaning of pointer pointer declaration is the same
A pointer is a variable whose value is the as the asterisk used to perform
address of another variable, that is, the multiplication operations. It marks
direct address of the memory location. the variable as a pointer.
It is a user-defined data type that creates The C++ uses the ‘&’ (reference)
variables for holding the memory operator to return a variable’s address.
address of other variables. It is denoted For example, if x is a variable, &x
by the “*” operator. It represents storage returns the address of the variable. The
space in memory (RAM) partitioned following example shows the application
into a small portion called cells which of a pointer in a C++ program.
are used to store values. Each cell has
a unique address and occupies one byte Example 1: How to apply pointer in C++
in memory, whose address is always
unassigned integers. If one variable #include<iostream>
using namespace std;
carries the address of another variable, int main ()
the first variable is said to be the pointer {
of another. Thus, a pointer is a variable int y = 12;
whose value is also an address where int *b; //
each variable has two attributes: address declaration of pointer
and value, as shown in Figure 1.5. variable
b = &y; // the
address of y variable is
address value assigned to a pointer b
pointer variable cout<<”Value at b =
“<<b<<endl; // display
Figure 1.5: The pointer and its variable address stored in pointer
b
cout<<”Value at variable
The syntax of a pointer is as follows: y = “<<y<<endl; //
display value stored in
type *ptr_name; variable y
Where type is any data cout<<”Value at *b =
type of the pointer, and; “<< *b;// display value
ptr_name is the pointer’s stored in address of
name. pointer b
}
11
Student’s Book Form Six Tanzania Institute of Education (TIE)
Note: The data type of the pointer and variable should be the same.
Advantages of pointers
The following are the advantages of pointers:
(a) It can return multiple values from a function
(b) It reduces the code and improves performance
(c) It retrieves strings and trees
(d) Used with arrays, structures, and functions
(e) It allows you to access any memory location in the computer’s memory
(f) It can allocate and de-allocates memory dynamically
Disadvantages of pointers
The following are the disadvantages of pointers:
(a) If it is wrongly referenced, it will affect the entire program.
(b) It may lead to a memory leak if the dynamically allocated memory is not freed.
(c) An uninitialised pointer leads to a segmentation fault.
Application of pointers
A pointer is used in various ways as follows:
1. It is used to access array elements.
An array of components can be accessed using pointers, as shown in example 2.
12
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Figure 1.7: Output of a program to access array elements using pointers
The output for the program in example 3 is “Elements are:10 20 30” is shown in
Figure 1.8:
Figure 1.8: Output of a program for dynamic memory allocation using pointers
13
Student’s Book Form Six Tanzania Institute of Education (TIE)
4.The pointer can be used to implement data structures like linked lists and trees as
described in the next sections.
Pointer operations
In C++, the pointer operators are of two kinds:
(a) Reference operator (&): The reference operator (&) returns the variable’s
address, and
(b) Deference operator (*): The dereference operator (*) helps us to get the value
that has been stored in a memory address.
14
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(i) The reference operator (&) will return 0x236.
(ii) The dereference operator (*) will return 27.
15
Student’s Book Form Six Tanzania Institute of Education (TIE)
int * y;
This is a valid operation: related items. A record will contain a
fixed number of items. For example, a
y = arr;
record for a book may include the title,
After the declaration, y and arr will author, publisher, number of pages, and
be equivalent and share properties.
However, a different address can be whether it is literature or fiction.
assigned to y, but you cannot assign Records store a collection of related data
anything to arr. items, where all items have different
For example, you can traverse an array data types. For example, you might set
using pointers. Example of a C++ up a record called book, which stores
program to traverse the array given as the book’s title, author name, and ISBN.
arr[] = { 11, 45, 63, 26, 5, 24}. Title and author are text, whereas the
#include <iostream> PublicationDate is set as a Date data
using namespace std; type. You can write it as follows:
int main() {
int *y; Book = Record
int arr[] = { 11, 45, Title, Author As Text * 50
63, 26, 5, 24 };
y = arr; ISBN As Text * 13
for (int x = 0; x < 6; PublicationDate As Date.
x++) {
cout << *y << endl; When the program runs, every time data
y++; is entered for the book, the user will type
} in up to 50 characters of text for the title,
return 0; author, and up to 13 of text for ISBN. A
} variable may now be set up using this
record data type, containing all of this
The output of the program as shown in
data.
Figure 1.11
Generally, a record is a data structure that
consists of a fixed number of variables
called fields. Every field has an identifier
(field name) and a data type. Each field
in a record can have a different data type.
This is very common in Spreadsheets
and MS Access, and other databases.
Some languages provide a built-in
Figure 1.11: Output of a program to structure type that can be used to define
traverse array a record.
For example, assume that you want to
Records organise the individual student records
Records are composite data types formed such as registration number, name, sex,
by several related items of different data date of birth, average score, and grade
types. This enables a programmer to refer into a single data structure.
16
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Student’s_name: string
Student’s sex: string
Student’s_ average_score: real
Student’s_grade: char
Structure of records
Student’s records can be tabulated as shown in Table 1.1
Table 1.1: Student’s records
sn Student’s _regNo Student’s _name sex Average_score Grade Field
1. 7880 Maro Sambayeti M 67 C
2. 7565 Hadija Mkude F 78 B
Records
3. 8665 Makala Ikande M 87 A
4. 7881 Bupe Mwakibete F 91 A
Application of records
The following are the application of records:
(a) It is used to store data or information in a database such as Microsoft Access.
(b) It is used to group similar data.
Record operations
The record operations include creating, accessing, and updating the field in the
record.
Creating a student’s record
The keyword ‘record’ is used to create records specified with the record name and
fields. Its syntax is as follows:
record (recodname, {field1, field2, field3, field4 … … . fieldn})
The syntax to insert values into the record using C++ is as follows:
#recordname {fieldName1 = value1, fieldName2 = value2, fieldName3 = value3 .
. . . fieldNamex = valuex}
17
Student’s Book Form Six Tanzania Institute of Education (TIE)
string student_name;
int student_id;
};
int main(){
student S;
S.student_name =”Maro Sambayeti”;
S.student_id =7880;
return 0;
}
Note: Starting the number with zero (0) will make it octal; therefore, the program
will display an error.
18
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Answer the following questions: datatypes or user-defined data types. In
1. Describe the static data structure. a programming language, user-defined
data types are defined by the users in the
2. Identify any four (4) advantages and program to suit their needs to store data
disadvantages of static data structure. either of the same or different types as per
3. With examples, describe the types their requirements.
of arrays. User defined data types are also known
4. Explain how to declare variables in as Composite data types. They are called
an array. Give two examples. composite because they are derived from
5. What are the advantages and more than one built-in data type used
disadvantages of arrays? Describe to store complex data. These complex
any three for each. format data might contain tabular
data, graphical data, and databases.
6. Explain the applications of arrays. For this purpose, we use complex data
7. Describe the array operations. types called user-defined data types.
8. Give the meaning of the pointer. For every programming language,
9. Show how to declare a pointer in there are different types of user-defined
C++ data types. In C++, these user-defined
data types are class, Union, structure,
10. Point out the four advantages of a enumulation, and typedef.
pointer
(a) Class: This is a user-defined
11. Explain the application of pointers. data type that holds data members and
12. What is the meaning of records? functions whose access can be specified
13. Suppose Juma wants to write a as private, public, or protected. It uses
C++ program that uses 12 blocks the ‘class’ keyword for defining the data
of elements in memory, using the structure.
static data structure. He is then (b) Structure: A structured data type
expected to store the other six groups data items of different types into
more later. What would be the a single type. For example, a structure
consequences of the program? can be an address, which contains
information such as block number, plot
number, building name, street, city,
country and pin code. The keyword
User-defined data types “struct” is used to define this.
The user-defined data types allow a (c) Union: The Union is a type of data
programmer to develop his/her data structure where all the members of that
types and define what values program Union share the same memory location.
can take, for example, class, structure, If any changes are made in the Union,
union, and enumeration. These data they will also be visible to others. The
types hold more complexity than pre- ‘union’ keyword is used to define this
defined data types, but they can assist a user-defined data type.
programmer in reducing errors.
19
Student’s Book Form Six Tanzania Institute of Education (TIE)
20
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The Union is a user-defined data type In C++, an enumeration (or enum)
in which all members share the same is primarily used to give integral
memory place. For example, in the constant names, making the program
following C++ program, y and z share easier to comprehend and maintain.
the same location. If we change z, you In enumeration, if you do not provide
can see the changes reflected in y. the integral values explicitly to the
strings, then, in that case, the strings
#include <iostream> automatically start assigning the integral
using namespace std; values starting from value 0, the same as
// Declaration of union is the case of 0-based indexing.
the same as the structures
Points to remember for C++ Enum
union test {
int y, z; (a) enum improves type safety
}; (b) enum can be easily used in switch
int main() (c) enum can be traversed
{
// A union variable t
enum
(d) can have fields, constructors
union test t;
and methods
// t.z also gets value 4 enum
(e) may implement many
t.z = 4; interfaces but cannot extend any
cout << “After making z = 4:” class because it internally extends
<< endl the Enum class
<< “y = “ << t.y
Example:
<< “, z = “ << t.z
<< endl; enum result {pass = 60, fail = 16};
// t.y is also updated to 20 Here, we have given the integer value 60
t.z = 20; to be pass and 16 as fail; therefore, if we
cout << “After making Z = 20:” write,
<< endl enum result res;
<< “y = “ << t.y
<< “,Z = “ << t.z
res = pass;
<< endl; Then, the value of res would
return 0; automatically be 60.
}
Typedef
The program’s output is as shown in The keyword typedef in C++ allows you
Figure 1.14: to define new data type names explicitly.
The use of typedef does not create a
new data class but establishes a name
for an existing type. This can improve
Figure 1.14: The output of a program a program’s portability (the ability of
to demonstrate union in C++ a program to be used across different
21
Student’s Book Form Six Tanzania Institute of Education (TIE)
changes to the code) because only the many definitions, saving coding
typedef statements would need to be time.
changed. By allowing descriptive names (c)
Flexibility: They allow us to create a
for standard data types, typedef can also data structure per our requirements
help with self-documenting code. and needs.
(d)
Encapsulation: In Java/Python, the
Syntax: variables and data values stored
in user-defined data types are
Typedef type name;
hidden from other classes as per
An example C++ program to demonstrate their accessibility declaration, i.e.
typedef user-defined datatype public, private, and protected. The
#include <iostream> data values remain hidden and safe.
using namespace std;
// After this line, BYTE
can be used ctivity 1.1: Differentiating
A
// in place of unsigned char types of data structures
typedef unsigned char BYTE; 1.
In pairs or groups of three,
int main() identify at least three uses for a 1
dimension array and three uses for
{
a 2-dimensional array.
BYTE c1, c2;
c1 = ″d″; 2.
Compare array structures with
record structures, and decide if
cout << ″ ″ << c1;
any of your uses would be better
return 0; structured as records.
} 3. Show the stack, and the value of
the top pointer and base pointer
Output: when an item popped (taken out)
off the stack and 54 followed by 70
d
pushed onto the stack.
Benefits of user-defined data types
(a)
User-defined data types store data
elements of either the same or
different types. This gives more
flexibility for the programmer to
store different data types in a single
variable as per their needs and
requirements.
22
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
need to check data structure size.
1. What do you understand about the
user-defined types? Disadvantages of dynamic data structure
2. Describe the five types of (a) Because the memory allocation
user-defined data types. is dynamic, it is likely for the
3. Describe the structured type. structure to ‘overflow’ should it
exceed its allowed limit. It can
also ‘underflow’ should it become
Project: empty.
Develop a simple C++ program (b) It is complicated to program as the
that includes the struct, union, and
software needs to keep track of its
enum concepts. The program should
size and data item locations.
address any problem in your school or
community. (c) It can be very inefficient because
the memory for the data structure
is defined regardless of whether it
Dynamic data structure is needed or not when the program
Meaning of dynamic data structure is executing.
The dynamic data structure is the type Types of dynamic data structure
of data structure in which the size of Dynamic data structures are linked lists,
the structure is not fixed and can be arrays, and queues. Each of these types is
modified when the performance of discussed in the following subsections.
the operations is carried on them. The
dynamic data structures are designed to Linked lists
facilitate the change of data structures in
the run time. The size can be randomly The linked list is a dynamic data
updated during the run time, which structure, among others, that can grow
may be considered efficient concerning and shrink during the execution of a
the memory complexity of the code. program. The associated pointer would
Examples of dynamic data structures are give the memory location of the next
linked lists, stacks and queues. data item in the linked list.
Advantages of dynamic data structure Meaning of linked lists
The following are the advantages of A linked list is a sequence of data
dynamic data structure: structures connected via links. A linked
(a) It makes the most efficient use of list is a sequence of links that contain
memory since the data structure items. Each link has a connection to
only uses as much memory as it another link. The linked list is the
needs. second most-used data structure after
the array. The linked list can be defined
(b) The memory allocation is not fixed,
as a collection of objects called nodes
so there will be no problem adding
randomly stored in the memory. A node
and removing data items.
23
Student’s Book Form Six Tanzania Institute of Education (TIE)
24
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The following are the disadvantages of
a linked list: (e) The circular linked list is used in
(a)
Memory usage: The node in a a slide show where a user wants
linked list occupies more memory to go back to the first slide after
than the array as each node occupies displaying the last one.
two types of variables, i.e., one is (f)
A linked list is used for the
a simple variable, and another is polynomial implementation of
a pointer variable that occupies 4 mathematical operations.
bytes in the memory. (g)
A doubly linked list is used to
(b) Traversal: In a linked list, traversal implement forward and backward
is not easy. If you want to access the buttons in a browser to move
element in a linked list, you cannot backwards and forward in the
access the element randomly, but opened pages of a website.
in the case of an array, you can (h) It is used when a user selects the
randomly access the element by desired application by pressing
index. For example, if you want the Alt+tab key combination
to access the 3rd node, you must to navigate through the opened
traverse all the nodes before it. application.
So, the time required to access a
particular node is extensive. Types of linked list
(c)
Reverse traversing: Backtracking Linked lists can be divided into three types:
or reverse traversing is difficult in (a) A Singly-linked list is a linked list
a linked list. It is easier but requires traversed in one direction from
more memory to store the back head to tail.
pointer.
(b) The Doubly linked list is a type
Application of linked lists of linked list traversed in both
The following are some applications of directions, front and back.
linked lists: (c) A Circular linked list is a list in
(a)
Implement dynamic memory which the last node points to the
management functions of the first node.
operating system. Linked lists operations
(b)
A circular linked list is used to The primitive operations performed on
implement operating system or the linked list are as follows:
application functions requiring
(a) Creation
round-robin tasks execution.
(b) Insertion
(c) The linked list is used in a circular (c) Deletion
queue to maintain multiple players’
(d) Traversing
playing sequences in a game.
(e) Searching
(f) Concatenation
25
Student’s Book Form Six Tanzania Institute of Education (TIE)
Insertion operation: Is used to insert a new node at any specified location in the
linked list. A new node may be inserted;
(a) At the beginning of the linked list
(b) At the end of the linked list
(c) At any specified position in between in a linked list. For example, Figure 1.16
shows the insertion operation of inserting a new node at the beginning of an
existing linked list where,
(i) Show an existing linked list of the region in both Tanzania mainland and
Zanzibar island.
(ii) Shows the insertion of a new region called Tabora, and
(iii)
Shows a resulting new liked list after insertion operation.
North
Dodoma Arusha
Pemba
(a)
North
Tabora Dodoma Arusha
Pemba
(b)
North
Tabora Dodoma Arusha
Pemba
(c)
Figure 1.16: Insertion operation
The deletion operation: This is used to delete an item (a node) from the linked list.
A node may be deleted from the;
(a) Beginning of a linked list
(b) End of a linked list and
(c) Specified location of the linked list. (See Figure 1.17).
North
Tabora Dodoma Arusha
Pemba
(a)
North
Tabora Dodoma Arusha
Pemba
(b)
North
Dodoma Arusha
Pemba
(c)
Figure 1. 17: Deletion operation
26
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
forward traversing, nodes only. In a doubly-linked list, forward and backward
traversing is also possible.
Concatenation: This is the process of appending the second list to the end of the
first list.
For example, consider a list A having x nodes and B with y nodes; then the operation
concatenation will place the 1st node of B in the (x+1)th node in A. After concatenation,
A will contain (x+y) nodes. (Figure 1.18)
Stacks
Meaning of stacks
A stack is an Abstract Data Type (ADT) and is a linear data structure that can be
accessed only at one of its ends for storing and retrieving data. It is analogous to a
stack of trays in a cafeteria whereby, new trays are put on the top of the stack and
taken out the top. The last tray placed on the stack is the first tray removed from
the stack and based on this principle, a stack is called a Last-in-first-out (LIFO)
structure. Here, the element placed (inserted or added) last is accessed first. In stack
terminology, the insertion operation is called the PUSH operation and the removal
operation is called the POP operation.
A tray can only be taken if there is at least one tray on the stack, and a tray can
be added to the stack only if there is enough room when the stack is not too high.
Therefore, a stack contains operations that change its status and operations that
check this status. The operations are as follows;
clear()—Clear the stack.
IsEmpty()- determines whether the stack is empty. It returns 1 (true) if the stack is
empty otherwise, it returns 0 (false).
push()—Put the element on the top of the stack.
27
Student’s Book Form Six Tanzania Institute of Education (TIE)
28
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The mechanism for POP operation in a
stack is conducted as follows: (iv) What types of data structure does
(a) Before erasing the component from the activity represent?
the stack, you check whether the Draw the diagram to demonstrate the
stack is vacant. activity of adding and removing the
(b) If you attempt to erase the bottle caps to and from the rods in the
component from the empty stack, abacus.
the sub-current condition happens. Can you give one example in your daily
(c) If the stack is not unfilled, you first life which exhibits the same principle in
access the component, which is this activity?
pointed at the top.
(d) Once the pop activity is played out,
the top is decremented by 1, i.e., Think about the following:
top=top-1.
The vehicles on weigh bridge or at
the narrow one-way bridge; then the
Activity 1.2: Demonstration phone calling and answering system.
of the stack
Afterwards, think about the basis on
Resources: which these incidents are being attended.
Is it on a last -in first-served or first-in-
Abacus, bottle caps, two pieces of spokes,
a piece of wood first-served basis? Lastly, think about
what will happen to other vehicles if one
Procedure: vehicle in the service fails.
Take an Abacus or make it using wood
and a piece of the spoke. Fix the pieces
of spokes into a piece of wood to create Queues
an Abacus Meaning of queue
Label the first rod “A” and the second The queue is an abstract data structure,
rod “B.” Take five bottle caps and put somewhat similar to stacks. Unlike
them into the first rod of an Abacus. stacks, a queue is open at both ends.
Take the other three bottle caps and the The queue follows the First-In-First-Out
first rod one after another. Take out three methodology, i.e., the data item stored
bottle caps from rod A to B in the abacus first will be accessed first.
Observe and write on the following: Queues are what you usually refer to as
(i) Tell from which point the bottle lines. Its essential features are, that it is
caps were added. ordered and that access is restricted to its
(ii) Do you think you can remove the ends: things can enter a queue only at the
second cap from rod A without rear and leave the queue only at the front.
removing others on its top? Give The queue holds a sequence of elements
reasons. that allows insertions (enqueuer) only at
29
Student’s Book Form Six Tanzania Institute of Education (TIE)
Structure of queues
Queues operations
The queues are a homogeneous collection of elements in which new elements are
added at one end, called the rear, and the existing elements are deleted from the other
end, called the front. The basic operations that can be performed on a queue are:
(a) Insert (or add) an element to the queue (enqueue)
30
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Enqueue operation will insert (or add) an element to the queue at the rear end by
incrementing the array index. The dequeue operation will delete (or remove) from
the front end by decrementing the array index and will allocate the deleted value to
a variable. When implemented using arrays, the total number of elements present in
the queue is front - rear+1. Figure 1.22 illustrates the basic operations of the queue.
Enqueue
(insertion)
Dequeue
(Deletion)
Front Rear
31
Student’s Book Form Six Tanzania Institute of Education (TIE)
10
20 30
40 50 70
60
80 90
Figure 1.23: Binary tree
Postorder D, E, B, F, G, C, A
32
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Algorithm for Preorder traversal:
the number of internal nodes, and h is
the height of the binary tree, then the (i) Visit the root.
following are the essential properties of (ii) Traverse the left subtree, i.e., call
binary trees: Preorder (left-subtree)
x=i+1 (iii) Traverse the right subtree, i.e., call
n = 2*x – 1 Preorder (right-subtree)
h>=log2x Uses of Preorder
h>=log2(n+1)-1 (i) Preorder traversal is used to create
a copy of the tree.
Inorder operation in a binary tree (ii) Preorder traversal is also used to get
prefix expressions on an expression
(i) Traverse the left subtree, i.e., call tree.
Inorder (left subtree)
Example: The Preorder traversal for the
(ii) Visit the root given Figure 1.26 is 11 23 41 15 13.
(iii) Traverse the right subtree, i.e., call
Inorder (right-subtree)
11
Uses of Inorder
For example, in binary search trees
23 13
(BST), Inorder traversal gives nodes in
non-decreasing order. To get nodes of
BST in non-increasing order, a variation
of Inorder traversal can be reversed. 41 15
For example, Inorder traversal for Figure
1.25 given tree is 14, 26, 58, 10,30. Figure 1.26: Preorder traversal
Example 1: Study the input in Figure 1.27.
10 Then, write its corresponding output by
using pre-order traversal.
30 21
26
23
14 58
62
41
33
Student’s Book Form Six Tanzania Institute of Education (TIE)
Algorithms
14 35 Concept of algorithm
One of the significant steps to solving
Figure 1.29: Preorder traversal any problem is to analyse the problem.
34
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
requirement. Problem requirements (b) The fastness or the slowness of the
include users, input data, output data designed system is measured.
and general system functionality. For
(c) We can solve the whole problem at
example, when one wants to develop
a time or divide it into manageable
a school management system, the
parts.
requirements might be the number
of students, teachers, and the school Characteristics of an algorithm
administrator who will be responsible The algorithm to solve the required
for updating data. After analysing a problem must be correctly and well-
problem, the next step is to design an defined. Thus must obey the following
algorithm. characteristics:
An algorithm involves step-by-step Finiteness: An algorithm should
(a)
analysed procedures to solve a particular have a defined number of steps that
problem. It is a set of instructions must terminate at the end of the
written to accomplish the defined task. steps.
The algorithm is not a program, so
Definiteness: Every step in the
(b)
you do not need to use a programming
algorithm should be defined in one
language to design it. It is just a way
meaning. The purpose of being
of solving a problem systematically,
conducted should be clear with no
which can be represented by either a
ambiguity.
flowchart or pseudocode. The algorithm
should define the beginning and end Effectiveness: Any operation
(c)
of the problem with a specific number within the algorithm must be
of steps. The steps of the algorithm performed efficiently and follow
normally involve decisions, including the same principle required to
logic and comparison. All programs design the algorithm.
designed within the computer system Well-defined
(d) inputs: The
are the implementation of the algorithm. quantities used as the input must be
Algorithms are used for calculation, data well-defined and specified.
processing and automatic reasoning. Well-defined output: An algorithm
(e)
However, the concept of the algorithm must have well-defined results and
can be applied even in solving typical should match with the desired
daily life tasks, such as cooking food, output.
studying, teaching, and travelling.
Advantages of algorithms
Importance of algorithm (a) It is easy to understand because it
Through an algorithm; uses normal language in writings
(a) it is possible to know if there is a (b) It is the step-by-step representation
possibility of solving a particular of a solution to a given problem
problem or not. This includes
35
Student’s Book Form Six Tanzania Institute of Education (TIE)
36
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Step 1: Start books labelled A, B, C, the following
are the possible ways: ABC, ACB,
Step 2: Input value of Principle amount BAC, BCA, CAB and CBA. This means
(P), time in years (N), and % interest (R) there are six ways of arranging any three
Step 3: Calculate SI = (P x N x R)/100.0 objects. Mathematically, that scenario
Step 4: Display Simple Interest (SI) can be solved by using the concept of
factorial of n-object, for example, a 3!
Step 6: End
= 3*2*1 = 6 ways. This signifies that if
five students are sitting on the horizontal
Example 6: Write an algorithm to find bench, the ways of arranging them will
compound interest. be 5! = 5*4*3*2*1 = 120 ways.
Step 1: Start Generally, methods of organising any
Step 2: Input value of principle Amount given n-objects will be as;
(P), Time in Years (N), and % Annual n! = n x (n – 1) x (n – 2) x (n – 3) x (n –
Rate of Interest (R) 4) x.................x 2x 1.
Step 3: Calculate CI = P (1+R/100) N - P This system of breaking a problem into
Step4: Display Compound Interest (CI) more minor problems using the solution
applied to solve the main problem is
Step6: End called recursion.
Note: Two people can use different The algorithm that applies recursion to
algorithms in solving similar problems solve the problem is known as a recursive
as in the case of Example 2 and Example 3. algorithm. Recursive algorithms solve
a problem by breaking it into a simple
Types of algorithms problem using the same method by
repeatedly calling themselves.
In algorithms, you use to put similar
approaches in solving a problem in the
same group so that we can classify them Implementation of a recursive algorithm
one type of algorithm after another in
You can use a recursive function to
which a problem can be analysed briefly
implement recursive algorithms. The
and easily find a solution. There are
many algorithms, but this book deals recursive function contains a statement
with two fundamental types, recursive that causes the same function to execute
and iterative. again before completing the current call.
It is the function that calls itself until the
Recursive algorithms given condition is met. The result from
This is an algorithm that calls itself one execution in a recursive function is
repeatedly with a smaller value as inputs used as the input of the next recursive.
generated after solving the current The following example represents a
inputs until the problem is solved. This C++ program code to demonstrate the
means a process frequently uses the first recursive function:
37
Student’s Book Form Six Tanzania Institute of Education (TIE)
if(n==0)
return 1; instances of the same problem.
else Note: The recursive function divides
return(n*factorial(n-1)); a problem into the base case and the
} recursive step. The base case is the most
From the given straightforward instance of the problem
demonstration code above; that stops the recursion function. It
factorial (3) = provides the result of the function when
3*factorial(2) the condition is met. Also, the recursive
factorial (2) = step is responsible for providing
2*factorila(1) solutions by making recursive calls and
factorial(1) = 1* factorial decreasing the size of inputs.
(0) Consider some of the positive integers:
factorial (0) =1,
Then, 1 + 2 + 3 + 4 + 5 + ................. n +1 =
factorial(3) = 3*2*1*1 n
∴ factorial(3) = 6.
∑ (r + 1)
r =0
Where:
Note: If there is no base case in the recursive function, the recursive function will
continue to repeat.
Recursive execution can be represented by using a data flow model. The box
represents procedure invocation through data flow into and out of the box shown in
Figure 1.30. Figure 1.31 represents the recursive data flow model and the use of the
data flow model to solve the recursive problem, respectively.
38
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
39
Student’s Book Form Six Tanzania Institute of Education (TIE)
40
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
is the conversion of binary to decimal (i) The iterative algorithm is more
numbers as follows: efficient than the recursive
algorithm in terms of speed of
Step 1: Start the program execution and memory usage.
Step 2: Read the binary value, n
(ii)
The iterative algorithm can also
Step 3: Initialise dec=0, i=0 write any program that can be
Step 4: Check whether (n>0) written using a recursive algorithm
Step 5: Calculate r = n%10, dec += r *
pow(2, i); n=n/10, ++i
Step 6: Print the value of the dec . Exercise: 1.5
Step 7: Stop 1. (a) Identify the real-life example
where iteration is applied.
An example of a C++ program to (b) Write an iterative algorithm to
represent the implementation of an express the example.
iterative algorithm activity is as follows:
2. What are the advantages of using
#include <iostream> iterative over recursive algorithms?
#include <cmath>
using namespace std; 3. (a) Design an algorithm to find
int main() the sum of the digits made
{ from a positive number.
int n, dec=0, i=0, r; (b) Create the C++ program to
cout << ″Enter any binary implement the algorithm.
number: ″;
cin >> n; 4. (a) Change the following
while (n> 0) recursive algorithm to find
{ the reverse of the number in
r = n% 10; iterative form
n /= 10; Step 1: Start
dec += r * pow(2, i); Step 2: Enter the value of n
++i; Step 3: Assign r = 0, sum = 0
}
cout << ″Equivalent Decimal Step 4: If n>0
number: ″ << dec << endl; r = n mod 10
return 0; sum = sum *10 + r
} n = n div 10
Step 5: Repeat step 4 until the
The output of the program is as in condition fail
Figure 1.35.
Step 6: Print Sum
Step 7: Stop
(b)
Develop a program of the
Figure 1.35: Output of the program given algorithm to display the
output.
41
Student’s Book Form Six Tanzania Institute of Education (TIE)
42
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
search: “; ctivity 1.4: Searching a
A
cin>>item; word in a paragraph
linearSearch();
return 0; Write five sentences to explain
} about central processing unit (CPU).
The output of the program will be in Your explanation should include the
Figure 1.36: components and functions of each
element. Then, write a linear search
algorithm to find the word ALU.
Exercise: 1.6
Figure 1.36: Output of the program 1. What is a linear search algorithm?
2. What are the significances of using
Advantages of the linear search linear search in real life?
algorithm
(a) A linear search is performed very 3. Consider a list of the number with
fast if a list contains few elements. their position as represented in
Table 1.2
(b) Linear search does not need to
be sorted; anyhow data arranged, Table 1. 2: List of number and
searching is possible. their respective position
(c) Any operation within a list, Positions in a list Value
including insertion and deletion of
0 3
the items, will not affect the linear
search. 1 5
43
Student’s Book Form Six Tanzania Institute of Education (TIE)
You have realised that sequential or linear Example of a C++ program to show
search is inefficient for an extensive list. the implementation of a binary search
Therefore, if you want to search data algorithm
from the list that contains many data,
use binary search. The binary search #include<iostream>
uses the divide and conquers approach to using namespace std;
search data within the list. Binary search int a[50], item, n, loc,
beg, mid, end, i;
divides the list into two portions when void binarySearch()
the list is sorted from the smallest value {
to the biggest value. After dividing the beg = 0;
list into two halves, compare the target end = n - 1;
with the middle item, then decide which mid = (beg+end)/2;
half to take up or down the middle while((beg<=end)&&(a[mid]
value. For example, suppose you want !=item))
to search for a number from the phone {
book, where names are arranged in if (item<a[mid])
end = mid - 1;
ascending order. Instead of looking for a
else
number from the first to the last, you can beg = mid + 1;
start from the middle and see whether to mid = (beg + end)/2;
go up or down depending on the position }
of a targetted name. The following is the if (item == a[mid])
algorithm and C++ program to explain cout<<″the item is found
the Binary search. at location ″<<mid +
1<<endl;
Algorithm else
Step 1: Start cout<<″Item does not
Step 2: S
ort the list from small to the exist″<<endl;
}
large value int main()
Step 3: Find the middle value of the list {
Step 4: If the middle value of the list cout<<″Enter number of
items in the list: ″;
and the targeted value are equal, cin>>n;
declare the victory and stop cout<<″Enter all numbers
Step 5: If the middle item is less than within the list″<<endl;
the target, then remain with only for (i=0; i<n; i++)
upper items of the middle value, {
and from the list and repeat step cin>>a[i];
}
2 using the new list.
cout<<″Enter number to
Step 6: If the middle item is greater than search: ″;
the target, then continue with the cin>>item;
lower items list of the middle binarySearch();
value, repeat step 2 using the return 0;
new list. }
44
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
find the number of students who
failed the exam
(v) Use C++ programming language to
develop a linear and binary search
program
(vi) Compile and run the program
Figure 1.37: Output of the program (vii)
Use the program to search the
number of students who have
Advantages of binary search average pass marks and above in a
class
(a) Binary search narrowed the long-
distance searching by dividing the (viii) T
ake the snapshot of the output
list into two halves. and save it in a word processor file
(b) When the list of data is extensive,
binary search works more Exercise: 1.7
efficiently than linear search.
Answer the following questions
Disadvantages of binary search
1. Why do we need a search algorithm?
(a) Program a binary search algorithm
is complicated compared to a linear 2. What are the advantages of using
search binary search over sequential
(b)
It is time-consuming to solve, search algorithms in solving a
especially if the binary search has problem?
many items. 3.
Assume that you are required to
develop a program using the search
Activity 1.5: Developing algorithm, binary or linear. Which
a linear and binary search search is best for you? Give reasons
program to support your answer.
Resources:
Student score sheet, computer with C++ Sorting algorithm
compiler
Data should be arranged in ascending
Procedure: or descending order due to different
(i) Record current marks for computer reasons. You can organise data for
science subject from all students easy searching, reading, retrieving,
(ii) Set 50% to be a pass mark or otherwise. For example, a class
(iii) Write a linear search algorithm to teacher finds each student’s position
find the number of students who in a class after placing the students’
passed the exam marks in ascending order. The algorithm
responsible for putting data within a
45
Student’s Book Form Six Tanzania Institute of Education (TIE)
Unsorted list
6 6 2 2
10 10 10 4
Swap
4 4 Swap 4 10
7 7 7 7 Swap
5 5 5 5
2 2 6 6
Sorted list
2 2 2
4 4 4
5 5 5
7 6 6
10 Swap 10 7
Swap
6 7 10
Consider the following example for implementing the selection sort algorithm in
C++.
46
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
using namespace std; school[],int i)
int findSmallest (int[],int); {
int main () int ele_small,position,j;
{
ele_small = school[i];
int school[6] =
{20,8,16,4,1,10};
position = i;
int pos,temp,pass=0; for(j=i+1;j<6;j++)
cout<<”\n Input list of {
elements to be Sorted\n”; if(school[j]<ele_small)
for(int i=0;i<6;i++)
{
{
ele_small = school[j];
cout<<school[i]<<”\t”;
position=j;
}
for(int i=0;i<6;i++)
}
{ }
pos = findSmallest (school,i); return position;
temp = school[i]; }
school[i]=school[pos];
school[pos] = temp;
pass++; Insertion-sort
} Insertion-sort puts an element in its
cout<<”\n Sorted list of proper place by comparing the value
elements is\n”; of data and considering the position of
for(int i=0;i<6;i++) a particular data. Insertion-sort divides
{ a list into sorted and unsorted sublists.
cout<<school[i]<<”\t”; Then, elements from the unsorted
sublist are placed in the correct position
}
in the sorted sublist. Insertion sort can
cout<<”\nNumber of passes be applied to sort data in linked data, as
required to sort the seen in Figure 1.39.
array: “<<pass;
return 0;
}
47
Student’s Book Form Six Tanzania Institute of Education (TIE)
6 6 4 4 4 2
10 10 6 6 5 4
4 4 10 7 6 5
7 7 7 10 7 6
5 5 5 5 10 7
2 2 2 2 2 10
48
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Figure 1.40: Output for insertion sort implementation using C++
Bubble sort
Bubble sort is the comparison-based type of sorting algorithm. The bubble sort
algorithm sorts data by comparing and swapping elements if they are not in the
required order. It continues with the swapping of data until all data is sorted. For
the data which is arranged horizontally, such data in an array, bubble sort starts by
comparing the first two elements and then swapping them if they are not arranged
correctly, then arranging the second and third elements. Bubble sort is a stable sorting
algorithm but inefficient for large data volumes. Figure 1.41 shows an example of
the bubble sort algorithm.
49
Student’s Book Form Six Tanzania Institute of Education (TIE)
The following is algorithms and C++ program to implement the bubble sort algorithm
Algorithm
Step 1: Start
Step 2: Compare the first and second element
Step 3: If the first element is greater than the second element of an array, swap them
Step 4: If the first element is less than the second element of an array, move to the
next elements
Step 5: Repeat step 1 until all data is sorted within the list
Example of a C++ program for bubble sort algorithm implementation:
#include<iostream>
using namespace std;
int main()
{
int n, i, arr[50], j, temp;
cout<<”Enter the size of array: “;
cin>>n;
cout<<”Enter “<<n<<” Numbers”<<endl;
for(i=0; i<n; i++)
cin>>arr[i];
for(i=0; i<(n-1); i++)
{
for(j=0; j<(n-i-1); j++)
{
if(arr[j]>arr[j+1])
{
temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
cout<<”\nThe sorted array is: \n”;
for(i=0; i<n; i++)
cout<<arr[i]<<” “;
cout<<endl;
return 0;
}
50
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Figure 1.42: Output of the program
Example 1: Sort (5, 1, 12, 6, 23) using the bubble sort algorithm
Solution:
Step 1: (5, 1, 12, 6, 23) à (1, 5, 12, 6,23)
Step 2: (1, 5, 12, 6, 23) à (1, 5, 12, 6,23)
Step 3: (1, 5, 12, 6, 23) à (1, 5, 6, 12,23)
Hence, all elements are sorted.
Heapsort
Heapsort is a sorting method based on comparing elements. It is like a selection sort
where you first find the smallest element in the list and position it at the beginning
of the list. This process should be repeated to all elements within the list. Unlike
selection sort, heapsort does not use much time with a horizontal arrangement of
the unsorted element; instead, it has a way of quickly sorting the largest elements.
Figure 1.43 shows an example of the quicksort algorithm.
A 5 4 8 2 9 6
B 5 C 9
4 8 5 7
6 2 4 6
2 9
Maximum heap
Initial list
51
Student’s Book Form Six Tanzania Institute of Education (TIE)
largest = l;
for the heap-sort technique as follows:
if (r < n &&arr[r] >arr[largest])
Step 1: Start largest = r;
Step 2:
From the given data, build a if (largest != root)
max heap from the given data {
such that the root is the highest swap(arr[root], arr[largest]);
element of the heap. Load(arr, n, largest);
Step 3: Remove the root, i.e. the highest }
element from the heap, and }
swap it with the last element of void loadSort(int arr[ ], int n)
the heap.
{
Step 4: Then, adjust the max heap not to for (int i = n / 2 - 1; i >= 0; i--)
violate the max heap properties Load (arr, n, i);
(heapify).
for (int i=n-1; i>=0; i--)
Step 5: The above step reduces the heap {
size by 1.
swap(arr[0], arr[i]);
Step 6:
Repeat the above three steps Load(arr, i, 0);
until the heap size is reduced to 1.
}
Step 7: Stop. }
Remember, to sort the given dataset void displayArray(int arr[ ], int n)
in increasing order, you first construct {
a maximum heap for the given data for (int i=0; i<n; ++i)
as shown in the previous heap-sort cout<<arr[i] << “ “;
algorithm. cout<< “\n”;
Example: The following code }
demonstrates the implementation of int main ( )
heap-sort using C++. {
int heap_arr[ ] = {11,9,6,13,2,8};
#include <iostream>
int n = sizeof (heap_arr)/sizeof (heap_
using namespace std; arr[0]);
void Load(int arr[ ], int cout<<”Inputed array”<<endl;
n, int root) displayArray (heap_arr,n);
{ loadSort (heap_arr, n);
int largest = root; cout<< “Sorted array”<<endl;
int l = 2*root + 1; displayArray(heap_arr, n);
int r = 2*root + 2; }
52
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Figure 1.44: The output of the heap-sort program
Quicksort
Quicksort uses the divide and conquer sorting technique. The list is portioned into
two sublists, and each will be sorted and joined to form one list again. It uses the
recursion method to implement sorting. Quicksort divides a list into lower and upper
sublists separated by a pivot. A pivot is a selected element from the list that is more
significant than all elements in a lower sublist and less significant in an upper sublist.
Quicksort can be applied to sort data within an array. Figure 1.45 shows an example
of the quicksort algorithm.
10 6 4 7 13 12
Pivot = 10
6 4 7 10 13 12
Pivot = 6 Pivot = 12
4 6 7 10 12 13
53
Student’s Book Form Six Tanzania Institute of Education (TIE)
The following are things to consider to it is possible to make unstable sorts like
choosing the sorting algorithms for the heap and quick sort stable.
application:
Execution time
Stability of the sorting algorithms This explains a running time algorithm
The stability of a sorting algorithm is that can be set for data processing. It
considered by how it treats identical explains the average performance of the
elements. Stable sorting algorithms algorithm on every set of data. Usually,
maintain the order of equal or repeated execution time depends on recursive
elements, which is impossible for calls, memory usage, and comparisons.
unstable sorting. This is to say, stable Quicksort and merge sort are examples
sorting preserves the order of two of fast sorting algorithms.
similar elements within the list. Suppose
you want to sort the students according Memory usage
to their grades after already sorted Memory usage depends on the size of
based on their names; you must use the input data to be sorted. An example
a stable sort algorithm such as merge of a sorting algorithm that does not need
and insertion sort to sort similar grades extra memory is the insertion and bubble
without affecting their names. However, sort. Otherwise, merge sort and quick
54
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Note: Depending on some factors, data structure that can store different
every sorting algorithm can be the best data types is the non-primitive data
or worst. These factors are based on the structure. Examples of non-primitive
problem to be solved and the data to be data structures include arrays, linked
manipulated. lists and stacks.
3. The data structure in which the
number of elements is fixed is the
Exercise: 1.8 static data structure. An example of
Answer the following questions: a static data structure is an array. The
data structure in which the number
1. Use the bubble sort algorithm to of elements is not fixed is known
arrange the following numbers in as a dynamic data structure. An
ascending order: 9, 3, 10, 2, 8, 5, 1. example of a dynamic data structure
2. Write a C++ program to display the is a linked list.
sorted list in question (1). 4. An array is a static data structure. It
3. Given the list of the elements: 6, 10, contains identical types of data. The
25, 8, 45, 15, whereby the first three elements in the array are stored in
elements are in order, how many consecutive memory locations. An
key comparisons are executed to example of an array is a[3] = {7,9, 11}.
move 8 to its proper position using 5. Stack is a non-primitive linear data
bubble sort? structure in which data insertion and
4.
Given the list of elements to be deletion occur from only one end,
sorted: 25, 15, 22, 11, 24, 32, 13, known as the top.
70, 33, 55, 14, use bubble sort to 6. Pointers are usually auxiliary
determine the resulting list after six variables that indirectly allow users
steps. to access other variables’ values.
For example, int x, *p;. “x” is the
Chapter summary numerical variable in the declaration
while “p” is the pointer to the number.
1. The data structure is the standard
way of storing and organising data in 7. Records are the type of data structure
a computer for quick and efficient comprising a series of related data.
searching, sorting, and accessing Unlike an array data structure which
data. includes data of the same type, a
record contains data for different
2. The data structure available in the
kinds.
computer and generally defined
within a compiler is known as a 8. The queue is a non-primitive linear
primitive data structure. The primitive data structure in which data insertion
data structure stores only one type and deletion occur from two opposite
of data. Examples of primitive ends, rear and front.
55
Student’s Book Form Six Tanzania Institute of Education (TIE)
56
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
length of a password.
used in the data structure:
(b)
Write a C++ program to
(i) Stack implement the algorithm
(ii) Queue made in part (a).
4. Describe the stack implementation 13. (a) What is linear search?
in the C++ program in an array.
(b)
Explain steps to implement
5. By using illustrations, describe
linear search.
operations done in the stack data
structure. 14. (a) What is the binary search?
6. Describe four operations that the (b) The following form an array:
queue can perform. 10, 31, 0, 9, 38, 20, 13, 24, 7
7. Sort the numbers: 55, 44, 83, 26, and 200. Why is it impossible
47, 66, 92 and 72 in a binary tree to locate key “0” using binary
structure and arrange them in Pre- search?
Order, In-order, and Postorder.
15. (a)
By showing steps clearly,
8. State three (3) features of a suitable show how binary search is
algorithm.
implemented to find an element
9. Design an algorithm for a program in the following Array, and let
that inputs the radius of a circle the searched key be 56.
from a user. The user will be
asked by the program to calculate Elements Index
diameter, circumference, or area. 10 0
The result will be calculated and
then displayed. 12 1
10. Write an algorithm to find squares 24 2
of the number. 29 3
11. Write a C++ program for the 37 4
following algorithm
40 5
Step 1: Start 51 6
Step 2: Enter two numbers A and B
56 7
Step 3: Check if A is greater than B, if
yes go to step 4 else go to step 5 68 8
Step 4: Print A is greater than B
Step 5: Check if B is greater than A, if (b) Use a C++ program to
yes go to step 6 else go to step 7 implement the given algorithm.
Step 6: Print B is greater than A 16. (a) What is bubble sort?
Step 7: Print A is equal to B (b) Explain the implementation of
Step 8: Stop bubble sort.
57
Student’s Book Form Six Tanzania Institute of Education (TIE)
58
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Two Information systems
Introduction
Nowadays, people and organisations use various information systems to handle
their daily activities in healthcare, education and training, financial transactions,
administration, agriculture, tourism and other sectors. For example, the Tanzania
Institute of Education (TIE) online library gives students and teachers textbooks and
video conferencing facilities to facilitate business meetings, and instant messages. In
this chapter, you will learn about these information systems and how to manage and
apply them in real life. Important issues related to information systems in general,
like database systems, relational databases, and database management, will be
covered. The competency achieved will enable you to design, develop, manage, and
use various information systems.
59
Student’s Book Form Six Tanzania Institute of Education (TIE)
Data Represented by
Alphanumeric data Numbers, letters, and symbols characters
Image data Graphic images and pictures
Audio data Sound, noise, or tones
Video data Moving images or pictures
60
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The information supplied by information
that region will not reflect the reality. systems should be relevant or
This inappropriate reflection may lead appropriate for the task at hand. What is
to unrealistic planning such as allocated important to one person or organisation
budget for school and hospitals. might not be necessary to another. The
Completeness user will get annoyed if the material
An information system’s output should contains unnecessary data for the task.
include all of the user’s details. Otherwise, For example, detailed technical data on
it could not be a reasonable basis for equipment and production specifications
deciding. For example, suppose an can be relevant to the line supervisor but
organisation is given information on the may be irrelevant to upper management.
cost of selling laptops to a school, but not Objectivity or dependability
on the cost of service and maintenance.
In that case, the total cost of ownership Objectivity deals with the truth of the
based on the information provided will information that an information system
be significantly underestimated. presents and relies on. Only if you are
confident of the information’s reliability
Economical or cost-effective or objectivity can you use it confidently.
Information should be accessible at For example, you may go straight to the
a predetermined price, which may library to choose an appropriate book
change based on the situation. If for an essay on any subject if you have
obtaining information is expensive, an reasonable confidence in the accuracy
organisation may opt for less expensive and objectivity of information obtained
information elsewhere. For example, from a book or a library. This might be
suppose an organisation wishes to do a due to the reason that books in the library
market research study on a new product, are authored and edited by specialists
the survey could cost more than the in the topic, and the authors’ names are
product’s expected initial profit. The usually prominently displayed.
organisation would most likely choose
a less expensive information source in Secure
that circumstance. Unauthorized users should not be
Flexibility allowed to access information. For
example, in a college information
Information systems should be flexible
system, examinations and staff salary
to be used for a variety of reasons. A
information are sensitive; hence, they
procurement officer in a school, for
have to be secured against students and
example, might utilise information
other unauthorised persons.
on how much inventory is on hand
for a specific part to close a deal. The Simple
headmaster can use the same information
Information should be straightforward
to approve a new inventory, and a school
and in a format that permits it to be
accountant may use the same to secure
examined and used without the addition
the required amount of money.
61
Student’s Book Form Six Tanzania Institute of Education (TIE)
Input
Input is the action of acquiring and capturing raw data in information systems.
For example, when creating payroll checks, each employee’s number of hours
worked must be gathered before the payroll check can be generated and printed.
Supervisors must submit their employees worked hours in a payroll system as
indicated in Figure 2.2 to generate payroll checks for the given employees.
In the payroll system demonstrated in Figure 2.2, the input goes through a
transformation process to produce output with the possibility of improving the input
and process through feedback.
62
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Worked
Payroll Payroll
Transaction checks
Processing
Pay rate
63
Student’s Book Form Six Tanzania Institute of Education (TIE)
64
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
system, as indicated in Figure 2.3.
65
Student’s Book Form Six Tanzania Institute of Education (TIE)
Figure 2.4: Use of application software and systems software and how they relate
66
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Education Students’ Loans Board transmission. People can work from
(HESLB) handles over 100,000 home or on the road because of telecoms.
applicants for loans for higher education. Telecommunications also allow virtual
Data are collected from all interested teams of people working on a project
beneficiaries, mostly from higher to meet and interact without physical
learning institutions and intermediate meetings. For example, during the
college graduates. Data is collected from COVID-19 pandemic, when the social
people seeking for loans as well as those distance was required, many people
who have already graduated are now were able to work and learn from their
required to repay. Thousands of them homes.
and a Higher Education Students Loans
Networks, on the other hand, enable
Board (HESLB) staff utilise the system
electronic communication by
every year. This includes registration,
connecting computers and equipment
application, follow-ups, and issuing
within a building (Local Area Network-
and refunding the loan by beneficiaries
LAN) such as an administration
and employees, resulting in an increase
block in a school; across the buildings
in digital data and significant database
(Metropolitan Area Network-MAN)
and device storage requirements. The
such as various colleges’ buildings in
OLAMS systems database makes it
simple and convenient to obtain the a University; and across the country
data, for use in operations and decision- or countries (Wide Area Network-
making. For example, HESLB staff can WAN) such as in the Southern African
obtain a detailed report of beneficiaries Development Community (SADC)-
who received loans to study at a specific wide based company.
university. Furthermore, the Internet is a vast
network that connects computers
Telecommunication, Network, and worldwide. In today’s technological era,
the Internet most organisations do their operations
Telecommunication is the transmission over the Internet. Organisations and
of information by various technologies individuals make their daily tasks more
over the wire, radio, optical, or other productive and comfortable through
electromagnetic systems. Categorically, various Internet use. Major uses of the
telecommunications can take place Internet that play a vital role in daily
through wired, wireless, and satellite life include online bookings and orders,
transmissions. People may now see cashless transactions, education, online
the news live as it happens, including banking, and trading. Others include
breaking news events, due to satellite research, electronic mail, job search,
communication networks that have social networking, collaboration,
eliminated delays in news transmission. entertainment, e-commerce, file transfer,
People and organisations of all sizes are navigation, advertising, and real-time
using telecommunications worldwide. updates, as indicated in Figure 2.5.
67
Student’s Book Form Six Tanzania Institute of Education (TIE)
Figure 2.5: The uses of the Internet that play a vital role in daily life
The technology used to create the Internet assistance from other organisations.
is also being applied within organisations Dalsey Hillblom Lynn (DHL) is a large
to develop intranets, which allow company that empowers customers to
people in an organisation to exchange serve themselves at their convenience
information and work on projects. through a corporate extranet. Through
Through the internet, employees can its customers’ information system,
quickly access the internet; employees customers can access the DHL extranet
can promptly access work resources, to obtain a full range of shipping, billing,
collaboration, and fun. An extranet is and tracking services.
a network based on web technologies
that allow selected outsiders, such People
as business partners and customers, People are the most vital component of
to access authorised resources of an computer-based information systems.
organisation’s intranet. Many people They make it possible for the computer
use extranets daily without realising it system to work effectively, improve and
to track shipped goods, order products solve society’s challenges and problems.
from their suppliers, or access customer All persons who utilise, manage, run,
68
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
systems to get outcomes, are considered information systems personnel, as shown
in Figure 2.6. End-users include finance executives, marketing representatives,
sales persons and manufacturing operators, while IT professionals includes systems
analysts, persons, network engineers, and systems administrators.
Figure 2.6: P
eople - End-users & IT professionals that use, manage, develop and
maintain the system
Procedures
Procedures are strategies, policies, and guidelines for using a computer-based
information system (CBIS) more effectively to meet the organization’s objectives.
They define the processes to achieve a given result, such as submitting a customer
order, paying a supplier invoice, or getting a current business-oriented report at
the entry-level. From the end users’ and IT professionals’ perspectives, reasonable
procedures outline how to reach the desired result, who does what and when, and
what to do if something goes wrong. People who are adequately taught and follow
effective procedures available in various ways can complete tasks faster, save money,
better use human resources, and help people adapt to change. Procedures clearly
documented, such as in user manuals, systems manuals, and Frequently Asked
Questions (FAQs), can drastically minimise training costs and time to mastery. This
also applies to the availability of high-level policies and strategies that are aligned
with the objectives of these information systems in the organisation.
69
Student’s Book Form Six Tanzania Institute of Education (TIE)
70
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
operations, control and assessment, and decision-making. These systems can cut
costs, uncover new opportunities, increase profits, or improve effectiveness.
Executives Executives
Information
Systems
Senior Managers
Decision Support
Systems
Middle Managers Management Information
Systems
Workers
Transaction Processing Systems
Figure 2.7: F
our main types of information systems
71
Student’s Book Form Six Tanzania Institute of Education (TIE)
Example: Examples:
(a) Cheque clearing, (a) Reservation systems
(b) G
eneration of bills, credit card (b) Point of sales terminals
transactions
Advantage Advantage
Many transactions are completed at once a Data is processed immediately
time in a single process
Disadvantage
Disadvantage
The act of processing data is repetitive.
Data takes time to be processed
72
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
not clearly stated in advance, such Executive Support Systems (ESS) or
as unstructured and semi-structured Executive Information Systems (EIS)
decision problems, at the management, are computer-based information systems
operations, and planning levels of that enable top managers or senior
an organisation, often mid-to-upper executives to quickly access internal
management. and external data, critical to strategic
DSS focuses on combining model or decision-making, and other executive
analytic techniques with traditional duties. It has drill-down features for easy
data access and retrieval functions and information navigation, status access,
emphasises flexibility and adaptability to trend analysis, exception reporting, and
accommodate environmental changes. It customised analysis, all of which are
created with management’s essential
also focuses on features that make them
success elements in mind.
easy to use by non-computer-proficient
people in an interactive mode. Some The four significant types of information
examples are a sales manager projecting systems are related to one another, as
revenue figures based on product sales shown in Figure 2.8.
assumptions.
Executive
Support
Systems
(ESS)
Management Decision
Information Support
System Systems
(MIS) (DSS)
Transaction
Processing
Systems(TPS)
73
Student’s Book Form Six Tanzania Institute of Education (TIE)
74
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
saved to a hard drive using a computer applications. The database approach
and software like Microsoft Access or collects pragmatically related data,
MySQL. some of which can be published for
A database is also a logically coherent an application. The main differences
collection of data with some inherent among them are as follows, and are
meaning that has been created, built, also, illustrated in Figure 2.9:
and populated with data for a particular (a) A file-based system is a method
purpose. It has a target audience and of arranging /organising files on a
some predetermined applications that medium such as hard disks and flash
these users are interested in. In other disks. A Database system also known
words, a database has a data source, as Database Management System
some level of interaction with real-world (DBMS) is a software application
events, and an audience that is actively used to access, create, and maintain
engaged in its contents. A database’s databases.
end users can conduct transactions or an (b) There is no disaster recovery
event can be triggered by an employee. mechanism in the file-based system;
All of this must be reflected in the DBMS provides you with a disaster
appropriate databases. recovery mechanism.
A database must be a true reflection of (c) The file-based system does not
the real world; it depicts to be accurate provide transfer of transactions;
and dependable at all times. As a result, it is complex, while in the DBMS
even in databases with increased size system, it is easy to implement the
and complexity, such as the government transfer operations using Structured
electronic Payment Gateway (GePG), Query Language.
Facebook, and WhatsApp, which have (d) The file-based system does not offer
millions to billions of users and are concurrency, but DBMS does offer
constantly changing, changes must concurrency.
be reflected in the database as soon as (e) Data redundancy and inconsistency
they occur. A database can range in size are at the top of the system file. As
from an individual’s address book to shown in the first part of Figure
a company-wide database containing 2.9(a), the same data, A, is stored
customer data used by employees to a in different application programs,
product database used in conjunction thus causing redundancy which
with an e-commerce site to allow online leads to data inconsistency as data
shoppers to place real-time orders. get updated. The inconsistency in
Database can also be used in a search database management systems is
engine database. For example, Google eliminated or reduced when using
contains data about billions of web different applications to access
pages accessed by people worldwide. the same database, as shown in
Figure 2.9(b). This is because all
Database system and file-based system data are stored in one place (DB),
The file-based system is the software independent of the applications
that allows users to access and organise involved and accessible by any
a small group of data. It is defined in the of them. Also, any update made
75
Student’s Book Form Six Tanzania Institute of Education (TIE)
76
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
A database model is a form of the
is kept in the form of records that are
data model that defines a database’s
linked together. This model begins with
logical structure. The model determines
the root data and grows in a tree-like
relationships and how data can be stored,
fashion, adding child nodes to parent
organised, altered, and accessed. You nodes, with each child node having
can handle your business data using one only one parent node. This model may
of four database models: hierarchical, effectively express various real-world
network, object-oriented, or relational relationships, such as a book’s index
database models. and recipes. This model also has a one-
to-many link between two categories
Hierarchical database model
of data. For example, one department
A hierarchical database model is a data can have many courses, teachers, and
model that organises data into a tree-like students, as shown in Figure 2.10.
College
Department Infrastructure
Theory Practical
Figure 2.10: A
n example of a structure illustrating the use of the hierarchical
database model
77
Student’s Book Form Six Tanzania Institute of Education (TIE)
78
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Attributes Attributes
Name Dept_id Name
Job_Tittle Dept_name
Phone_no Methods
Salary
Dept_id
Change Department
Methods
Get_Hired
Change Number
Relational database
Meaning of relational database
ctivity 2.3: Database
A
systems A relational database is a collection of
data elements linked together by pre-
Access a file and a database system defined connections. These objects
in your school and then describe the are organised as a collection of tables
disadvantages observed in the former containing columns and rows, as
vs. advantages observed in the latter. mentioned in the preceding section. The
relational database divides data into
tables that can be connected or related
Exercise 2.3
based on shared data. You may create
1. What is the database system? How a whole new table from data in one or
does it differ from the file system? more existing tables with a single query.
Provide an example for each. It also provides a better understanding of
the relationships between all accessible
2. Define the database model and data and the acquisition of fresh
describe its importance in the use insights for better decision-making or
of information systems today. identifying new opportunities. Consider
3. Differentiate hierarchy and network the following scenario whereby your
models and then, provide real-life school keeps a record of the pupils and
examples for each of them. their related information, e.g., family
4.
Contrast relational and object- members, results, subjects, and teachers,
oriented models, and then give as shown in Figure 2.13. Pupi_ID,
examples of their uses in real life Pupil Name, Family_ID, and so on are
for each of them. examples of columns (or fields) in a
pupil table; Assessment_Date, Pupil_ID,
Grade, Class ID, and so on are examples
of columns (or fields) in a grade table.
79
Student’s Book Form Six Tanzania Institute of Education (TIE)
in this small database. As a result, you can query the data to generate useful reports,
such as consolidated pupil results. These queries are fed into report generators,
which run them on-demand to create reports. Many organisations use databases to
keep track of inventories, sales, financing, fees, treatments, and pharmaceuticals
issued and develop financial and other business/organisational projections. This
section will cover various aspects of relational databases, mainly entity-relationship
models, functional dependency, and normalisation.
80
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
and physical data models. than to implement it. It is not reliant on
any particular database or file structure.
Conceptual data model It can be used in various databases,
The concepts, rules, and processes including relational and NoSQL
required to support the business are systems, and an XML file.
described using a conceptual data Characteristics of a logical data model
model. It determines and defines what (a) They are designed and developed
data is needed for business operations, independently from the DBMS.
analytics, reporting applications, and (b) It describes data needs for a single
the business rules and concepts that go project but can integrate with other
with it. The conceptual model identifies logical data models based on the
the data required and tracks business project’s scope.
events and their outcomes. On the other (c) Data attributes/elements will have
hand, a conceptual model concentrates data types with exact precisions
on the necessary data pieces for business and lengths. This characteristic
processes but ignores process flow or may also be used in physical data
data type categorization. model.
Characteristics of a conceptual data model (d) Normalization processes to the
(a)
The conceptual model is model are applied up to the Third
independent of hardware Normal Form (3NF).
specifications like data storage Physical Model
capacity, and location, or software A physical data model is more
specifications like DBMS vendor concerned with data design and
and technology. The attention is to database implementation. It specifies
represent data in a way a user will how data is organised in a system’s
see it in the “physical world.” specific database or file structure. It is
(b) Gives organisation-wide coverage the physical representation of process
of the business concepts. data pieces collected by the entity for
(c) This type of data model is designed storage in a database management
and developed for a business system (DBMS). The model considers
audience. the technical as well as the performance
criteria. The physical (model) comprises
Logical data model all relationships and entities, data types,
A logical data model defines the mapping keys, foreign keys, constraints, indexes,
of data rules and structures. It goes into triggers, tables, spaces, partitions, and
a greater depth about a process and how other DBMS features in the database
it ties to other business processes inside utilised to construct an application. This
the company. It detects and defines model, developed from the conceptual
data structures such as entities, tables, and logical models, contains entities and
attributes, columns, and structure-to- relationships that help with enterprise
structure relationships such as primary data storage and retrieval.
81
Student’s Book Form Six Tanzania Institute of Education (TIE)
(a) The physical data model describes data needed for a single project or application
though it may be integrated with other physical data models based on project
scope.
(b) It was developed for a specific version of a DBMS, location, data storage, or
technology in the project.
(c) The physical data model contains relationships between tables that address
cardinality and the relationships’ nullability.
(d) Columns should have exact data types, lengths assigned, and default values.
(e) Primary and foreign keys, views, indexes, access profiles, authorizations, are
defined.
The three data models, also shown in Figure 2.14, can be produced using Entity-
Relationship (ER) modelling, a best practice for building a well-designed relational
database structure through the three processes.
Entities are objects that represent things in the real world and have a common set of
attributes, (which are characteristics of properties of the entities), and relationships,
(which describe how entities are related to one another, and share information in the
database) are used to accomplish this database.
82
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
According to the relationships
Scenario: A route taken by a particular established in step 1, route number from
bus company, whose buses travel the entity Route will become a foreign
according to a given schedule. key in the remaining entities, which
are Bus Company and Schedule. This
Step 1: Creating a conceptual data model
implies that there shall be an addition of
In this step, you have to identify entities one attribute (route number) in the Bus
and their relationships. There are Company and Schedule entities.
three entities, which are: Route, Bus
Company, and Schedule. With regard Step 3: Creating a physical data model
to relationships, one route can have The creation of the physical data
one or many bus companies offering model requires defining the names of
transportation services to passengers. the tables, names of the columns, and
Also, a route can have one or multiple column data types in addition to the
transportation schedules. characteristics, primary key, and foreign
keys described in the logical data model
Step 2: Creating a logical data model in step 2. Since physical data model is
Identification of characteristics, primary also an implementation of the database,
keys, and foreign keys are necessary for its specification may be dependent on a
the establishment of a logical data model particular database management system
in addition to the names of entities and such as MS Access, MySQL, and
relationships that were formed between PostgreSQL.
entities in step 1. i) Names of tables
(i) Identification of attributes The names of tables are route, bus_
•
The entity Route may have company, and schedule
the following attributes: route ii) Names of columns
number, route name, origin, • The table route has the following
destination columns, route_number, route_
• The entity Bus Company may name, origin, destination
have the following attributes: • The table bus_company has the
company id, route number, following columns, company_
owner name, post code id, route_number, owner_name,
• The entity Schedule may post_code
have the following attributes: • The table schedule has the
schedule number, route number, following columns, schedule_
departure time, arrival time number, route_number,
(ii) Primary keys departure_time, arrival_time
Under current scenario, the primary (iii) Data types
keys are route number, company id, and • Data type for route_number,
schedule number for entities Route, Bus company_id, schedule_number,
Company, and Schedule, respectively. and post_code will be integer
83
Student’s Book Form Six Tanzania Institute of Education (TIE)
84
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The domain is a set of allowable values for an attribute. It refers to a group of values
we can assign to an attribute and can be considered as a constraint on the attribute’s
value. Each attribute has a domain. For example, for an attribute “Grade” in a student
database, its domain can be a positive number between 0 and 100. Another example
could be an attribute “Regions” in the Tanzania census database in which by March
2022, there were 31 regions (26 from Tanzania mainland and 5 from Zanzibar);
thus, the domain alphabetically is “Arusha, Dar es Salaam, Dodoma …, Kaskazini
Pemba, Kusini Unguja …, Tabora, Tanga”.
Primary key
The primary key is a tuple, field, or set of tuples or fields that uniquely identify a
record or tuple in relation to a table. A table can have only one primary key, often
denoted as PK. The primary key cannot be null due to the dependency of other
fields in relation to a table. A good example is a National Identification Number in
National Identification Authority (NIDA) database or a student registration number
in a student database, as indicated in Figure 2.16 as “StudID.”
Figure 2.16: Example of the primary, candidate and alternate keys using a student
table
Candidate key
A candidate key, denoted as K, is a minimal set of attributes that can uniquely identify
a tuple, or field row. Any set of attributes or columns has a unique combination
of values in each row. The additional constraint is that removing any attribute or
column can produce duplicate rows. The difference between the candidate key and
the primary key is that, while the primary key uniquely identifies a record or row
in the table and follows one key per table approach, the candidate key does the
same. Still, it can have one or many keys per table. Sometimes, there are a group of
columns in a table with unique values. All such columns have a candidate key, and
thus the primary key is a subset of the candidate key. For example, in Figure 2.17,
the StudID, Roll_Number, and email columns can be the candidate keys, meaning
records of these columns do not have any duplicate value, and they can be used to
identify data in the table. And any one of these three can be taken as the primary key.
85
Student’s Book Form Six Tanzania Institute of Education (TIE)
The candidate keys that are not selected as the primary key are called alternate keys.
In this kind of key, columns have a candidate key except for the primary key, which
has an alternate key. For example, in Figure 2.17, the columns - Roll_No and Email
are alternate keys, considering that Student ID is the primary key.
Foreign Key
The foreign key is an attribute, or set of attributes, within one relation or table that
matches the primary key of another relation or table. It creates a relationship between
the two tables. It effectively uses the values of attributes in the referenced relation
to restrict the domain of one or more attributes in the referencing relation. The
purpose is to maintain data integrity and allow navigation between two different
instances of an entity. A good example is a foreign key in an Employee database
where every employee works in a specific department in an organisation, and the
employee and department are two different entities or tables. Therefore, we cannot
store the department’s information on the employee table. That is why we link
these two tables through the primary key of one table. We add the primary key of
the DEPARTMENT table, Department_ID, as a new attribute in the EMPLOYEE
table; thus, becoming a foreign key there; then both tables are related, as depicted
in Figure 2.17.
EMPLOYEE DEPARTMENT
Employee_ID Department_ID
Employee_Name Department_Name
Passport_Number
License_Number
SSN
Department_ID
Consider the related tables of student registration and results in your school. Identify
the Primary, Foreign, Candidate, and Alternate keys and illustrate them with a
diagram.
86
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
In the context of relational databases, a composite key is a combination of two or
more columns in a table that can be used to identify each row in the table uniquely.
Uniqueness is only guaranteed when the columns are combined; the columns do not
guarantee uniqueness when taken individually.
The column(s) that agrees with uniqueness is called a candidate key. A composite
key is a distinct type of candidate key formed by two or more columns. Sometimes
the candidate key is just a single column, and sometimes it is created by linking
multiple columns.
Note:
(a) The combination can also make a composite key of more than one candidate key.
(b) A composite key cannot be empty/null.
Selection and projection
Selection and projection operations are basic and most used operations specific
to relational databases. The selection is defined as taking the horizontal subset of
rows of a single table that satisfies a particular condition. It retrieves tuples from a
relation, limiting the results to only those that meet a specific criterion. Selection,
covered in detail in the next section, returns some or all rows and all the columns
in a table. Selection answers the question: which rows shall the query return (where
condition)? For example, `Select * From emp Where deptno = 10` as shown in
Table 2.4.
Table 2.4: Selection operation in a relational database
The projection is defined as the set obtained when the components of the tuples are
restricted to the set – it discards (or excludes) the other attributes. It extracts only
the specified relation attributes from a tuple or set of tuples. It is a vertical subset of
table columns, and it may include one column, two columns or all table columns.
87
Student’s Book Form Six Tanzania Institute of Education (TIE)
Projection differs from selection as SELECT is used to select all rows of a specific
relation that meet a particular condition, whereas project is used to select particular
columns. However, one query may contain both: selection and projection: For
example, `select empno, fname, job From emp Where deptno=10`; returns
enclosed columns and rows as in Table 2.6.
Table 2.6: Selection and Projection operations in a relational database
88
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
A relational database system has relational database’s characteristics like
multiple advantages, as described in the ease of use, precision, and data stability.
next paragraphs. Flexibility
Simple model A relational database system possesses
A relational database system is the qualities for levelling up and expanding
simplest model, as it does not require to bigger lengths. It is endowed with
any complex structuring or querying a bendable structure to accommodate
processes. It does not involve tedious the constantly shifting requirements,
architectural processes and SQL queries as there is supposedly no boundary on
like hierarchical and network database the number of rows, columns or tables
models. a relational database can hold. This
facilitates the increasing incoming
Data accuracy amount of data and the update and
In the relational database system, deletes wherever required. For example,
multiple tables can be related to one a database administrator can insert,
another using a primary key and foreign update, or delete tables, columns, or
key concepts. This makes the data non- individual data in the given database
repetitive hence, no data duplication, system promptly and efficiently to meet
and more data accuracy is experienced. business needs.
89
Student’s Book Form Six Tanzania Institute of Education (TIE)
90
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
An ER data model’s main elements involve entities, attributes, and relationships, as
depicted in Figure 2.18,
with the example from a student database involving how each element is
diagrammatically represented.
Student_ID Course_ID
Age Credits
91
Student’s Book Form Six Tanzania Institute of Education (TIE)
92
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
93
Student’s Book Form Six Tanzania Institute of Education (TIE)
94
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
and avoid data anomalies. on motorbike_model. In this case, the
(c) It plays a vital role in finding the two columns are said to be multivalued
difference between good and bad dependent on motorbike_model. These
database design, thus promoting dependencies are represented like this:
robust and impactful databases. motorbike_model ->> manuf_year; and
motorbike_model ->> colour
Types of functional dependencies
Trivial dependency
There are four main types of functional
This type of functional dependency
dependency which are:
occurs when a set of attributes called a
(a) Multivalued dependency trivial is included in that attribute. So, X
(b) Trivial functional dependency -> Y is a trivial functional dependency if
(c) Non-trivial functional dependency Y is a subset of X. For example, consider
(d) Transitive functional dependency this Employee table with two columns,
Emp_id and Emp_name.
Multivalued dependency
Emp_id Emp_name
This type of functional dependency
occurs when there are multiple AS555 Harry
independent multivalued attributes in a AS811 Mwajuma
single table. It consists of at least two
AS999 Kevin
dependent attributes on its attributes;
thus, it always requires at least three In this case, {Emp_id, Emp_name}
attributes. For example, consider a -> Emp_id is a trivial functional
motorbike manufacturing company that dependency as Emp_id is a subset of
produces two colours (black and red) in {Emp_id, Emp_name}.
each model every year. Table 2.8 shows
multivalued dependency. Non-trivial dependency
Table 2.8: Multivalued dependency This functional dependency occurs when
A->B holds true where B is not a subset
Motorbike_ Manuf_year Colour of A. In other words, if a functional
model dependency X->Y holds true, then Y is
M1001 2017 Black not a subset of X; thus, this dependency
is called a non-trivial functional
M1001 2017 Red dependency. For example, an employee
M2012 2018 Black table with three attributes: emp_id,
emp_name and emp_address. From
M2012 2018 Red this example, the following functional
M2222 2019 Black dependencies are non-trivial: emp_id ->
emp_name (This means that if we know
M2222 2019 Red emp_id, we know emp_name. but emp_
name is not a subset of emp_id) emp_id
95
Student’s Book Form Six Tanzania Institute of Education (TIE)
Meaning of normalisation
which is not a subset of emp_id). Normalisation was developed to break
A transitive dependency data into related groups and define
It is a type of functional dependency that the relationships between them. It is a
happens when it is indirectly formed by specific relational database analysis and
two functional dependencies, and can design technique used to model groups
only occur in relation to three or more of related data within an organisation.
attributes. Consider the following table Normalisation organises data in a
containing the details of the company’s database to avoid redundancy, insertion
Chief Executive Officers (CEOs). anomaly, update anomaly, and deletion
anomaly. These concepts will be
Table 2.9: Company chief executive
discussed in detail later in this section. It
officers details
analyses the relation schemas based on
Company CEO BirthDate their different functional dependencies
Microsoft Satya Nadella 1.2.1967 and primary key. The purpose is to ensure
that data stored within the database
Google Sundar Pichai 12. 6.1972 adhere to best practices by following a
Facebook Mark Zuckerberg 7.9.1984 set of rules to eliminate redundancies
and optimise the process of information
It follows that {Company} -> {CEO} retrieval. Normalisation leaves us with
(if we know the company, we know its a structure that groups alike data into
CEO’s name). {CEO} -> {Birthdate}; relational models. It is accomplished
if we know the CEO, we know the by applying some formal rules either
Birthdate. Therefore, if the rule of by synthesis (creating a new database
transitive dependency: {Company} -> design) or decomposition (improving an
{Birthdate} should hold, it will make existing database design).
sense because if we know the company’s Importance of normalisation
name, we can know the CEO birthdate. Database normalisation is structuring
a database, usually a relational database,
to reduce data redundancy, anomalies,
Activity 2.9: Functional and inconsistency; and minimising
dependencies in databases redesign when extending the database
The multivalued dependency is the type structure. It also entails organising
of functional dependency that occurs a database’s columns (attributes)
when multiple independent multivalued and tables (relations) to ensure that
attributes are in a single table. Study database integrity constraints properly
your surroundings and generate a single enforce their dependencies. An example
table that produces a single table that is indicating one of the reasons for
a multivalued dependency. normalization, the data anomalies, is
shown in Table 2.10, where Employee
426 is shown as having different
addresses on different records.
96
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Employees’ Skills
Employee ID Employee Address Skill
426 Box 137 MWANZA Public speaking
426 Box 132 MWANZA Typing
645 Box 8991 Dar es salaam Carpentry
645 Box 8991 Dar es salaam Public speaking
In this example, the same information relations are considered free of insertion,
can be expressed on multiple rows; updating, and deletion anomalies.
therefore, updates to the relationship In addition, we have something called
may result in logical inconsistencies. For Un-Normalised Form (UNF); though
example, each record in an “Employees’ not generally considered as part of the
Skills” relation might contain an normalisation rules, it represents the
Employee ID, Employee Address, and very first stages of the normalisation
Skill; thus, a change of address for a process. The objective of the Un-
particular employee may need to be Normalised Form (UNF) and each of the
applied to multiple records (one for three normal forms (1NF; 2NF; 3NF)
each skill). If the update is only partially are shown in Figure 2.20, followed by
successful, (the employee’s address is details for each one.
updated on some records but not others),
then the relation is left in an inconsistent Un-Normalised Form (UNF)
state. Specifically, the relation provides
conflicting answers to this particular Create model Data
employee’s address, affecting the
database’s use and effectiveness.
First Normalised Form (1NF)
Database normalisation forms
Normalisation is represented by a logical Remove Repeating Attributes
set of steps that follow simple rules
applied to each stage of the modelling
process. The stages are separated into Second Normalised Form (2NF)
normal forms at the highest level,
identified by a particular named process. Remove Partial Dependencies
There are three common normal forms
that, when applied, a relation is often
described as “normalised”. These forms Third Normalised Form (3NF)
are First Normal Form (1NF), Second
Normal Form, (2NF) and Third Normal Remove Transitive Dependencies
Form (3NF). Generally, normal forms Figure 2.20: Objective of Un-Normalised
are six, but the rest three are considered Form (UNF) and the three normal forms
complex data structures. Once the first (1NF; 2NF; 3NF)
three common normal forms are applied,
97
Student’s Book Form Six Tanzania Institute of Education (TIE)
In this un-normalised table (see Table 2.11), there is an update anomaly. In the table,
we have two rows for employee Samson, who belongs to two different departments
of the company. If we want to update the address of Samson, then we have to update
the same in two rows; otherwise, the data will become inconsistent. If, somehow,
the correct address were updated in one department but not in the other, then as per
the database, Samson would have two different addresses, which is incorrect and
would lead to inconsistent data. Besides, the table in this form may lead to an insert
anomaly. Suppose a new employee joins the company who is under training and
currently not assigned to any department, then we would not be able to insert the data
into the table if the emp_dept field does not allow nulls. Finally, in this normalized
table, there is a delete anomaly: suppose, at a point in time, the company closes the
department D890, and then deleting the rows that have emp_dept as D890 would
also, delete the information of employee Madina since she is assigned only to this
department. Therefore, we need to normalize the data in the three normal forms as
introduced earlier to overcome these anomalies.
Another example of an Unnormarised Table is shown in table 2.12.
98
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Full name Address Movie_industry Sports
Ismail Makame Kijichi Hollywood and Football and
Bollywood Basketball
Rehema Kiongwe Mnazi Moja Swahiliwood and Netball
Nollywood
Muki Mohamed Mbagala Nollywood and Cricket
Riverwood
Advantages of normalization
(a) Normalization helps to reduce data redundancy
(b) More incredible overall database organization
(c) Data consistency within the database
(d) Much more flexible database design
(e) Enforces the concept of relational integrity
Disadvantages of normalization
(a) You cannot start building the database before knowing what the user needs.
(b) The performance degrades when normalizing the relations to higher normal
forms, i.e., 4NF, and 5NF.
(c) It is very time-consuming and challenging to normalize relations of a higher
degree.
(d) Careless decomposition may lead to a bad database design and severe problems.
First Normal Form (1NF)
As indicated in Figure 2.20, the objective of this 1NF is to remove repeating
attributes. This is done because the relation is in 1NF if it contains an atomic value,
and an attribute of a table cannot hold multiple values. Instead must have only
single-valued attributes. Also, 1NF disallows the multi-valued attribute, composite
attribute, and their combinations.
For a table to be in the First Normal Form, it should follow the following four rules:
1. It should only have single (atomic) valued attributes/columns.
2. Values stored in a column should be of the same domain.
3. All the columns in a table should have unique names.
4. The order in which data are stored does not matter.
For example: Suppose an agriculture-based company wants to store its employees’
names and contact details. It creates a table as presented in Table 2.13.
99
Student’s Book Form Six Tanzania Institute of Education (TIE)
As you can see from Table 2.13, employees (Erick and Namdori) have two mobile
numbers, so the company stored them in the same field as you can see in emp-
mobile. Therefore, this table is not in 1NF as a rule says, “each attribute of a table
must have atomic (single) values”; the emp_mobile values for employees Erick and
Namdori violate this rule.
To make the table comply with 1NF, we should have those anomalies fixed in the
data, as indicated in Table 2.14.
Table 2.14: An example of a table conforming to the First Norm Form (1NF).
emp_id emp_name emp_address emp_mobile
101 Hamis Waya Iringa 0658000770
102 Erick Misitu Mbeya 0713876776
102 Erick Misitu Mbeya 0767000771
103 Mwantumu Chake Coastal 0688000775
104 Namdori Mchicha Arusha 028675432
104 Namdori Mchicha Arusha 0736000671
For example, if we want to put Table 2.15 in the 1N, it will look as in Table 2.15.
Table 2.15: The first normalized form
Full name Address Movie_industry Sports
Ismail Makame Kijichi Hollywood Football
Ismail Makame Kijichi Bollywood Basketball
Ismail Makame Kijichi Hollywood Basketball
Ismail Makame Kijichi Bollywood Football
Rehema Kiongwe Mnazi Moja Swahiliwood Netball
Rehema Kiongwe Mnazi Moja Nollywood Netball
Muki Mohamed Mbagala Riverwood Cricket
Muki Mohamed Mbagala Nollywood Cricket
100
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
A table is in 2NF, if the relation or table Teacher_id Subject
is in 1NF (First Normal Form) and all 25 Computer
non-key attributes are fully functional
dependent on the primary key (non- 25 Biology
prime attribute). For example, suppose a 47 English
school wants to store the data of teachers 83 Math
and the subjects they teach and, in a 83 Chemistry
school, a teacher can teach more than
one subject. Since a teacher can teach The characteristics of 2NF
more than one subject, the table can
(a) In the 2NF, relational must be in 1NF.
have multiple rows for the same teacher,
as indicated in Table 2.16. (b) In the second normal form, all non-
key attributes are fully functional
Table 2.16: An example of a table not
dependent on the primary key.
conforming to 2NF
(c)
A single column Primary Key
Teacher_id Subject Teacher_age
that is not functionally dependant
25 Computer 40
on any subset of candidate key
25 Biology 40 relation.
47 English 35
83 Math 36 Third Normal Form (3NF)
83 Chemistry 36 A table design is said to be in 3NF if
it is in 2NF and transitive functional
Based on Table 2.16, we have; candidate
keys which are {Teacher_id, Subject} dependency of the non-prime attribute
and the Non-prime attribute is: teacher_ (an attribute that is not part of
age. Therefore, the non-prime attribute any candidate key) on any super key
Teacher_age is dependent on Teacher_id, (single key or a group of multiple keys
which is a proper subset of a candidate that can uniquely identify tuples in a
key; thus, violating the rule for 2NF. To table) should be removed.
convert the given table into 2NF, we In other words, a table can be explained
decompose it into two tables: Teacher as in 3NF if it is in 2NF, and for each
details in Table 2.17(a) and Teacher-
functional dependency X-> Y, at least X
subject in Table 2.17(b), which the now
is a super key of the table or Y is a prime
comply with Second Normal Form
(2NF). Resulting tables conforming to attribute of the table. For example,
Second Norm Form (2NF). suppose a company wants to store the
complete address of each employee;
Table 2.17 (a): Teacher details they create a table named employee_
Teacher_id Teacher_age details, as indicated in Table 2.18.
25 40
47 35
83 36
101
Student’s Book Form Six Tanzania Institute of Education (TIE)
In Table 2.18 you can see that Super keys Table 2.19: Employees’ details
are: {emp_id}, {emp_id, emp_name}, emp_id emp_name emp_pc
{emp_id, emp_name, emp_pc}… and
so on; Candidate Keys: {emp_id}, Non- 1001 John Miti 282005
prime attributes: all attributes except 1002 Muhidini Kata 222008
emp_id are non-prime as they are not 1006 Lora Misitu 282007
part of any candidate keys. 1101 Lilly Nyavu 292008
Here, emp_reg, emp_city and emp_ 1201 Steve Milango 222999
district depend on emp_pc. and, emp_pc
is dependent on emp_id that makes non- Table 2.20: Employee address
prime attributes (emp_reg, emp_city &
emp_pc emp_reg emp_city emp_district
emp_district) transitively dependent on
super key (emp_id). This violates the 282005 AR Arusha Arumeru
rule of 3NF. To make this table comply 222008 DS DSM Kinondoni
with 3NF, we have to break the table 282007 DS DSM Temeke
into two tables to remove the transitive 292008 TG Tanga Muheza
dependency, as shown in Table 2.19 and
222999 MZ Mwanza Ilemela
Table 2.20, which conform to 3NF.
102
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(b) Describe and illustrate the process systems include MySQL, PostgreSQL,
of normalizing the data shown in Microsoft Access, SQL Server,
Table 2.20 to the Third Normal FileMaker, Oracle, RDBMS, dBASE,
form (3NF). Clipper, and FoxPro.
(c) Identify the primary, alternate, and Structured Query Language
foreign keys in your 3NF relations. Structured Query Language (SQL)
is a database programming language
Exercise 2.6 designed to retrieve and manage data in
a relational database.
1. Describe the steps you would take
to convert unnormalised tables to Importance of Structured Query
the First Normal Form, Second Language
Normal Form, and Third Normal The following are the importance of SQL:
Form. (a) Allows users to access data in the
2. Provide one (1) example relevant to relational database management
a school or college environment that systems
illustrates reasons for converting (b) Enables users to describe the data
database tables to the First, Second (c) Allows users to define the data in a
and Third Normal Forms. database and manipulate that data.
3.
How does normalization help in (d) Allows embedding within other
improving the design of a database? languages using SQL modules,
libraries, and pre-compilers
4. What kind of inefficiencies (e) Enables users to create and drop
may exist in tables that are not databases and tables
normalised? (f) Enables users to create, view, and
store procedures and functions in a
Database management database
Database management is the process of (g) Allows users to set permissions on
organizing, storing and retrieving data tables, procedures, and views
from a computer. It involves designing, Since there are so many database
implementing and sustaining stored data management systems in this chapter,
to optimize its value, which database
you will learn about Structured Query
management represents. In designing
Language using MySQL. To use
a system, a programmer must have a
this, you need to install the XAMPP
database to store data. For example, if
application. Download and install
you want to store student results in an
academic records system, you need to XAMPP, then start MySQL and Apache
have a database so that all the data can on the XAMPP control panel to access
be stored in it. A database enables you the database; open your browser and
to perform many operations, such as type localhost/phpMyAdmin, and the
103
Student’s Book Form Six Tanzania Institute of Education (TIE)
104
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Example:
CREATE DATABASE student;
CREATE TABLE student_registration (
StudentID int,
FirstName varchar (255),
MiddleName varchar (255),
LastName varchar (255),
Address varchar (255)
);
To create a database and table resulting from this example, select SQL to continue
with the code and type the code; first, you need to create a database and then the table
as indicated in Figure 2.22: this is because the table shall belongs to the database.
When you run the code, it will create the database, and inside the database, the table
will also be created, as shown in Figure 2.23.
105
Student’s Book Form Six Tanzania Institute of Education (TIE)
106
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
DML commands are used to modify the database. Those commands are responsible
for all forms of CHANGES in the database. The command of DML is not auto
committed, which means it cannot permanently save all the changes in the database.
They can be rolled back. DML involves INSERT, UPDATE, and DELETE
commands.
INSERT
The insert command is used to add new records to the table. The syntax is INSERT
INTO table_name (column1, column2, column3, ...) VALUES (‘value1’, ‘value2’,
‘value3’, ...);
Example: Insert students’ data in student_registration table with column (studentID,
FirstName, MiddleName, LastName, Address).
An example of an INSERT query
INSERT INTO student_registration (StudentID, FirstName, MiddleName, LastName,
Address) VALUES(`1234`,‘Mwakalinga’, ‘Mwakatope’, ‘Mkinga’, ‘972 Mbeya’);
Also, see the query in Figure 2.24.
If you run this query, it will insert data in the table, as shown in Figure 2.25.
107
Student’s Book Form Six Tanzania Institute of Education (TIE)
For example, suppose you want to update the student’s first name with studentID
number 1234 from Mwakalinga to Musawomda. In that case, you will apply the
following query:
UPDATE student_registration
SET FirstName =’Musawomda ‘
WHERE studentId = 1234;
Output is as shown in Figure 2.26 (a) and (b).
108
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
It is used to control users’ rights in
accessing data in the database. It uses ROLLBACK, and SAVEPOINT.
two controls, GRANT and REVOKE.
COMMIT
GRANT COMMIT command is used to save
any transaction into the database
It is used to give users access privileges permanently. When we use any DML
to a database. The syntax is GRANT command like INSERT, UPDATE or
privilege [,privilege], ON privilege_ DELETE, the changes made by these
level TO account_name; commands are not permanent; until the
For example, If you need to give user_M current session is closed, the changes
access to the database student, the query made by these commands can be rolled
will be: back. To avoid that, we use the COMMIT
GRANT ALL command to mark the changes as
permanent. The syntax is COMMIT;
ON student
Example:
TO user_M;
Delete from student_registration
Where address = 250 Dodoma;
REVOKE
Commit;
It is used to revoke access permissions
that were previously granted to prevent a
user from accessing the database objects. ROLLBACK
The syntax is REVOKE privilege_name If you have used the UPDATE command
ON object_name FROM {user_name to make some changes to the database
|PUBLIC |role_name} and realise that those changes were not
For example: If you need to remove required, you can use the ROLLBACK
user_M from accessing the database command to roll back those changes
student, the query will be: if they were not committed using the
COMMIT command.
REVOKE ALL
Example:
ON student
Delete from student_registration
FROM user_M;
Where address = 250 Dodoma;
Rollback;
Transaction Control Language (TCL)
command SAVEPOINT
Transaction Control Language command It is used to roll back the transaction to
is used to handle database transactions. a certain point without rolling back the
It keeps track of the modifications made entire transaction. The syntax for the
by the data manipulation language. It savepoint commands is SAVEPOINT
also enables the grouping of statements savepoint_name;
109
Student’s Book Form Six Tanzania Institute of Education (TIE)
UPDATE class SET name = ‘Mwamtumu’ Security and protection are two of the
WHERE id = ‘5’; most critical and continually changing
SAVEPOINT A; aspects of database administration.
The major DBMS suppliers have
been introducing security features and
enhancing how you can protect your
Activity 2.10: valuable corporate data. However,
Think of any problem needing a database keeping up with these features can be
table with 10 columns, design it, create challenging; so, let’s take a quick look
it, and then populate the table with SQL at some of the more exciting and helpful
and fill it. database security choices.
Encryption
Exercise 2.7 Even though encryption has been
available for a long time, it has only
1.
What is the difference between recently become a significant part
SQL and MySQL? of database security for securing
2.
What do you mean by DBMS? sensitive data. When data is encrypted,
What are its different types? it is altered using an algorithm to be
incomprehensible to anyone who does
3. Describe the five groups of SQL
not have the decryption key. The main
commands.
goal is to make decrypting so tricky
4. What is the difference between that the effort of accessing the data
DELETE and TRUNCATE outweighs the gain benefit to a hacker.
commands? Data encryption can be used in two
scenarios: data in transit and data at
General database administration rest. Data “at rest” encryption protects
data kept in a database, whereas data
A person who manages the database
“in transit” encryption protects data
daily is called a database administrator
transported over a network.
(DBA).
The primary responsibility of a Label-based access control
database administrator (DBA) is
to guarantee that data is available, Label-based access control (LBAC)
secure from loss and damage, and is now available in many DBMSs,
conveniently accessible when needed. providing greater fine-grained control
The administrator will plan for whom over authorisation to specific data in
to use what and when. User role in the the database. LBAC can accommodate
database is essential; for example, a applications that require a more
super admin accesses all the privileges; granular security strategy. LBAC can be
this user assigns roles as discussed in configured to control who can read and
Data Control Language (DCL). alter data in specific rows and columns.
110
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Maintaining current knowledge of your database terminologies. Other
DBMS’s security requirements and relational databases emphasise
capabilities. Understand what you have relational database models, types
at your disposal and what you may need of the relational data model, the
to supplement with extra tools. Also, Entity-Relationship model, and
keep in mind that the security features normalisation.
discussed here are not the only ones
4. Furthermore, the chapter presented
available to you for protecting your
database data. database management focusing
on Structured Query Language
(SQL) involving DDL, DML, DCL
Activity 2.11: and TCL and the general database
Assigning roles to users in the MySQL administration with a focus on
database security features to ensure the
Create a database of a law company, availability and accessibility of the
create three roles: the super admin, database.
the company manager, and the head of
human resources, and assign those roles Revision exercise
to Moris, Salima and Berth respectively.
1. What is an information system?
Give examples from your
Chapter summary community.
1. Today, people and organisations 2.
Differentiate between any two
use various information systems components of the information
for handling their daily activities system.
socially, economically, and
3.
There are four main types of
spiritually in areas such as
information systems. With an
education, healthcare, water,
example, briefly describe how they
power grid, restaurants, religion,
interrelate.
transport, travelling, tourism, and
entertainment. 4.
What are the six components
that make up an information
2. In this chapter, you have learned
system? Describe the role of each
about these information systems
component.
and how to create, manage and
apply them in real life. 5.
What are the three examples of
information system hardware?
3. The covered areas are an overview
Identify the role of each of them.
of information systems focusing
on their elements, components and 6. What is the most commonly used
type and database systems focusing database model? Differentiate it
on their advantages, database from the rest.
111
Student’s Book Form Six Tanzania Institute of Education (TIE)
112
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Introduction
The transmission of digital data across a network or to a device other than the
sending device is the foundation of modern telecommunications. Telephones,
computers, Internet, and wireless technology have revolutionised society in how
they interact and work due to data communication and networking. Without these,
modern civilization would be substantially different. In this chapter you will learn
data communication and computer networks, network, topologies and network
architecture. The competence develop will enable you to plan and implement a
simple data communication network in a school or home environment.
113
Student’s Book Form Six Tanzania Institute of Education (TIE)
114
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Sender/Source: The device that generates the data transmission is known as the
sender, for example, a terminal computer or mainframe computer.
Transmission medium: The path through which the message passes or propagates
from the sender to the recipient—for example, cables, microwaves, fibre optics, and
radio frequency.
Receiver: The device that receives the message, for example, printer, terminal,
computer, and mainframe.
Transmitter: The data generated by a source system is not directly delivered in the
form it was generated. A transmitter converts and encodes that data into a format
appropriate for transmission before transmitting it via a transmission system.
Receiver: The receiver receives and transforms the signal from the transmission
system.
115
Student’s Book Form Six Tanzania Institute of Education (TIE)
116
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
117
Student’s Book Form Six Tanzania Institute of Education (TIE)
118
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Serial transmission serial transmission is appropriate for
long-distance transmission, as shown in
Sending data sequentially across a data Figure 3.5.
transmission medium is called serial
communication. In serial transmission, Data are usually transmitted as packets.
data are transmitted bit after bit. The Each packet is given a packet identifier
Least Significant Bit (LSB) is usually (packet ID) before being transmitted for
transmitted first. While sending data the proper reception and reassembling of
serially, characters or bytes are broken data on the receiver side. The packet ID
into bits before being transmitted. As a is the part of a small header that is added
result, hardware is needed to transform at the beginning of each packet of data
the data from parallel to serial. At the created as a result of the fragmentation
destination, all of the bits are gathered, of the original message. The header of
measured, and assembled as bytes in the each packet contains other information
destination’s memory. This necessitates like routing information (source and
a serial-to-parallel conversion. destination IP address and Media Access
Control (MAC) address).
As opposed to parallel transmission, the
Parallel transmission
As demonstrated in Figure 3.6, the parallel transmission simultaneously sends all
of the bits of a byte on separate channels. Multiple connections between the two
devices are thus required in this case. This is the fastest means of sending data
from one location to another. The disadvantage of parallel transmission is that, it is
quite expensive because it necessitates using many lines for both transmitting and
receiving devices. Second, it necessitates remarkable precision, which cannot be
guaranteed across large distances.
119
Student’s Book Form Six Tanzania Institute of Education (TIE)
Table 3.1 shows the difference between serial and parallel transmission.
Table 3. 1: Comparison between serial and parallel transmission
Serial Transmission Parallel Transmission
Data flows in both direction bit by bit Data flows in multiple directions, 8 bits at
a time
Inexpensive Expensive
The number of bits transferred per clock The number of bits transmitted per clock
pulse is 1 bit pulse is 8 bits
Used for low-speed data transmission Used for high-speed data transmission
Used for long-distance communication Used for short-distance communication
It can be used to connect computer to It can be used to connect the computer to
computer the printer
120
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(a) Asynchronous
(b) Synchronous
These types of transmission use bit synchronization. Bit synchronization is necessary
to identify the beginning and end of the data transmission. Bit synchronization
supports the receiving computer in recognising when data transmission begins and
ends. Therefore, bit synchronization offers timing control.
121
Student’s Book Form Six Tanzania Institute of Education (TIE)
122
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Synchronous signals often use a bit receives this CRC value appended to it.
pattern that cannot be found anywhere The receiver does the same algorithm
else in the transmission, ensuring that to recalculate the CRC and compare
they are always distinct and easily the CRC in the frame to the calculated
recognised by the receiver. Frames value. If these values match, the frame
can be longer since the transmitter and was sent successfully.
receiver remain in synchronization for An end-bit pattern indicates the end
the whole period of the transmission. of the frame. End’s bit pattern is
As frames become longer, the parity similar to synchronisation signal, in
method of error detection becomes that it does not exist elsewhere in
ineffective because, if many bits are the messages, ensuring that they are
affected, the parity technique will not always distinct and easily recognised
reliably report the fault. As a result, at the end of the frame. For high-speed
the Cyclic Redundancy Check (CRC) communication between computers,
is employed with the synchronous serial synchronous transmission is used.
transmission. When large amounts of data must be
A CRC value is calculated by the sent, it is employed. Table 3.2 shows
transmitter using an algorithm that sums the advantages and disadvantages of
the value of all data bits. The data frame synchronous and communication.
123
Student’s Book Form Six Tanzania Institute of Education (TIE)
In order to evaluate the efficiency of the synchronous data transmission, the following
formula is applicable:
Actual data distance
Efficiency = × 100
Total bits
Where,
(i) Actual data bits refer to the amount of data bits to be sent over the medium
(ii) Total bits refer to the sum of actual data bits and overhead data bits
(iii) Overhead are header information (16 bits) and trailer information (16 bits)
Example 2: D
etermine the efficiency of 30KB data transmission using the
asynchronous transmission method.
Solution:
Actual data = 30KB=30×8Kb=240Kb=1000×240b=240,000 bit
Suppose, a block has 80 characters, So, block size = 80×8 bit = 640 bit
Overhead data bit required for each block of 640 bit group = 32 bit
So, total overhead data bits required for 240,000 bit data transmission
= 32/640)×240,000 = 12,000 bit
Total bits = Actual data bit + overhead data bits = 240,000 bit + 12,000 bit
= 252,000 bit
So, Efficiency = (240,000/252,000) × 100% = 95%
Note: The more a block has characters, the more method has efficiency.
124
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
There are three types of transmission modes under this subclass. These are simplex
mode, half duplex and full duplex.
Simplex mode: Data can only be transmitted in one direction; hence communication
is unidirectional. As a result, they cannot convey a message to the sender. Simplex
systems use unidirectional communication, in which we only need to provide
a command/signal and do not require a response. Loudspeakers, television and
remote control, radio call, keyboard and monitor are examples of simplex mode,
as in Figure 3.9.
Half-duplex mode
Half-duplex data transmission implies that data can be delivered in both directions
on a single signal carrier, but not simultaneously.
For example, on a local area network using half-duplex transmission technology,
one workstation can send data on the line and then immediately receive data on
the line from the same direction in which the data was just transferred. On contrary
to the half-duplex transmission, which requires a bidirectional line (one that can
transmit data in both ways), data can only be delivered in one direction at a time.
A radio call used by police is an example of half-duplex communication in which
messages are sent one at a time but in both directions. Figure 3.10 shows the half-
duplex mode.
125
Student’s Book Form Six Tanzania Institute of Education (TIE)
Full duplex mode allows data transfer in both directions simultaneously. A telephone
network is an example of full duplex communication since it allows two people to
talk and listen simultaneously across a telephone line.
There are two lines in a full duplex system, one for sending and receiving data.
Figure 3.11 illustrates full-duplex mode.
Exercise 3.1
1. Colour image uses 16 bits to represent a pixel. What is the maximum number
of different colours that can be represented?
2. Discuss the concept of data communication system.
3. Calculate the efficiency of 1MB data transmission using asynchronous
transmission method.
4. Calculate the efficiency of 1MB data transmission using synchronous
transmission method.
5. Discuss the real life application of Simplex, Half-duplex, Full-duplex
communication modes at your environment.
6. What are the advantages of digital data over analog data?
126
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Computer networking has changed the Untwisted pair cable and fiber
way people communicate information optics cable; unguided transmission
globally and locally. It has also changed media such as radio waves,
business operations, social services, microwaves and infrared.
and knowledge sharing. It is on these
Classification of computer networks
grounds the study of computer networks
becomes essential. A computer network can be classified
based on various criteria. However, the
Concept of computer network most common criteria are:
A network is a collection of devices (a) Classification based on
(nodes) linked together by a geographical area
communication medium. A node can (b) Classification based on ownership/
be a computer, printer, or any other access restriction
device that can send and/or receive data
(c) Classification based on topology
generated by other network nodes.
(d) Classification based on architecture
The computer network can be defined
as the collection of computers and other
Classification of computer networks
communication devices linked together
based on geographical area
using communication media for the
purpose of data communication and The geographic area and number of
resource sharing. Electronic devices on computers that are part of a network
the network may be connected by cables should be used to represent the size of
or wireless. a network. It ranges from devices in
a single room to millions of devices
Components of computer network dispersed worldwide. The following are
The computer networks environment is the most common types of computer
made up of the following: networks under this category:
(a) Network devices include Network Personal Area Network
Interface Cards (NIC), hubs, Personal Area Network (PAN) is a
switches, routers, repeaters, bridges computer network built around a single
and modems. person. It comprises a computer, mobile
(b) Network software such as Network device, or personal digital assistant. PAN
connects personal gadgets to a digital
Operating Systems (NOS) such
network and the internet by establishing
as Microsoft Window server and
communication between them. PAN
Ubuntu Server. Network software
is the smallest network which is very
manages end-user devices such as
personal. This type of network normally
PC, printers and servers.
ranges from around 10 meters. Figure
(c)
Transmission media include 3.12 shows an example of a Personal
bounded transmission media Area Network.
127
Student’s Book Form Six Tanzania Institute of Education (TIE)
Personal Area Networks may include (c) It can be wirelessly connected to
Bluetooth-enabled devices or infrared- the internet called WPAN.
enabled devices. When we connect two
or more devices using Bluetooth or (d) Appliances used for PAN: cordless
infrared for data transfer, we create a mice, keyboards, and Bluetooth
network in our personal space. systems.
128
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(d) A personal area network also uses infrared to interfere with radio signals, and
data can be dropped.
129
Student’s Book Form Six Tanzania Institute of Education (TIE)
(a)
LAN networks are used in (a) Although LAN saves money due
businesses where all business data to pooled computer resources, the
are stored on servers. initial cost of setting up a Local
(b) LAN can be used in factories. Area Network is relatively high.
(c)
It can be used at schools and (b)
Because the LAN administrator
colleges where students, teachers can see any LAN user’s data files, it
and other staff data are stored on does not provide adequate privacy.
the servers. (c) Unauthorized users can gain access
(d) It can also be used in our homes to an organization’s essential
where all computers, mobiles, and data if the LAN administrator
printers are connected through cannot secure the centralized data
central devices (hub/ switch/router) repository.
for the aim of data exchange. (d)
There are challenges with
software configuration and
Advantages of LAN hardware failures; So, Local Area
Networks necessitate continual
(a) Local area networks can be used administration.
to share computer resources such
as hard disks, DVD-ROMs, and
printers. This drastically reduces Metropolitan Area Network
the cost of purchasing hardware. Metropolitan Area Network (MAN) is
(b)
Instead of purchasing licensed a computer network that extends across
software for each client in the an entire city, college campus, or a
network, you can use network small region. This network type is larger
licenced software over the network than LAN, which is mainly limited to a
which reduces cost. single building or site. Depending upon
the type of configuration, this type of
(c) Data of all network users can be network allows you to cover an area
stored on a single hard disk of the from several miles to tens of miles.
server computer. In other words, when two or more
(d) You can quickly send files and LANs network are connected for
messages through networked communication, it becomes a MAN
computers. network. Example: If the university
has branches in different locations and
(e) It will be easier to manage data in every branch uses a LANs network, as
a single location, making it more illustrated in Figure 3.14 this types of
secure. network is known as MAN. The company
(f) The Local Area Network allows all connects all LAN networks through a
LAN users to share a single internet telephone line so that all branches can
connection. share data and resources. This type of
network will be called MAN.
130
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
131
Student’s Book Form Six Tanzania Institute of Education (TIE)
132
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(a) This type of network is owned and Computer systems and peripherals are
controlled by a person or private connected to form a network. They
organization. provide
(b) This type of network is not open to numerous advantages, such as:
all members of the given network. (a) Resource sharing like printers and
Only registered members can use storage devices
this network.
(b)
Exchange of information using
(c) The security of this type of network E-Mails and FTP
is extremely strong. (c) Information sharing by using the
(d) Has low traffic. Web or the Internet
(e) Computers on this network are not (d) Interaction with other users using
visible to the public. dynamic web pages
(f)
The administering authority
determines access restrictions. Network topologies
For example: Different banks have their Meaning of network topology
own network system or Intranet of an Computer network topology is the
organisation. way various components of a network
Characteristics of public Network (like nodes, links and peripherals) are
arranged. Network topologies define the
(a) This network belongs to a company layout, virtual shape or structure of the
or Government but allows public network, not only physically but also
service access, usually at a charge. logically. How different systems and
(b)
This network is not owned and nodes are connected and communicate
controlled by any person or private with each other is determined by the
organisation, but an organization topology of that given network.
runs it. Classification of network topologies
(c)
Computers on this network are Network topologies are categorised into
visible to the public. two types which are logical topology
For example, the Internet is a public and physical topology.
network because it uses public IP Logical topology refers to how data is
addressing space to enable anyone transmitted from one device to another
access to the resources on the internet, in the network. There are two types of
mobile phone or telephone network logical topologies, Ethernet and token
systems etc. ring.
Note: Computer networks are also Ethernet topology: All computers
(a)
classified based on architecture and listen to the network media and can
topology as will be described in the next only send data when none of the
subtopics. others is sending.
133
Student’s Book Form Six Tanzania Institute of Education (TIE)
data called a token goes around the In a bus topology, as in Figure 3.15, all
network. This token will be taken computers or stations attach directly to
by the computers whose addresses a bus network through the appropriate
were attached to the token. hardware interfacing, known as a tap.
Computers will release the token Full duplex operation between the station
after reading the data. In contrast and tap allows data to transmit onto the
to its design, logical topology bus and received from the bus. Any
relates to how data moves through station’s transmission travels the length
a network. of the medium in both directions and can
Physical topology: The physical be received by all other stations. At each
topology refers to the physical layout of end of the bus is a terminator, which
a network which includes the devices, absorbs any signal, removing it from
installation, and location. the bus. Drop lines and taps connect the
The physical topology can be classified nodes to the bus cable. A drop line is a
as bus, ring, star, tree, mesh and hybrid. connection running between the device
They are complex networks which can and the main cable. A tap is a connector
be built of two or more topologies. that either splices into the main cable
These topologies are described in this or punctures the sheathing of a cable to
section as follows: create contact with the metallic core. A
Bus topology: The usage of a multi-point bus network works best with a limited
medium distinguishes bus topology number of computers.
134
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Disadvantages of bus topology the ring in one direction, from device to
device, until it reaches its destination.
(a) The cable length will be limited,
limiting the number of stations. It may be clockwise or anticlockwise.
When a device receives a signal intended
(b) If the backbone cable fails, the for another device, its repeater generates
entire network will go down.
the bits and passes them along. For the
(c) It is very difficult to troubleshoot. bus and tree, data are transmitted in
(d) Maintenance cost is very high in frames. As a frame circulates past all
the long run. the other stations, the destination station
(e) Terminators are required for both recognizes its address and copies the
ends of the cable. frame into a local buffer as it goes by.
The frame continues to circulate until
Ring topology it returns to the source station, where it
On this type of topology, as shown in is removed. These topologies are used
Figure 3.16 (a) and (b), the network in school campuses and some office
consists of a dedicated point-to-point buildings.
Figure 3.16(a): Ring topology, physical representation (PCs are connected to MAU)
135
Student’s Book Form Six Tanzania Institute of Education (TIE)
136
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(a) If one link fails in the star topology,
only that link is affected. All other (b)
It requires more cable length
links remain active. compared to the linear bus topology.
(b) It is easy to identify the fault and (c) It is much more expensive than bus
fault isolation. topology because of the cost of the
(c) It is easy to expand the network in hubs.
the star topology. Mesh topology
(d) There are no network disruptions Every device in a mesh topology has its
when connecting or removing dedicated point-to-point link to every
devices from the network. other device. The term “dedicated” refers
(e) It is very easy to manage because to the link that exclusively transports
of its simplicity of function. data between the two devices it links.
Figure 3.18 shows mesh topology.
Disadvantages of star topology
(a) The entire network will fail if the
137
Student’s Book Form Six Tanzania Institute of Education (TIE)
138
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
top and lower layers; and the uppermost layer, which is known as the core layer, and
it serves as the network’s central point, i.e. the root of the tree from which all nodes
diverge. Figure 3.19 shows tree topology.
All nearby hosts are linked together via a point-to-point connection. Similar to the
bus topology, if the root fails, the entire network suffers. Despite the fact that it is
not the only point of failure, every link serves as a point of failure, and its failure
separates the network into inaccessible segments.
Hybrid topology
A hybrid topology is a network structure designed with more than one topology.
Hybrid topology inherits the benefits and drawbacks of all incorporated topologies.
Figure 3.20 shows the hybrid topology.
The combining topologies can have characteristics of the star, ring and bus
topologies. Most WANs are connected using Dual-Ring topology and the networks
that connect to them are largely Star topology networks. The Internet is the most
prominent example of a huge hybrid topology.
139
Student’s Book Form Six Tanzania Institute of Education (TIE)
140
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(a) No particular device is a client or a
(a) Peer-to-peer server; the tasks and responsibilities
(b) Client-server network of servers are distributed among
all the devices (which also act as
Peer-to-peer network architecture clients).
In this network, no server is used for (b)
This network architecture is
control; every node is itself a client inexpensive to set up as there is
and server. Each node can request and no requirement for a centralized
respond for the services and share server. It also ensures that, in case
resources. of any failure in the network, all
In peer-to-peer network architecture, unaffected devices continue to
individual devices are directly linked operate normally.
together and have equal obligations and (c) It is simple to set up and maintain
powers in the absence of any central because each computer runs
authority. Since no central device is in independently.
charge of tasks, this design is sometimes Disadvantages of peer-to-peer network
referred to as decentralized architecture.
Each computer has particular rights (a) No centralized system, thus difficult
for resource sharing. Nevertheless, to keep a backup of the data in case
if the computer with the resource is of any fault.
unavailable, this may cause problems. (b)
It has a security flaw because
This type of architecture is useful in a computers are self-managed.
small environment with few computers. (c)
With a growth in the number
Figure 3.21 shows how peer-to-peer of nodes on this network,
network architecture is connected. performance, security, and access
may all become more challenging.
141
Student’s Book Form Six Tanzania Institute of Education (TIE)
Classification of client/server
computing network architecture nodes are directly connected to a server
computer. This is the most popular
Depending on the number of servers and system used in many organizations, in
the storage media, client/server network which a client submits a request to a
architecture can be further divided into server and receives responses.
two types.
In other words, centralized architecture
(a) Centralized Client-Server is one of client/server architecture
Network architecture. having one powerful computer utilized
to service one or more low-powered
(b) Distributed Client-Server Network computers in centralized computing
architecture. architecture. The nodes under the
Centralised Client/Server computing centralized architecture are not linked;
architecture: Centralized network they are only connected to the server.
architecture is a client/server architecture Figure 3.23 shows the centralized
system in which one or more client computing architecture.
142
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
143
Student’s Book Form Six Tanzania Institute of Education (TIE)
144
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Basis of Client-server architecture Peer-to-peer
comparisons architecture
Focus area Information sharing Connectivity
Data Data are stored in the central server Each peer has its own
in the case of a centralized server, data
whereas, in the case of the distributed
server, data are stored on various
servers located on different sites
Implementation Expensive compared to a peer-to-peer Less expensive to
network implement
Differentiation Client and server are differentiated; Client and server are
specific servers and clients are not differentiated
presents
Stability More stable and scalable Less stable if the
number of peers
increases
Services The client request service from the Each node can do both
server and the server responds with requests and responses
a service for the services
Security More secure than a peer-to-peer It is less secure
network because the server can compared to a
authenticate a client’s access to any Client-server network
part of a network.
Performance Does not experience performance The increase in
problems with the increase of clients clients will affect the
since most of the heavy tasks are performance of the
carried by sever network
Reliability It is less reliable compared to It is more reliable
Peer-to-Peer
Access time for Multiple clients request services Service providing nodes
service from the server and therefore, access are distributed; for
time for service is high that reason, a service-
requesting note does not
need to wait long
145
Student’s Book Form Six Tanzania Institute of Education (TIE)
146
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Step 13: Find the device: Find the only analog data.
original device that the file was shared The primary function of the modem is to
from convert the digital signal into analog and
Step 14: Find the folder that was shared vice versa. A modem is a combination
of two devices modulator and a
Step 15: Open the folder to see the file
demodulator. The modulator converts
contained in it
digital data into analog data when
Step 16: Done the computer is sending the data.
The demodulator converts analog signals
Network devices into digital data when the computer
Network devices are physical hardware receives it.
that allows electronic devices to
communicate with each other. Examples Types of modem
of network devices include routers, The modem can be categorised in several
modems, Switches and Network ways depending on how it can transmit
Interface Cards (NIC). data, the type of connection to the
Modem: Modem is a device that enables transmission line, transmission mode,
a computer to send or receive data over etc. Figure 3.26 shows the modem and
telephone or cable lines. The data stored router connection.
Cable to PC
Cable to ISP
Wireless router
ISP
Socket
Cable to router PC
Moderm
Power cable
Power cable
Figure 3.26: Modem and router connection
147
Student’s Book Form Six Tanzania Institute of Education (TIE)
148
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
source station and the frame specifies together and have a dynamically
which route to follow. The host can updating routing table based on which
discover the frame by sending a special they make decisions on routing the data
frame called the discovery frame, which packets. The router divides the broadcast
spreads through the entire network using
domains of hosts connected through it. A
all possible paths to the destination.
router also strengthens the signals before
Switch: This network device uses a transmitting them; that is why it is also
packet switching technique to receive, called a repeater. Figure 3.31 shows the
store and forward data packets on the Wireless router.
network. The switch maintains a list
of network addresses of all the devices
connected to it. It is sometimes known
as an intelligent hub
Upon receiving a packet, it checks the
destination MAC address and transmits
the packets to the correct port. Before
forwarding, the packets are checked for
collision and other network errors. The
data is transmitted in full duplex mode. Figure 3.31: Wireless router
It forwards data based on the MAC
address. Routing Table: A router reads its routing
table to decide the best available
Data transmission speed in switches can
be double that of other network devices route the packet can take to reach its
like hubs used for networking. This is destination quickly and accurately. The
because a switch shares its maximum routing table may be of these two types:
speed with all the connected devices. Static − In a static routing table, the
This helps to maintain the network speed routes are fed manually. So, it is suitable
even during high traffic. In fact, higher only for very small networks with a
data speeds are achieved on networks maximum of two to three routers.
through the use of multiple switches.
Figure 3.30 shows the Switch with 24 Dynamic − In a dynamic routing table,
ports. the router communicates with other
routers through protocols to determine
free routes. This is suited for larger
networks where manual feeding may
not be feasible due to a large number of
routers.
Gateway: A gateway, as the name
Figure 3.30: Switch with 24 ports suggests, is a passage to connect two
networks together that may work upon
Routers: This is a device like a switch
different networking models. They
that routes data packets based on their
basically work as messenger agents that
IP addresses. The router is mainly
take data from one system, interpret
149
Student’s Book Form Six Tanzania Institute of Education (TIE)
A router is a networking
A Brouter is a networking device used both as
device that forwards data
1. a bridge and a router; it combines a network
packets between computer
bridge and a router.
networks.
150
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
This is the network adapter that is used Wi-Fi is the acronym for wireless fidelity.
to connect the computer to the network. Wi-Fi technology is used to achieve
The earliest network cards were external wireless connection to any network. A
to the system and needed to be installed Wi-Fi card is a card used to connect any
manually to establish a network. In device to the local network wirelessly.
modern computer systems, it is an The physical area of the network which
internal hardware component. provides internet access through Wi-
NIC has a unique ID (MAC address/ Fi is called a Wi-Fi hotspot. Hotspots
physical address) written on the chip, can be set up at the home, office or
and it has a connector to connect the public space. Hotspots themselves are
cable. The cable acts as an interface connected to the network through wires.
between the computer and the router or The wireless Network card is shown in
modem. NIC card is a layer 2 device that Figure 3.34.
works on the network in the physical
and data link layers.
Types of network card
There are two types of network cards
namely: Ethernet Card for Ethernet
connection and wireless network card
(Wi-fi) for wireless network connection.
Ethernet card: To establish a network
connection using wire, the device
should have an Ethernet card to support Figure 3.34: Wireless Network card
the connection. The NIC has an RJ45
socket where the network cable is A Wi-Fi card is used to add capabilities
physically plugged in. like teleconferencing, downloading
digital camera images, video chat, etc.,
Ethernet card speeds may vary
to old devices. Modern devices come
depending on the protocols it supports.
with their in-built wireless network
Old Ethernet cards had a maximum
adapter.
speed of 10 Mbps. However, modern
cards support fast Ethernets up to a speed
of 100 Mbps. Some cards even have a Networking models
capacity of 1 Gbps. This is generally There are two types of network models:
known as bandwidth speed. The Ethernet the OSI Model and the TCP/IP model.
Card is shown in Figure 3.33. This section will describe the concept
behind these models with respect to the
data transmission process in the network.
Open System Interconnection (OSI)
model
OSI, stands for Open System
Figure 3.33: The Ethernet card Interconnection, is a reference model
151
Student’s Book Form Six Tanzania Institute of Education (TIE)
152
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
and physical layers are implemented in layer and breaks it into “segments” on
hardware and software. The physical the transmitting end. It is responsible
layer is the lowest layer of the OSI for reassembling the segments on the
model and is closest to the physical receiving end, and turning them back into
medium. The physical layer is mainly data that the session layer can use. The
responsible for placing the data on the transport layer carries out flow control,
physical medium. sending data at a rate that matches
Functions of OSI layers the connection speed of the receiving
device, and error control, checking if
Layer 7-Application: The application data was received incorrectly; and, if
layer is used by end-user software such not, requesting it again. There are two
as web browsers and email clients. It main protocols under this layer.
provides protocols that allow application
software to send and receive data and (a) Transmission Control Protocol
present meaningful information to users. Transmission Control Protocol
A few examples of application layer is responsible for the systems to
protocols are the Hypertext Transfer communicate over the internet. It
Protocol (HTTP), File Transfer Protocol establishes and maintains a connection
(FTP), Post Office Protocol (POP), and between hosts when sending the
Simple Mail Transfer Protocol (SMTP). data. In order to send the data, the
Layer 6-Presentation: The presentation message to be sent will be divided into
layer prepares data for the application smaller units regarded as segments.
layer. It defines how two devices should During transmission, each segment is
encode, encrypt, and compress data to transmitted through multiple routers,
receive it correctly on the other end. once they reach the destination, TCP
The presentation layer takes any data reorders the packets in the correct order.
transmitted by the application layer and (b) User Datagram Protocol (UDP)
prepares it for transmission over the
session layer. User Datagram Protocol is a transport
layer protocol. It is an unreliable
Layer 5-Session: The session layer transport protocol since, in this
creates communication channels, case, the receiver does not send any
called sessions, between devices. It acknowledgement when the packet is
is responsible for opening sessions, received, and the sender does not wait
ensuring they remain open and functional for any acknowledgement. Therefore,
while data is being transferred, and this makes a protocol unreliable.
closing them when communication
ends. The session layer can also set Layer 3-Network: The network layer
checkpoints during a data transfer has two main functions. One is breaking
if the session is interrupted, devices up segments into network packets,
can resume data transfer from the last and reassembling the packets on the
checkpoint. receiving end. The other is routing
153
Student’s Book Form Six Tanzania Institute of Education (TIE)
154
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
155
Student’s Book Form Six Tanzania Institute of Education (TIE)
156
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
157
Student’s Book Form Six Tanzania Institute of Education (TIE)
158
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The Physical layer gets the bits, de-
referred as Bits. encapsulates them into frames, and
Protocol Data Unit (PDU): The sends them to the upper layer.
encapsulated data tends to attain The Data Link layer receives the frames
different names referred as Protocol and checks whether the MAC address
Data Unit when travelling into different matches or not. If everything is matched
layers, as shown in Table 3.8. and no error is found, the layer 2 header
Table 3.8: Protocol Data Unit and layer 2 trailers are removed. It de-
encapsulates the data and packet sent to
LAYER PDU the upper layer.
Application Data The Network layer receives the packet
Presentation Data from the Data Link layer and checks for
Session Data IP addresses. If it matches, the header
Transport Segments/Datagrams in layer 3 is removed. Now the de-
Network Packets encapsulated data packet is delivered to
the Transport layer.
Data Link Frames
Physical Bits Then, the Transport layer gets the data
segments/datagrams from the Network
De-encapsulation layer and removes the layer 4 header.
De-encapsulation is considered as the After travelling through Session,
opposite process of encapsulation. All Presentation, and Application layers,
information added during encapsulation the de-encapsulated data is sent to
is removed when travelling on the the recipient. That is how the de-
receiver’s side from the physical layer encapsulation takes place: Figure 3.37
to the application layer. data encapsulation and de-encapsulation.
The key difference between the TCP/IP computer, printer, switch, router, or any
model and the OSI model is that TCP/ other device that is part of a TCP/IP-
IP is simpler and combines several OSI based network.
layers into one layer. Other defferences It is also, an identifier since this address
are: is used to identify the device on a
(a)
OSI layers 5, 6, and 7 are combined network. It defines the technical format
into one Application Layer in TCP/ of the packets. Mainly, both network
IP. models, i.e., IP and TCP, are combined
together, so they are referred to as a
(b)
OSI layers 1, and 2 are combined
TCP/IP. It creates a virtual connection
into one Network Access layer in
TCP/IP. between the source and the destination.
(c)
TCP/IP does not take To facilitate the routing of packets, the
responsibility for sequencing and TCP/IP protocol uses a 32-bit logical
acknowledgement functions but addresses known as IPv4 (Internet
leaves these responsibilities to the Protocol version 4).
underlying transport layer. Types of IP Addresses
(d)
TCP/IP is a functional model There are two types of Internet Protocol
designed to solve specific addresses:
communication problems which
are based on specific standard (a) Internet Protocol version 4 (IPv4):
protocols. At the same time, OSI Currently used Internet Protocol version
is a generic protocol-independent (b) Internet Protocol version 6 (IPv6):
model intended to describe all It is an ongoing replacement for IPv4. It
forms of network communication. contains some significant improvements
(e)
In TCP/IP, most applications use and new features. In this section, IPv4
all the layers, while in OSI, simple will be covered in detail.
applications do not use all seven IP addressing scheme
layers. Only layers 1, 2, and 3
are mandatory to enable any data There are two types of addressing
communication. schemes which are: classful address and
classless address.
Internet Protocol (IP) addressing Classful addressing
Concepts of IP addressing This was the first addressing system
The Internet Protocol is the cornerstone implemented as part of the Internet
of the TCP/IP architecture. All computers Protocol. In 1981, the Classful
on the Internet understand IP. The main addressing network architecture was
tasks of IP are addressing the computers first used on the Internet. The Classful
and the fragmentation of packets. addressing system was superseded by
a Classless addressing scheme with the
160
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Routing (CIDR) in 1993.
where by n=number of host bits.
Classful addressing is a technique
n=32, therefore
that divides the IP addresses into five
categories. Number of addresses
= 232 = 4,294,967,296
Classful IPv4 address
The identifier used in the network layer The IPv4 produces 4,294,967,296
to identify each device connected to addresses, which is not enough for each
device connected to the internet on a
the Internet is the Internet address or
planet. However, various techniques
IP address. An IPv4 address is a 32-bit
were invented, such as variable-length
address that uniquely and universally mask, network address translation, port
defines the connection of a device (for address translation, classes, and inter-
example, a computer or a router) to the domain translation, to conserve the
Internet. It contains no functions for bandwidth of IP addresses and slow
end-to-end message reliability or flow down the depletion of an IP address. In
control. IP makes the ‘best effort’ to these techniques, public IP is converted
forward packets to the next destination into a private IP which the user having
but does not guarantee delivery because public IP can also use the internet. But
it is connectionless. still, this was not so efficient, giving
rise to the development of the next
IP Address categories generation (current generation) of IP
addresses (IPv6).
The IP address can be classified into two
categories: Internet Protocol version 6 (IPv6)
(a) Public address: This address is IPv6 is compatible with all other Internet
considered as any valid address assigned protocols, including TCP, UDP, and
ICMP.
to any user and the organization that is
responsible for registering IP ranges Main IPv6 features
called Internet Service Providers (ISPs), IPv6 is the next generation of IP
and this address will be unique. addresses. The main difference between
IPv4 and IPv6 is the address size of
(b) Private address: this address is IP addresses. IPv4 is a 32-bit address,
considered as any number or address whereas IPv6 is a 128-bit hexadecimal
assigned to a device on a private TCP/ address. IPv6 provides a large address
IP Local Area Network that is accessible space and contains a simple header
only within the Local Area Network. compared to IPv4. It provides transition
IPv4 is a 32-bit address which means strategies that convert IPv4 into IPv6,
that the maximum number of addresses and these strategies are as follows:
that can be supported can be calculated Dual stacking: It allows the user to have
from this formula: both versions, i.e., IPv4 and IPv6, on the
same device.
161
Student’s Book Form Six Tanzania Institute of Education (TIE)
162
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Dotted-decimal notation: This is is 255.255.0.0
the format that is typically used for Class C: Allows 2 million networks,
displaying the IP address in a human- 254 hosts each
readable format. An example of dotted- The IP address starts from 192.0.0.0 to
decimal notation is 192.168.1.100 223.255.255.255, and the mask address
Classful IPv4 Address classes is 255.255.255.0
Different networks have different Class D: Multicast networks, the IP
sizes. There are many small and large address begins from 224.0.0.0 to
networks. To provide efficient use of 239.255.255.255.
32-bit address space, IPv4 is used to Class E: Reserved for future use.
define several address classes and their From 240 to 255, the 255.255.255.255
associated address formats, which are: broadcasts to all the subnets.
Class A: Allows 128 networks, 16 One of the benefits of classful addresses
million hosts each is that they provide a hierarchy to the
The IP address starts from 1.0.0.0 to network through the use of the network
127.255.255.255, and the mask address ID. This translates into an efficient
is 255.0.0.0 routing environment because it is easy
Class B: Allows 16,382 networks, for a router to determine what networks
65,534 hosts each can be grouped and treated as a single
routing entry. Table 3.9 shows the five
different IP address classes.
0.0.0.0- 224 – 2 27
Class A 0 – 27 0XXXXXXX 27.255.255.255 255.0.0.0
192.0.0.0– 28 – 2 221
Class C 192- 223 110XXXXX 223.255.255.255 255.255.255.0
Class D 224 - 239 224.0.0.0-
1110XXXX 239.255.255.255
(Multicast)
Class E 240-255 240.0.0.0-
1111XXXX 255.255.255.255
(Experimental)
163
Student’s Book Form Six Tanzania Institute of Education (TIE)
Several strategies have been developed (b) Port Address Translation (PAT)
and implemented to help the Internet
community manage IP addresses Port Address Translation (PAT) is
well. These strategies help to reduce another technique to convert a private
the load on Internet routers and help address to a public one. During PAT,
administrators use globally unique IP each computer on LAN is translated to
addresses more efficiently. There are the same IP address (public) but with
two common strategies, which are: a different port number assignment.
This way is much better than the NAT
(a) Private Addressing because we can use one public address
(b) Classless Inter-Domain Routing to translate any private address, saving
(CIDR) costs. Table 3.10 shows the process of
the PAT.
Private address
Table 3.10: Example of PAT process
If the internetwork is limited to one
organization, the IP addresses must be Private Port Public Port
unique within that organization. Only Address Address Address Number
networks that interface with public 192.68.1.3 50133 200.0.1.2 1
networks, such as the Internet, need 192.68.1.5 63887 200.0.1.2 2
public addresses. Using public addresses
on the outside and private addresses for The port address will be any random
inside networks is very effective. number in the allowed range the device
According to RFC1918, there are three creates when it wants to access the
ranges of IP addresses as private: internet.
In class A: The packet will contain the port number
10.0.0.0 through 10.255.255.255 assigned to the device that wants to
In class B: access the internet, and through this
172.16.0.0 through 172.31.255.255 port number, the router, when it gets the
In class C: response message, will translate it and
map this message to its private address
192.168.0.0 through 192.168.255.255
on the port number.
There are two ways to convert a private
Addressing without subnet
address to a public address:
If we have a class B with a Flat Network,
(a) Network Address Translation (NAT)
the number of hosts will be more than
This technique converts the private
216=65,536. So, the problem comes
address to a public address, and the
here as managing this network with this
NAT allows us to access the internet
number of hosts is too tricky, and this
and get services. The basic idea is that
network’s performance will decrease
the technique uses a pool of public
because of the heavy load. In other
addresses and assigns one public address
words, any single broadcast can slow
for each private address. Thus, this way
down the network.
is inefficient because there are costs and
164
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
the single network into multiple independent parts for internal use but
networks that can reduce the loading still act like a single network to the
from one network. outside world. In the Internet literature,
The advantages of using subnetting are: these parts are called subnets.
(a) Reduces the traffic and increases Subnet masks
the performance A mask is a 32-bit binary number
(b) The smaller network can be easier expressed in dotted decimal notation. By
to manage default, a mask contains two fields, the
network field and the host field. These
Classful address subnetting correspond to the network number
As the number of distinct local networks and the locally administered part of the
grows, managing them becomes a serious network address. When an administrator
challenge. Every time a new network subnets, they adjust the way they view the
is installed, the system administrator IP address. The default masks for classful
must contact NIC to get a new network addressing are shown in Table 3.11.
number.
Routers and hosts still assume class subnet masks by default as shown in Table 3.12.
Table 3.12: Default subnet mask
Class Subnet mask prefix The subnet mask in dot notation
Class A /8 255.0.0.0
Class B /16 255.255.0.0
Class C /24 255.255.255.0
Three important things that should be taken into consideration when we are thinking
about subnetting are network address, broadcast address, and host addresses
165
Student’s Book Form Six Tanzania Institute of Education (TIE)
166
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
In a Class C address, only 8 bits are
available for defining the hosts whose subnet will be:
subnet bits start at the left and go to the 26-2 = 62
right without skipping bits. This means Find the valid subnets: 256 – 192 = 64;
that the only Class C subnet masks are remember, we always start from 0 and
the following: count in our block size, so our subnets
are: 0, 64, 128, and 192.
167
Student’s Book Form Six Tanzania Institute of Education (TIE)
168
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(a) Transmission rate
(b) Cost and ease of installation
(c) Resistance to environmental conditions
(d) Distances
Transmission modes
169
Student’s Book Form Six Tanzania Institute of Education (TIE)
170
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
CAT3 16MHz >=10Mbps 100 UTP RJ-45 10-BASE-T
Ethernet
Token ring
CAT4 20MHz >=20Mbps 100 UTP RJ-45
network
Ethernet, token
CAT5 100MHz >=100Mbps 100 UTP RJ-45 ring, Fast
Ethernet
Ethernet, Fast
Ethernet,
CAT5e 125MHz >=1Gps 100 UTP. RJ-45
Gigabit
Ethernet
Gigabit
STP/ Ethernet
CAT6 250MHz >=10Gbps 100 RJ-45
UTP and 10Gbit
Ethernet
Gigabit
UTP/ Ethernet
CT6a 500MHz >=10Gbps 100 RJ-45
STP and 10Gbit
Ethernet
GigaGate45 Gigabit
(GG45) Ethernet
CAT7 600MHz >=10Gbps 100 STP
and RJ-45 and 10Gbit
Ethernet
GG45 / 10Gbit
CAT7a 1000MHz >=100Gbps 100 STP
RJ-45 Ethernet
GG45/ RJ- 25Gbit
45 Ethernet
CAT8 2000MHz 25/40Gbps 30 STP
and 40GBit
Ethernet
(b) Very easy to set up and install (c) Not ideal for long distance
communications due to the
(c) It is a flexible and cheap option for
attenuation.
the physical transmission media
171
Student’s Book Form Six Tanzania Institute of Education (TIE)
172
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Coaxial cables are categorized based on their Radio Government (RG) ratings.
Each RG number denotes a unique set of physical specifications, including the wire
gauge of the inner conductor, the thickness and the type of the inner insulator, the
construction of the shield, and the size and type of the outer casing. Each cable
defined by an RG rating is adapted for a specialized function as shown in Table 3.14.
Table 3.14: The most common coaxial standards.
50-Ohm RG-7 or RG-11 used with thick Ethernet
50-Ohm RG-58 used with thin Ethernet
75-Ohm RG-59 used with cable television
93-Ohm RG-62 used with ARCNET
173
Student’s Book Form Six Tanzania Institute of Education (TIE)
(d) They can span to a longer distance The 10Base-2 or Thin Ethernet uses RG-
at higher speeds as they have 58 coaxial cable with BNC connectors
better shielding when compared to to transmit data at 10Mbps with a range
twisted pair cable of 185M.
(e) It has high-speed data transmission Fibre optic cable
(f) Better noise reduction compared to Fibre optics cable is made of glass and
twisted pair cable data transmission is based on the concept
(g) It supports high bandwidth. of reflection of light through glass. In
fibre optic cable, the optical fibres are
Disadvantages of coaxial cables coated in plastic. These optical fibres
(a) They are more expensive than a send the data by pulses of light. The
twisted pair cables plastic coating protects the cable from
(b) Single cable failure can result in temperature, electromagnetic inference,
the entire network failure and other wiring issues. Figure 3.44
(c) Difficult to install and costly when shows the fibre optic cable components.
compared to twisted pair
(d) If the shield is imperfect, it can lead Components of a fibre optic cable
to a grounded loop. Core: The core of the fibre optic cable
Applications of coaxial cable contains optical fibres and is responsible
Coaxial cable was widely used in analog for data transmission in the form of light
telephone networks, where a single pulses.
coaxial network could carry 10,000 Cladding: The core is enclosed in a layer
voice signals. Cable TV networks also of glass, which is called cladding. The
use coaxial cables. In the traditional main use of cladding is to reflect the light
cable TV network, the entire network so that the light can be transmitted from
uses coaxial cables. Cable TV uses RG- the source to the destination through
59 coaxial cable. reflection.
In traditional settings, coaxial cable it Jacket: The jacket is the outer layer of
is used in the Ethernet LAN. Due to its fibre optic cable made up of plastic, and
high bandwidth, consequence and high the whole purpose of the jacket is to
data rate, coaxial cable was chosen for protect the cable.
174
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Multimode: Multiple light sources move (a)
It requires skilled people to
through different paths inside the coaxial administer, install and maintain.
cable. Multiple data transmission is done (b) Optical fibres are unidirectional for
simultaneously. two-way communication; so two
Single-mode: Light moves in a single fibres are required.
path close to the horizontal of the cable. (c) It is too expensive to deploy.
Advantages of fibre optic cable (d) Fibre optics cables are fragile, i.e.,
(a) The fibre optic cable supports high they are easier to break than wires.
bandwidth compared to the copper
cables. Thus, it transfers more data Applications of Fiber Optic Cable
compared to the copper cables. (a) Often found in backbone networks
(b)
Since the data is transmitted in because its wide bandwidth is cost-
the form of light, the transmission effective.
speed is very high. (b) Some cable TV companies use a
combination of optical fibre and
(c) The fibre optic cable can be used coaxial cable, thus creating a hybrid
for more extensive distance data network.
transmission than copper wires
cable. (c) Optical fibres are now used in
telephone systems
(d) It is more reliable than copper cables
(d) Used in the Local Area Networks
as the core is protected against
temperature and electromagnetic
disturbances. Unguided transmission media
Unguided media does not use a
(e) It is durable
physical medium to transmit the data
(f) It is lightweight from source to destination. This type
of communication is often referred to
(g) It is resistant to corrosive materials
as wireless communication. Unguided
(h)
Fibres do not leak light and are media uses air as a transmission medium
quite difficult to tap to transfer data. Thus, it is called wireless
transmission media. The unguided
(i) There is no cross-talk problem in
media uses an antenna for transmitting
optical fibres
and receiving the data in the form of
(j) Optical fibres cost lower than electromagnetic waves. Figure 3.45
cables with metallic conductors shows the part of the electromagnetic
spectrum, ranging from 3 kHz to 900
THz, used for wireless communication.
175
Student’s Book Form Six Tanzania Institute of Education (TIE)
176
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(a) Microwave transmission
wider sub-bands can be assigned,
(b) Radio transmission and a high data rate is possible.
(c) Infrared transmission (d)
Use of certain portions of the
Microwave transmission band requires permission from
Electromagnetic waves having authorities.
frequencies between 1 and 300 GHz
are called microwaves. Microwaves Antenna for Microwaves
are unidirectional. When an antenna
transmits microwaves, they can be Microwaves need unidirectional
narrowly focused. This means that antennas that send out signals in one
the sending and receiving antennas direction. Two types of antennas are
need to be aligned. The unidirectional used for microwave communications:
property has an obvious advantage. A Parabolic Dish and Horn.
pair of antennas can be aligned without A parabolic antenna: It works as a
interfering with another pair of aligned funnel, catching a wide range of waves
antennas. and directing them to a common point. In
Characteristics of microwaves this way, more of the signal is recovered
propagation than would be possible with a single-
point receiver.
(a)
Microwave propagation is line-
of-sight since the towers with A horn antenna: It looks like a huge scoop.
the mounted antennas need to be Outgoing transmissions are broadcast
in direct sight of each other, and up a stem and deflected outward in a
towers that are far apart needed to series of narrow parallel beams by the
be very tall. curved head. Received transmissions
are collected by the scooped shape of
(b)
Very high-frequency microwaves the horn, like the parabolic dish, and are
cannot penetrate walls. This deflected down into the stem as shown
characteristic can be a disadvantage in Figures 3.47(a) and (b).
if receivers are inside the buildings.
177
Student’s Book Form Six Tanzania Institute of Education (TIE)
Due to their unidirectional properties, microwaves are very useful when unicast
(one-to-one) communication is needed between the sender and the receiver. They
are used in cellular phones, satellite networks, and wireless LANs. There are two
types of microwaves transmission;
(i) Terrestrial Microwave Transmission
(ii) Satellite Microwave Transmission
Terrestrial type microwave transmission
In this type of microwave transmission, both the sender and receiver antennas are in
direct sight of each other. Repeaters can be installed with each antenna to increase
the distance served by terrestrial microwaves. The signal received by an antenna
can be converted into transmittable form and relayed to the next antenna. It is an
example of telephone systems all over the world. Figure 3.48 illustrates terrestrial
microwave transmission.
178
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
line of sight and the signal requirement
makes it even more challenging to
implement.
Advantages of terrestrial type
microwave transmission:
(a) It is cheaper than cable transmission
(b)
Possible to implement in areas
where cable transmission is difficult
to implement, such as hill areas.
Disadvantages of terrestrial type
microwave transmission: Figure 3.49: Satellite microwave
transmission
(a) Not secure, susceptible to
eavesdropping, Features of satellite microwave
transmission
(b) Weather conditions can affect the
transmission, (i) Bandwidth capacity depends on the
frequency used.
(c) Limited bandwidth,
(ii)
Satellite microwave deployment
Satellite microwave transmission for orbiting satellites is difficult.
This is a microwave relay station that Advantages of satellite type transmission:
is placed in outer space. The satellites (a)
The transmitting station can
are launched either by rockets or space receive back its transmission and
shuttles carrying them. check whether the satellite has
These are positioned at 36000Km transmitted information correctly.
above the equator with an orbit speed (b) The transmission can be done over
that exactly matches the earth’s rotation long distances
speed. As the satellite is positioned in a
geo-synchronous orbit, it is stationary (c)
Unlike terrestrial transmission,
relative to the earth and always stays where the implementation cost goes
over the same point on the ground. This is higher based on the transmission
usually done to allow ground stations to distance, satellite communication is
aim the antenna at a fixed point in the sky. unaffected by the data transmission
distance.
This type of communication uses the
satellite antenna for communication. (d) Easy to install compared to
The sender antenna sends the signal terrestrial type
to the satellite antenna that revolves Disadvantages of satellite type
around the earth at a known height. transmission
The satellite antenna then amplifies
(a) Installation of the satellite is
the received signal and sends it to the
extremely tough.
179
Student’s Book Form Six Tanzania Institute of Education (TIE)
180
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(c) It cannot penetrate walls, so difficult to suit his purpose. Give the
to establish communication between consequences that Makame
two different walls. will encounter for using these
antennas in transmitting data
over a long distance.
Infrared Applications.
2. Describe Infrared and Radio waves
The infrared band, almost 400 THz, transmission mechanism
has an excellent potential for data
transmission. Such a wide bandwidth 3. Explain how to set terrestrial antenna
can be used to transmit digital data with for microwave transmission.
a very high data rate. 4. With the aid of a diagram, explain
The Infrared Data Association (IrDA), how the horn antenna works.
an association sponsoring infrared 5. How parabolic antenna differ from
waves, has established standards for horn antenna?
using these signals for communication 6. Describe the types of propagation
between devices such as keyboards, modes.
mice, PCs, and printers.
7. Describe the components of fibre
Infrared signals can be used for short- optic cable.
range communication in a closed area
using line-of-sight propagation.
Wireless network
Exercise 3.4
Concepts of wireless network
1. Makame wants to make business
Wireless means the media made up of
on data communication. He wants
to establish a communication electromagnetic waves (EM Waves) or
centre that will enable customers to infrared waves without a wire. Antennas
send data over both short and long or sensors will be present on all wireless
distance. How would you describe devices. Cellular phones, wireless
the classification of transmission sensors, TV remotes, satellite dish
media to him? receivers, and laptops with WLAN cards
are all examples of wireless devices. A
(a) What are factors would you wireless network uses radio frequency
advise him to consider in
waves rather than wires for data or voice
the selection of transmission
communication. Installation of wireless
medium?
networks, particularly WLANs, can
(b)
Makame has already bought bring convenience and accessibility,
the terrestrial antenna that allowing businesses to gain maximum
he want to install for long mobility and flexibility around the office
distance communication. or at home.
181
Student’s Book Form Six Tanzania Institute of Education (TIE)
182
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Table 3.16 provides an overview of the different types of wireless networks.
Table 3.16: Wireless network types
183
Student’s Book Form Six Tanzania Institute of Education (TIE)
184
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The wireless access controller takes
the bandwidth produced from a router re-configure their power and channel
and stretches it to fit the network’s settings. If an AP goes down, it can
needs. Similar to an amplifier in a instruct nearby APs to increase their
stereo system, the wireless controller power levels to fill the coverage gap.
allows devices from farther distances to
Wireless repeater
connect. Besides, it enables the network
A Wi-Fi repeater or extender is used to
administrators to check all the network
extend the coverage area of your Wi-
data and detect rogue access points and
Fi network. It works by receiving your
recent traps generated by the access
existing Wi-Fi signal, amplifying it, and
points.
transmitting the boosted signal. With
Benefits of a wireless LAN controller a Wi-Fi repeater, you can effectively
Secured wired and wireless network: double the coverage area of your Wi-
Controlling wireless users’ access Fi network - reaching far corners of
privileges using a variety of deterministic your home or office, different floors,
criteria (including authentication method, or even extending coverage to your
device type and the application yard. Figure 3.52 shows the wireless
requested) to provide differentiated repeater.
access for maintaining security.
Centralized and flexible network
management: Centralised wireless
controller provides flexibility for
deployment, which will reduce the
overall budget, planning tools, and time
spent to organize a wireless network in
the business. They enable the centralised
monitoring of the entire wireless
infrastructure which decreases the total
cost of ownership and unification of
wired and wireless access, a future-
proofing investment for upgrades.
Simplified network maintenance: Figure 3.52: Wireless repeater
Wireless LAN controllers eliminate
site surveys by including intelligent Wired and wireless computer networks
RF planning software. The self- comparison
configuring and self-healing wireless
network is better for management There are differences between wired and
and troubleshooting. It can accurately wireless computer networks. Table 3.17
locate and identify each user. Due describes the differences between wired
to the RF nature, the wireless access and wireless networks.
185
Student’s Book Form Six Tanzania Institute of Education (TIE)
186
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
MUX and DEMUX. Their primary use called a digital multiplexer.
is in the field of communications. Multiplexer types
Multiplexers are classified into four types:
(i) 2-1 multiplexer (1select line)
(ii) 4-1 multiplexer (2 select lines)
(iii) 8-1 multiplexer (3 select lines)
Figure 3.53: Multiplexing and
(iv) 16-1 multiplexer (4 select lines)
De-multiplexing
The multiplexer is a combinational
Multiplexer and De-multiplexer
circuit with 2nd input signal lines and
Multiplexer: The multiplexer is a device a single output line. For example, 4 -1
with multiple inputs and single line multiplexer has 4 input data lines and
output. The select lines define what input 1 output line. The 8 -1 multiplexer has
is connected to the output and increase 8 input data lines and 1 output line, as
the data sent over a network at a given in Figure 3.55. The multiplexer is used
time. Also, it is called a data selector. for the multiplexing technique as it
Figure 3.54 shows a multiplexer. combines multiple signals and produces
a single output signal.
187
Student’s Book Form Six Tanzania Institute of Education (TIE)
188
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
to the de-multiplexer at the control input
registers. The output of the ALU can be to sense the data signal de-multiplexer’s
stored in multiple registers. output. When all data signals are
Serial to parallel converter: The serial stored, the output of the de-multiplexer
to parallel converter is used to reform can be read out in parallel. Table 3.18
parallel data. This method gives serial summarise the difference between the
data as input to the de-multiplexer at multiplexer and the de-multiplexer.
189
Student’s Book Form Six Tanzania Institute of Education (TIE)
There are mainly two types of multiplexing techniques, namely analog and digital.
They are further divided into Frequency Division Multiplexing (FDM), Wavelength
Division Multiplexing (WDM), and Time Division Multiplexing (TDM) as it is
illustrated in Figure 3.57.
Multiplex Techniques
Analog Digital
Analog multiplexing
Advantages of frequency division
The signals used in analog multiplexing
multiplexing
techniques are analog in nature. The
analog signals are multiplexed according (a) It doesn’t require synchronization
to their frequency or wavelength. between the sender and receiver.
Frequency division multiplexing: (b) It is simple, easy to implement and
The most used technique is FDM in a less expensive technique.
analog multiplexing. This technique (c) FDM is a reliable system compared
uses various frequencies to combine to other multiplexing systems.
data streams, for sending them on a (d) This technique is mainly used for
communication medium as a single analog signals.
signal.
(e)
This technique allows a large
For example, a traditional television number of signals to be transmitted
transmitter, which sends several simultaneously over a single
channels through a single cable, uses transmission medium.
FDM.
190
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(a) FDM suffers from interference different wavelengths into a single light
caused by electromagnetic signals, for communication.
generally referred as cross talk. Digital multiplexing
(b) FDM provides less throughput. The term digital represents discrete bits
Throughput is the rate of of information. Hence, the available
successful message delivery over a data is in the form of frames or packets,
communication channel. which are discrete.
(c) FDM doesn’t utilize the full Time-division multiplexing: In TDM,
bandwidth of the transmission the time frame is divided into slots. This
medium. technique is used to transmit a signal
(d) FDM requires a significantly large over a single communication channel,
number of modulators and filters to by allotting one slot for each message.
transmit multiple signals. TDM can be classified into Synchronous
(e) Unlike TDM, FDM needs a carrier TDM and Asynchronous TDM.
signal to transmit multiple signals. Synchronous TDM: In synchronous
Wavelength division multiplexing: WDM TDM, the input is connected to a frame.
is an analog technique in which many If there are ‘n’ number of connections,
data streams of different wavelengths then the frame is divided into ‘n’ time
are transmitted in the light spectrum. If slots. One slot is allocated for each input
the wavelength increases, the frequency line.
of the signal decreases. A prism, which In this technique, the sampling rate is
can turn different wavelengths into a common for all signals, and hence the
single line can be used at the output of same clock input is given. The MUX
MUX and input of DEMUX. allocates the same slot to each device at
Advantages of wavelength division all times.
multiplexing Asynchronous TDM: In asynchronous
(a) Easy to implement TDM, the sampling rate is different
(b) Full duplex transmission is possible for each signal, and a common clock is
in WDM not required. If the allotted device for a
(c) Provides better security of data time slot transmits nothing and sits idle,
(d) WDM provides higher bandwidth then that slot can be allotted to another
device, unlike synchronous
Disadvantages of wavelength division This type of TDM is used in asynchronous
multiplexing transfer mode networks.
(a) Transmitted signals cannot be very The following are common examples of
close to each other
time-division multiplexing applications:
(b) WDM is more expensive compared
to FDM (a) It is used in a type of telephone line
that uses Integrated Services Digital
(c) It is difficult to fine-tune wavelength Network (ISDN) technology.
in the WDM technique
191
Student’s Book Form Six Tanzania Institute of Education (TIE)
192
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
1. Data refers to the raw facts that
is substantial. To maintain adequate are collected, such as text, image
signal transmission and reception, and symbols, while information
the transmitter and receiver com- refers to the processed data that
ponents must be correctly and con- are meaningful to the person who
sistently synchronised. receives it, which enables us to take
a decision. Data communications
Exercise 3.5 are the exchange of data between
two devices via a transmission
1. Describe the types of multiplexing medium such as a wire cable and
techniques. wireless (bound and unbound
medium). A data communications
2. Give an example of multiplexing
system must transmit data to
in a real, non-computer-related
the right device accurately and
system. Is the multiplexing
promptly. The five components that
centralised or distributed? Why?
make up a data communications
Give reasons. system are: message, sender,
3. Give the applications of a receiver, medium, and protocol.
multiplexer. Text, numbers, images, audio,
4. What kind of network traffic is and video are different forms of
suited to synchronous time-division information.
multiplexing? 2. Data communication systems can
perform different tasks such as
signal generation, interface, data
synchronization, error detection
and correction, flow control,
ctivity 3.5: Identification of
A addressing and routing.
multiplexer and demultiplexer
devices. 3. The process for sending data
between two devices connected
Resources: internet or library resources, over a network is referred to as
Procedures: transmission or communication
(a) Visit internet or library modes. These modes are classified
based on the number of wire
(b)
Search for multiplexers and connections and number of bits sent
demultiplex devices simultaneously, such as parallel
(c) From your search, identify any four and serial transmission; based on
synchronization and time control,
devices on each
such as asynchronous, synchronous
(d) Describe the roles each identified and isochronous; based on the
devices and its communication direction of signal flow or direction
mechanism of exchange of the information
such as simplex, half-duplex and
full-duplex.
193
Student’s Book Form Six Tanzania Institute of Education (TIE)
194
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
combining multiple signals into
classified as: Wireless Personal one signal over a shared medium.
Area Network (WPA); wireless There are mainly two types of
local area network (WLAN); multiplexing techniques, namely
wireless ad hoc network (MANET); analog and digital. They are further
Wireless MAN, Wireless WAN, divided into Frequency Division
and cellular network. The main
Multiplexing (FDM), Wavelength
elements of wireless networks
Division Multiplexing (WDM),
are wireless access point (WAP),
wireless repeater, wireless router, and Time Division Multiplexing
wireless network card, wireless (TDM). Multiplexers are used in
controller etc. communication systems, computer
memory and telephone network and
12. Some factors must be considered
when choosing a wired or wireless transmission from the computer
network: network coverage using satellite multiplexers. De-
requirements, network mobility, multiplexer is used on the receiving
security, compatibility issues and side to generate multiple signals
the number and types of users. from the received signal.
PROJECTS
Project 1: Ethernet cable construction and testing
Things to note
The making of the cable will depend on the purpose of the intended cable, whether
for the same device connection, different device connection or configuration.
Straight-through cable: Is used to connect a different device such as a computer to
switch, switch to router and switch to hub.
Crossover cable: Is used to connect the same device, such as computer to computer,
switch to switch, router to router etc.
Rollover: Rollover cables, sometimes called Yost cables, are most commonly used
to connect to a device’s console port to make programming changes to the device.
The two standards for wiring Ethernet cables are T568A and T568B. The
T568B is the most common and is the one you will be using for your Ethernet
cable. Table 3.62 shows the proper orientation of the coloured wires to the
pins.
Requirements
(i) Unshielded twisted pair (UTP) cable (length of the cable will depend on your
application area)
(ii) Modular connector (8P8C plug, also known as RJ45)
195
Student’s Book Form Six Tanzania Institute of Education (TIE)
Step 4: Cut the wires as straight as possible, about 0.5 inches above the end of the jacket.
Step 5: Carefully insert the wires into the modular connector, ensuring that each
wire passes through the appropriate guides inside the connector.
Step 6: Push the connector inside the crimping tool and squeeze the crimper down.
Step 7: Repeat steps 1-6 for the other end of the cable.
Step 8: To make sure you’ve successfully terminated each end of the cable, use a
cable tester to test each pin.
196
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
197
Student’s Book Form Six Tanzania Institute of Education (TIE)
198
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
you choose TCP, and when would
you use UDP? In responding used to look up the corresponding
to this question, you might be IP addresses of host names such
as www.cl.cam.ac.uk which
interested in considering example
originally. used UDP only. Suggest
cases such as: why DNS might have been
(a)
Fast transactions (where designed based on UDP rather than
TCP.
you want to send a short
notification to another system 23.
Recently, the internet has started
to deploy DNSSEC (DNS Security
with minimal latency)
extensions), which involves
(b) Bulk data transfers transmitting cryptographic
signatures and DNS data. These
(c)
Timeliness (suppose data is signatures are sometimes multiple
being output from a sensor at kilobytes in size. Why might this
one sample per second, and motivate the use of TCP rather than
the receiver needs to have UDP for DNS?
the most recent value of the 24.
Discuss bounded and unbounded
sensor’s reading rather than transmission media.
all values, i.e. the receiver 25. What are the factors to be considered
should get the current value in choosing transmission media?
rather than an outdated value) 26.
For each of the following four
networks, discuss the consequences
21.
UDP provides very few features if the connection cable fails.
above those provided by IP, and is (a)
Five devices arranged in a
used by applications which do not mesh topology
require TCP’s reliability and flow (b) Five devices arranged in a star
control (e.g. live video streaming). topology
Why can such an application not (c) Five devices arranged in a bus
just opt to use IP directly without a topology
transport layer protocol? (d)
Five devices arranged in a
ring topology
199
Student’s Book Form Six Tanzania Institute of Education (TIE)
Chapter
Four Visual programming
Introduction
200
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
components requires a lot of code, (c)
The developer may quickly
visual programming offers a significant progress in writing code without
productivity boost to programmers. learning the syntax of the entire
Examples of visual programming programming language. This
languages results to graphic representation of
the entire design process.
Not all programming languages are
visual in nature, but visual programming (d)
Visual programming enables
capabilities can be added to any text- developers to test several new ideas
based programming language. For at a rapid speed, and are comfortable
example, the Basic programming to its graphical presentation flow,
language is text-based; when visual ease of use, and traceability.
programming capabilities were added (e)
Visual programming offers the
to the language it became to be known users the ability of programming
as Visual Basic. Similar capabilities are without the necessity to learn code.
available in languages such as C++, (f)
With visual programming, users
Java, and Python. Visual programming links the outputs of one segment
capabilities are usually added to a to inputs of another, creating a
programming language by means program that moves from segment
of software libraries together with to segment by connectors more
integrated development environments easily.
(IDEs), for example the .NET (Visual
(g) Visual programming languages are
Basic), QT (C++), Swing (Java), and
easier to learn and use.
PyQT (Python) libraries used in different
IDEs to add visual programming
capabilities in the respective languages.
Visual Basic .NET and the .NET
This chapter is based on Visual Basic
Framework
.NET (VB. NET), a visual programming This section discusses the VB. NET
language that is based on the .NET programming language and the .NET
framework. framework on which it relies for most of
its functionality.
Importance of visual programming
Visual Basic .NET
Visual programming has the following
importance: The concept of Visual Basic .NET
(a)
Visual programming is most Visual Basic .NET is a modern object
useful when the consideration is oriented programming language
in speed, automation, and ease of developed by Microsoft. The language
programming. is based on the .NET framework and
was introduced in 2002 as a successor
(b)
The user interface are designed
to the Visual Basic 6 programming
very quickly, using a mouse. The
language. In addition to object-oriented
components are placed on the main
201
Student’s Book Form Six Tanzania Institute of Education (TIE)
202
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(g)
Visual Basic .NET allows implement and make available
connecting one application to to programmers commonly used
another created in the same programming functionality such as
language to run on the .NET creating GUI components, working
framework. with databases, and web programming.
The .NET framework provides a
(h)
You can connect your applications platform for developing desktop, mobile
to other applications created in and web applications using different
languages that run on the .NET programming languages such as VB, C#
framework. (reads C sharp), and F# (reads F sharp).
Disadvantages of VB.NET To use the .NET framework for
The following are some disadvantages developing software you will need to
of VB.NET: install the .NET Developer Pack on your
computer. You will also need to install
(a)
It contains a large collection of an IDE to use in your development
libraries which holds a vast space work. Microsoft provides an excellent
in the system that takes more IDE, Visual Studio (VS) 2022, for this
computing time during compilation. purpose. VS 2022 comes bundled with
(b)
It reduces jobs in the programming the .NET framework, so if you install
field as a VB.NET programmer it you will not need to install the .NET
because it is easy to learn resulting framework separately.
to more skilled programmers in the
market. Components of .NET framework
(c)
The computer needs a JIT compiler The .NET Framework is composed of
to interpret the Intermediate the following components:
Language source program, which (a)
.Net Framework Class Library:
requires an additional CPU cycle It consists of a huge library of
that degrades the performance of reusable types; the interfaces,
an application. classes, structures, and enumerated
(d)
It requires a lot of programming, values, together called types.
and it is not easy to manage every (b)
Common Language Runtime or
address by a pointer, resulting in CLR: It is responsible for memory
additional coding, which takes management, debugging, code
more CPU cycles, and increases execution, code safety, exception
processing time. Hence, slows the handling, thread execution,
VB.NET application. security checking, verification,
and compilation. It converts the
The .NET framework program into native code. It acts as
Introduction to .NET framework an interface between the framework
and operating system.
.NET is a software framework that
203
Student’s Book Form Six Tanzania Institute of Education (TIE)
any window displayed in the the user interface and the business
application. logic. It helps in developing
(d)
ASP.NET and ASP.NET AJAX: It visually stunning interfaces using
is used to develop websites, web media, documents, animations,
applications, and web services. 2-D and 3-D graphics, and others.
It provides a strange integration (j)
Windows CardSpace: It provides
of HTML, CSS, and JavaScript. safety for accessing resources and
It contains AJAX, an extension sharing personal information on
for developing and implementing the internet.
AJAX functionality. ASP.NET (k)
Windows Workflow Foundation
AJAX contains the components (WF): It used in building workflow-
that allow the developer to update based applications in Windows.
data on a website without reload It consists of activities, workflow
the page completely. designer, workflow runtime, and a
(e)
ADO.NET: It is the technology rules engine.
used for working with data and (l)
Windows Communication
databases. It provides access to Foundation (WCF): It is the
data sources like SQL server, OLE technology for developing and
DB, XML etc. The ADO.NET executing connected systems. It is
allows connection to data sources a framework for building service-
for retrieving, manipulating, and oriented applications. It can assist
updating data. in sending data as asynchronous
(f)
Common Language Specification: messages from one service
It contains the specifications for endpoint to the next.
the .Net supported languages
and implementation of language Features of .NET framework
integration. .NET Framework contain several
(g)
Common Type System: It provides features, which make it better, and more
guidelines for declaring, using, and ease to modern programming activities.
managing types at runtime, and The following list describes .NET
cross-language communication. Framework main features:
(h)
Metadata and Assemblies: Metadata (a) Interoperability: Normally,
is the binary information describing interaction between new and
the program, which is either stored old applications is required, so,
in a portable executable file (PE) .NET Framework provides a
or in the memory. Assembly is way to access features that are
a logical unit consisting of the implemented in programs that run
assembly manifest, type metadata, outside the .NET environment.
IL code, and a set of resources like (b)
Support Multi languages: The .
image files. NET has a Common Type System
204
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
supported and provides the means functions to allocate and deallocate
how they interact with each other. the memory used by objects
This allows .NET to support during runtime. This removes the
multiple application development developer’s burden of managing
programming languages, including memory.
C#, or Visual Basic. (g)
Deployment made easy: When it is
(c) Portability: Applications written time for application deployment,
using .NET language are portable. depending on the desired
That means that when the source deployment environment (mobile,
code of a program written in a desktop, cloud, etc.) the developer
Common Language Runtime has abundant options to package
(CLR) compliant language the application.
compiles, it generates machine- (h)
Security: .NET allows code to run in
independent, intermediate code. It different levels of security without
is also possible to mix and match separate security mechanism.
code written in the languages
supported by the framework. (i) Easy and rich profiling and
debugging support: Integrated
(d) Base Class Library: The Base Class Development Environments (IDEs)
Library (BCL) is a type library like Visual Studio or Visual Studio
available for all languages that use Code provide a place to develop
.NET. The BCL provides classes and debug .NET applications. The
that encapsulate many common framework provides rich debugging
functions, including reading and and profiling information, which
writing files, database interaction, is highly integrated within these
image design, XML and JSON IDEs. This helps us to check the
manipulation, etc. application performance and track
(e)
Common Language Runtime down runtime exceptions.
(CLR): All the programming
Languages in .NET are compiled Installing Visual Studio (VS) 2022
into an intermediate language Before you can start programming in
known as Common Intermediate VB.NET you need to install the VS
Language (CIL). This intermediate IDE. It is recommended that you install
language is not interpreted but the latest version. In this book VS 2022
compiled to native code in a way will be used. There are about five steps
known as Just In Time compilation in installing VS 2022. While these steps
(JIT). The combination of these are mandatory, also some are optional.
is called Common Language To install VS 2022, follow the following
Infrastructure (CLI). steps.
(f)
Automatic Resource Management: . 1. Check your computer for readiness:
NET CLR automatically manages Before installing VS on a computer,
205
Student’s Book Form Six Tanzania Institute of Education (TIE)
206
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
The steps described above are necessary for installing VS 2022. Optionally, you
can change the installed language or install additional language packs alongside the
default language. The installer chooses the default language based on the operating
system language (Figure 4.3 (a). Similarly, you can choose a different installation
location as shown in Figure 4.3 (b).
207
Student’s Book Form Six Tanzania Institute of Education (TIE)
After VS is installed, you can launch it and explore its features. To do this, perform
Activity 4.1.
208
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Exercise 4.1
209
Student’s Book Form Six Tanzania Institute of Education (TIE)
Controls are objects placed on a Visual Properties describe the control in terms
Basic form. A form is also a control object of appearance, layout and behaviour.
that acts as a container that hosts other For instance, each control can have a
controls of the application. Each control name, size, label, font size and font type.
has its own set of properties, methods, Control properties can be set using the
and events that can be configured by properties window or using visual basic
the programmer depending on their code. To edit the properties of the control
needs. The toolbox is a window in once it is on the form, right-click on the
Visual Studio that provides all controls. specific control and select Properties. It
To launch the toolbox, click View on will open up a properties window that
the Menu Bar and then select Toolbox. allows you to set several properties of
The Toolbox window will appear, the control.
with several tabs that contain different For example, Figure 4.6 shows the
controls. Pay special attention to the properties window when a Button
Common Controls tab. To add controls control is selected. Using this Properties
to a form, simply double-click on it or window one can set the appearance,
drag and drop it on the form. layout, behaviour, accessibility of the
Visual Basic .NET Control elements button and more. For example, you
can change the text’s font, background
Visual Basic has three control elements, colour, point size, and alignment of the
which are control properties, control Button control.
methods and control events.
210
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
A method is a procedure that performs a certain task. Controls in visual basic have
methods which perform certain tasks by accessing information within the control
class. Methods direct the object to do something. All controls have built-in methods
that can just be called. However, if none of the methods performs the task needed,
new methods can be created.
For example, the control Textbox has a built-in method called Text() whose function
is to get or set the input text of the Textbox.
Control Events
Control events notify the control that an event has occurred. Examples of events are
click, double click, close, resize and load. When a certain event occurs, the specific
method that handles that event is called. For example, when a user clicks on a Button
control, the event method Button_Click() is called. All code that needs to be executed
when a button is clicked should therefore be written in this event handling method
(Button_Click()) as shown in Figure 4.7.
In this example, from Figure 4.7, a button click event handles the click of a button
when Button1 is clicked; a message box appears with the text “You have clicked a
button”.
211
Student’s Book Form Six Tanzania Institute of Education (TIE)
212
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
List View This control allows PictureBox A control that is used
displaying a list of to display images and
items with icons graphics. The image
Masked Text A Control that allows can be in any supported
Box for both restricted data format and size such
entry and formatted as, Bitmap (bmp),
data output. This JPEG (.jpg), icon
control provides visual (.ico), the cursor (.cur),
indications of the type run-length encoded
of data entered or (.rle), metafile (.wmf),
displayed. enhanced metafiles
Month A control that allows (.emf), and GIF (.gif)
Calendar the selection of files.
months and data from Radio A control that limits
a calendar. It also Button the user to pick just
allows the selection of one option. The
a range of dates on the programmer can set
calendar. any of the buttons as
default if needed.
Notify Icon This control display
icons for processes Rich Text A control that allows
running in the Box formatting text, e.g.,
background. The making the text bold,
NotifyIcon Control italics, underlining or
is used to show the adding colour. It also
status of background allows the displaying
applications. of formatted text.
Text Box A control that is used
Numeric Up This control consists to accept textual input
Down of a text box with a from the user. The
number and a pair of user can add strings,
arrows (upward and numerical values and a
downwards). It allows combination of those.
the user to increase Tool Tip This control enables
the numerical value by the display of text
clicking the upward when the user points at
arrow and decrease the any control. It can be
number by clicking the used with any control
downward arrow. and is commonly used
to provide users with
TreeView A control that displays
more information or
a hierarchy of nodes.
help tips.
213
Student’s Book Form Six Tanzania Institute of Education (TIE)
The solution explorer (Figure 4.10) is a special window in the Visual Basic IDE that
allows you to see all your opened projects as well as, all files and elements that your
projects contain. The solution explorer is similar to the project explorer or project
window in previous versions of Visual Basic.
Computer Science
The advantage of visual programming is that the programmer adds the controls
using a graphical user interface (by dragging and dropping) and the IDE generates
the necessary code needed to create that control. For example, adding a Button
control will generate the code needed to create and show the button. To see the code
that has been generated, right click on the control that you want to edit and select
view code. Use the solution explorer to navigate to the specific component (in this
case Button1). This will open a Designer.vb view which shows all the code that the
IDE has automatically generated as shown in Figure 4.12. Note that the code in the
Designer.vb view is not meant to be edited, instead to edit visual controls use the
properties view.
While the Visual Studio IDE allows you to drag and drop controls to your form
applications and edit these controls using the properties window, the code view
allows you to add specific functionalities to these controls. For example, to add
code that should be called when the Button is clicked, double click on the button in
the design view as shown in Figure 4.12. This will open a Formname.vb code view
which allows you to add code that controls events of the button, for example the
onClick event as in code snippet in Figure 4.13.
215
Student’s Book Form Six Tanzania Institute of Education (TIE)
Now that we have explored the Visual (View > Toolbox), then drag and drop
Studio IDE and covered which controls the control Label property to the new
are available, it is time to create a form. Open the properties window and
full working application using this under appearances, look for the named
knowledge. We start by creating a simple Text and type in “My first VB.NET
form that will display the text “Welcome program” (Figure 14). Click on the run
to my Visual Basic .NET application”. button to run the application. The form
should appear with the text “My first
Open your Visual Basic IDE and create VB.NET program” as shown in Figure
a new Windows Forms Application 4.15.
Figure 4.14: The design view in Visual Studio showing a form and a label control
216
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
To explore how to use more features and textboxname.getText.
controls of Visual Basic .NET to create
applications, we will use an example
of an application that will manage the
registration process of Form 5 students
to a school. The application will require
the students to fill in a registration form
with information such as first name, last
name, gender, date of birth, combination
and add their picture. The controls that
will be used to create this registration
form are explained hereafter.
Figure 4.16: Label (First Name and
Labels Last Name) and two empty TextBoxes
A label is used to display fixed text
and numbers on the form. It provides
MonthCalendar
instructions to the users and displays the
output. This control allows the user to select
TextBox year, month and date from a calendar
view (Figure 4.17). In the registration
The TextBox is a box for entering and form, we will use the MonthCalendar
displaying text (characters or values)
control to capture the date of birth
in a user interface. This tool is used
of the student. Drag and drop the
frequently in most applications. In form
applications, usually, a label shows the MonthCalendar control from the
name of the text box. toolbox and use a label to indicate that
the student should enter their birth date
Example
using the calendar. The MonthCalender
Design a registration form that allows control has many properties that can be
form 5 students to enter their firstname configured, for example you can set the
and lastname. Use the toolbox to drag
minimum and maximum date that can be
two text boxes and two labels as shown
selected. To capture the date selected by
in Figure 4.16. Change the following
properties using the property window, the student, right click on the calendar
Name, which reflects how the control and click code view. Select the calendar
will be referred to in the code and Text name and then select DateSelected, this
which will appear on the screen when will generate a block of code where you
the program is run. You do not need can capture the date selected and use
to add any value to the Text property it in the program. In our application, a
of the TextBox, this is usually left variable DoB of type String is defined,
empty for the user to fill in. Figure 4.16 and the selected date of birth is stored
shows this example on the graphical on this variable as shown in Figure 4.18.
217
Student’s Book Form Six Tanzania Institute of Education (TIE)
Figure 4.18: Visual basic code used to capture the selected date
Computer Science
Figure 4.20: Visual basic code to capture the radio button selection
List Box
This control allows listing of several options to the user and the user can select one
or more. For example, if we want the student to select one or more combinations
of subjects from a fixed set of choices, a ListBox is appropriate. Use the toolbox
to drag and drop a list box in the form. Select the ListBox added and go to the
properties window. In the properties window, go to the Items property and click on
the button with three dots on it. A new window will appear allowing you to list the
options that should be on the ListBox. In Figure 4.22, the list contains four choices
which are PCM, PCB, PMC and MCsE. To allow selection of multiple items on the
ListBox, set the SelectionMode property to MultiSimple.
To capture what has been selected on the list box, right click on the ListBox, and click
view code. Select the list box and in the events box select SelectedValueChanged.
This will add a block of code which allows you to capture the selectedItems on the
list (see Figure 4.21).
219
Student’s Book Form Six Tanzania Institute of Education (TIE)
This control also allows selection of choices. However, the comboBox allows
the user to enter new choices that are not provided in the list. In Figure 4.22, the
comboBox shown allows the student to add a new combination that was not listed
in the choices.
Check Box
This control can be used to show one option that a user can select or deselect. The
CheckBox has a property called checked which is set to True when the checkbox is
selected and False when unselected. In Form 5 application example, a CheckBox
is used to let a student choose whether they prefer to be in day school instead of
boarding school as shown in Figure 4.23.
220
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
A button acts as a switch which is used to
run a specific block of code. The Button now the button exists but does not have
control is used to link and call a function any functionality. Right click on the
in a program. button and click View code. The code
editor will open with the cursor placed
In the registration form example, the where the code for controlling the button
Button control is used to capture all needs to be. Add the code below to show
information a student has filled in the a message box that captures the first
form and display it on a message box. name, last name, gender, date of birth,
Drag and drop a Button control to the selected combination of the student and
form. Change the Text property of the whether the student prefers day school
button from Button1 to Submit. Also or not as shown in Figure 4.25.
Figure 4.25: V
isual basic code to capture input from the form and display it on a
message box.
Figure 4.26 shows the complete Form 5 registration program application that has
been developed using different features and controls available in VB. NET.
Figure 4.26: Student registration form developed using Visual Basic .NET
221
Student’s Book Form Six Tanzania Institute of Education (TIE)
TabControl
The TabControl allows you to have
several Forms in one window using
tab style. Each tab on the TabControl
can contain different controls. To add a
Figure 4.27: Container controls in
TabControl to your application, double
Visual Basic
Click on TabControl from the ToolBox
as shown in Figure 4.29.
GroupBox
The GroupBox control allows you to
separate the controls on your form into
different groups depending on their
functionality. This container is useful
since it can provide good structure to
forms with many controls. A groupBox
allows you to add controls in a frame/
box which can be named, making it
easier for users to understand which task
the controls in the group cover. Figure 4.29: TabControl example
To add a GroupBox to your form containing two tabs (First tab and
application, double-click on GroupBox Second tab)
222
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
and remove a tab to the TabControl use different controls for a programmer.
the property named TabPages. This will When a menu is clicked it performs
open up a window similar to Figure a certain task such as launching
4.30, which allows you to add, name something. Menus can also be displayed
and remove tabs. You can also change by right-clicking on a control. These are
the order of your tabs using the upward referred to as context menus since they
and downward arrows. are displayed based on which control
is clicked. Visual Studio toolbox has a
Menus and Toolbars tab that provides all
possible menus and toolbar types.
223
Student’s Book Form Six Tanzania Institute of Education (TIE)
As previously mentioned, context menus are menus that show when a certain
control is right-clicked. They are called context menus because they are specific to
the control that is clicked. Let us assume that we want to add a context menu that
will allow a user to copy, cut or paste text in a TextBox. To achieve this, on your
form application drag and drop a TextBox. Then drag and drop a context menu and
add three menu items to it (Copy, Cut, Paste). To associate the context menu with
the appropriate control, edit the property of the TextBox called ContextMenuStrip
and select the context menu as shown in Figure 4.33. To add code to the specific
menu, double-click on it and in the code view, add the copy, cut and paste methods
as shown in Figure 4.33.
Figure 4.33: Adding a context menu with three menu items (Copy, Cut and Paste)
Figure 4.34 shows the procedure to associate as specific control with context menu
using the properties.
Figure 4.34: A
ssociating a specific control (TextBox) with the context menu using
the properties window.
224
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Figure 4.35: Code to enable the Copy, Cut and Paste context menus to work
accordingly.
Exercise 4.2
Figure 4.36: Output of the context
menu program. 1. Explain the steps used to create a
Visual Basic .NET windows forms
application project
Activity 4.3: Creating the 2. Briefly explain the steps on how
first program on VB.NET to save a new Visual Basic .NET
applying basic controls windows forms application project
Assume that you have finished Form VI 3. Explain the components found in
and want to apply to be admitted to the the Menu bar of the Visual Studio
University of Dar es Salaam. Create a IDE
program to display a registration form
that captures the following information. 4. What is the use of a Toolbox in the
Visual Studio IDE?
1. First name
5.
Design a form which displays
2. Last name your name and class in two text
225
Student’s Book Form Six Tanzania Institute of Education (TIE)
Add a “clear” button which, when 12. Create a form using VB.NET that
clicked, clears the text boxes. loads a list of items into a Combo
6. Design a form with three Buttons box when the form is loaded.
labelled “red”, “green” and “blue”
respectively as shown in Figure
4.37. For each button, write the code
to change the Form background Programming in Visual Basic .NET
colour to the respective colour (red, Data types in Visual Basic
green or blue) when the button is
Data types refer to the type of data or
pressed. Add another button named
value assigned to a variable or function
“clear” which will reset the Form
to hold a specific data type. When
background colour to the default.
we declare a variable, we inform the
compiler what type of data or value
would be assigned to a declared variable
for it to allocate enough memory for a
value expected to be stored. There are
two types of data types in visual Basic
.NET: numeric data types and non-
numeric data types.
Figure 4.37: A program to set the Numeric data types
background colour of the form depending Numeric data types consist of numbers,
on the button pressed. which can be computed mathematically
7. Describe the following features of using various standard operators such
Visual Basic studio as addition, subtraction, multiplication,
(a) Menu Bar. division, and others. Numeric data types
(b) Toolbox. include Byte, Integer, Long, Single,
(c) Form design view. Double, Currency and Decimal.
(d) Solution explorer
(e) Properties window. Byte data type
(f) Code editor window. This data type requires just one byte of
8.
Explain the steps for creating memory. Variables with the Byte data
menus and drop-down menus in type can store values from 0 to 255.
VB.NET. The default byte value is 0. Negative
values and values greater than 255 are
9. Using VB.Net, create a project that
not allowed.
populates a list of items into a list
box when the form is loaded. Example 1: Using a variable of type Byte
10. Briefly identify the difference
between List box and Combo box
226
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The integer data type accepts positive, negative and zero values. Their values range
between -32,768 to 32,767. This data type takes up four bytes of memory. One of the
most used data types is the integer.
Example 2: Using a variable of type Integer
227
Student’s Book Form Six Tanzania Institute of Education (TIE)
228
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
syntax is Dim variableName As Date. variables, except that their values cannot
Example 9: Using a variable of type be modified after their definition.
Date Declaring constants
The syntax of constant is Const
ConstantName As DataType = Value
Note that in the above example, the Whereby;
word “Now” is a function that returns § onstantName - specifies the name
C
the current date and time. of the constant.
Object data type § Datatype - specifies the datatype of
The Object data type is also referred the constant
to as a non-primitive or reference data § Value - specifies the value assigned
type. They are so called because they are to the constant; the initializer.
used to refer to objects of any data type.
The Object data type occupies 4 bytes of Example 1: Declaring constants
computer memory. The default value of
an object is a null reference indicating
that the object has no data. You are
advised to use Object when you do not The const statement is used at Module,
know the data type your variable will class, structure, procedure, or at the
point to during runtime. block level for use in place of literal
values. The constant may be declared
Example 10: Using a variable of type
using const statement as follows:
Object
Const Dim variablename As Datatype.
Example 2: Using constant
const Dim pi As Double = 3.142
The example above declares a variable
with name wsActiveForm of type
object and then assigns an object called Lvalues and Rvalues
ActiveForm to the declared variable. There are two kinds of expressions
which are Lvalues and Rvalues.
Constants
Lvalues: the expression that is lvalues,
Constants refer to fixed values that
it may appear either at the left or at right
the program will not alter during its
hand side of an assignment. Variable are
execution. These fixed values are also
lvalues, therefore, they appear on the
called literals. Constants can be of any
left hand side of an assignment.
basic data type like an integer constant,
a floating constant, a character constant, Rvalues: an rvalue expression may
or a string constant. There are also appear on the right of an assignment but
not on the left side. Numeric literals are
229
Student’s Book Form Six Tanzania Institute of Education (TIE)
230
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
a variable in one line using the = sign mathematical or logical operations.
instead of declaring the variable and Types of operators
then giving it a value in another line.
The following are commonly used types
of operators in Visual Basic:
Dim YourName As String= “Juma”
Arithmetic operators
is the same as
Arithmetic operators are used to
Dim YourName As String
perform many of the familiar arithmetic
YourName=“Juma”. operations that involve the calculation
of numeric values represented by
Visual Basic operators literals, variables, other expressions,
functions, and constants. Table 4.3
Just like other programming languages,
shows arithmetic operators and their
Visual Basic also has operators.
examples.
Operators are symbols that instruct
The following program demonstrate the use of arithmetic operators. The program
is presented in Figure 4.38. The program output is presented in Figure 4.39.
231
Student’s Book Form Six Tanzania Institute of Education (TIE)
232
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Exercise 4.3
1. Write a program that takes in any text and computes its length.
2. Write a program that adds and subtracts two integer numbers. Use two buttons,
one for add another for subtract and a message box to display the results.
3. Write a program to compute the area of a triangle. The program should allow a
user to input the height and base of the triangle.
4. Write a program to enter the name of a student and three marks, for Physics,
Mathematics and Computer Science respectively. The program should compute
the average and display the student’s name and the average of the three marks
in two different labels.
5. Write a program that receives any number, then outputs the square of that
number on the screen.
6. Write a program that lets a person enter their date of birth and then computes
and displays their age. Hint: Use the MonthCalendar control.
7. Write a program that can be used to find the roots of a quadratic expression.
ax2 + bx + c = 0.
233
Student’s Book Form Six Tanzania Institute of Education (TIE)
In Visual Basic, relational operators are used to determine whether the defined two
operands are equal, greater than, or less than. Table 4.4 lists the different comparison
operators available in Visual Basic.
Table 4.4: Symbols used in relational operators and their applications
Logical operators
Logical operators return a Boolean result (True or False) after evaluating one or
more boolean expressions. There are six logical operators, which are supported by
VB as demonstrated in Table 4.5.
The concept of short-circuiting
When using logical operators, short circuiting means that not all conditions in the
whole expression are evaluated. The evaluation of the expression ends when the
result is already known from only evaluating some of the conditions in the logical
expression. In Visual Basic, the AndAlso and OrElse operators perform short
circuiting.
Note that, in other object oriented programming languages such as Java and C++,
the AND and OR operators perform short circuiting.
234
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Table 4.5: Symbols used in logical operators and their applications
235
Student’s Book Form Six Tanzania Institute of Education (TIE)
236
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
programs. VB.NET offers two kinds statements to execute when condition
of control structure namely decision is true
(selection) and looping (iteration). End If
237
Student’s Book Form Six Tanzania Institute of Education (TIE)
Figure 4.41: Design and output of the program: (a) Form design view; (b)Result
with a pass mark; (c) Result with a fail mark; and (d) Result with an
invalid mark
238
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Unlike the If...Else statement, the If... Then.. Else statement tests a condition and
allows a program to taken one of two courses of action based on the truth value of
the condition. That is, when the condition is false it allows an alternative block of
statements to be executed. This form of the If statement has the following syntax:
If condition Then
statements to execute when condition is true
Else
statements to execute when condition is false
End If
Example 2
In example one, two separate If statements were used to test whether the student
passed or not. Since passing and failing are mutually exclusive (a student can just
either pass or fail), let us improve the program in example one by using the If...
Then...Else statement.
Solution
The only change we need to make is to replace the two if statements which test the
value of the markVal variable with an If...Then...Else statement (Figure 4.42). This
change will not affect the behavior of the program but will make it relatively shorter
and easy to read. Output of the program is the same as in example 1(Figure 4.41)
239
Student’s Book Form Six Tanzania Institute of Education (TIE)
Write a program that allows the user to enter a username and display the message
“Hello”. If the username entered matches one of the following names “Baraka”,
“Neema”, “Ali” or “Issa”, the program should display “Hello” followed by that
matching name. Otherwise the program should display the message “Hello, Guest”.
Solution
We create a single-form application and put one text box for inputting the user’s
name, one button for triggering the greeting, and one label for describing the text
box. We implement the functionality of the application in the click event of the
button. The code for the click event of the button is shown in Figure 4.43, and the
output of the program when run with a known and an unknown user is shown in
Figure 4.44. The program uses a dialog box to greet the user.
240
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
and “neema” are treated as different. Thus we convert the entered name to lower case
and use lower case comparison in the If statement. Thus, if the user enters “Neema”
we convert it to “neema” so that the comparison becomes “neema” = “neema”,
which evaluates to true, as opposed to “Neema” = “neema” which evaluates to false.
If condition1 Then
statements to execute when condition1 is true
ElseIf condition2 Then
statements to execute when condition2 is true
ElseIf condition3 Then
statements to execute if condition3 is true
…
Else
statements to be executed if no condition is true
End If
Nested If statement
The nested If statement is an If statement placed inside another If statement. Nested
If statements are often used when you want to test a combination of conditions before
deciding on the proper action to take. First, the condition in the outer If statement
is tested; if it evaluates to true, then the condition in the inner If statement is tested.
If the condition in the inner If statement evaluates to true, the block of statements in
the inner If statement is executed. The nested If statement has the following syntax:
241
Student’s Book Form Six Tanzania Institute of Education (TIE)
Computer Science
obesity class
No. BMI range Comment
1. < 18 Underweight
2. 18.5 to < 25 Healthy
3. 25 to < 30 Overweight
4. > 30 Obese
No. BMI range Obesity class
Figure 4.46: Output of the program 1. 30 to < 35 Class 1
corresponding to example 4 E 2. 35 to < 40 Class 2
3. > 40 Class 3 (severe)
Exercise 4.5
3. Write a program that accepts a score
1 Write a two-player number guessing
and determines a corresponding
game (player1 and player2). The two
grade. First, use the If...Then...
players play in turns; first, player1
ElseIf...Else statement, then use the
enters a secret number (between 1 and
Case statement. Compare the two
100) then player2 tries to repeatedly
implementations. Use the following
guess the until he or she guesses it
grade table for reference. Table 4.7:
correctly. Every time player 2 enters a
guess, the game should give feedback
as to how far the guess is from the Table 4.7: Examination scores and
secret number. When the number is grades
guessed correctly, the game should
congratulate player 2. No. Range Grade
2
The body mass index (BMI) is 1. 75–100 A
a number used to measure the 2. 65–74 B
proportionality between a person’s 3. 55–64 C
height and weight. For a given height 4. 45–54 D
and weight, the BMI tells whether
a person is healthy, underweight, 5. 40–44 E
overweight, or obese. Furthermore, if 6. 34–39 S
a person is obese it tells the severity 7. 0–35 F
of the obesity. Write a windows
application that calculates BMI of a
person and comments on their health
status. If the person is obese let the
program tell the obesity class as well.
Iteration (Looping)
Use BMI data in the tables 4.9. Use
the formula BMI = weight (kg) / In the previous section you learnt how
(height (m))^2. to control program flow using the If and
Case statements (branching). In this
243
Student’s Book Form Six Tanzania Institute of Education (TIE)
looping. The iteration control structure until the condition becomes false. In
enables a program to repeat an action VB.NET the While loop is available
a number of times. Solutions to many through the While...End statement and it
programming problems involve has the following syntax:
some form of repetition, thus, need
While condition statements
to repeat actions arises quite often in
End While
programming. Looping is achieved
using control structures known as loops. Sometimes you may want to exit a While
Like the If statement, loops are driven by loop before the loop condition becomes
Boolean conditions. Some loops repeat false. You can achieve this by using the
an action until a condition becomes true Exit While statement inside the loop
while others repeat an action until a body, usually in an If statement inside
condition becomes false. the loop body. Similarly, sometimes you
may want to skip the current iteration
Uses of iteration control structure and transfer control to the next iteration
The iteration is used to repeat line of of the loop. You can achieve this by
code or statements or instruction several using the Continue While statement
times in the program. inside the loop body.
Types of iteration control structures Example 1
VB.NET offers three kinds of loop: Suppose you want to write a function
that given a positive integer returns the
1. While loop
sum of the digits of the integer raised
2. Do loop to a given power. For example, calling
3. For Each loop the function with the number 123 and a
power of 2 gives 14.
The choice of which type of loop to use
depends on several factors including Solution
whether you want to repeat some action
a fixed number of times; you want To write this function you need to split
to repeat an action until a condition the number into individual integers.
becomes true/false, and; whether you Since you do not know in advance how
want an action to be performed at least many digits the number has, you need
once or not at all. to repeat the process until a certain
The While Loop condition is met. In this example we use
The while loop repeats a block of the Mod and the integer division operator
statements (the loop body) as long as a (\) operators to successively split the
given condition is true. The condition is number. We stop when the number
tested before the loop body is entered. becomes zero. The completed function
Therefore, there is a possibility that the is shown Figure 4.47. The output of the
loop body may not be executed at all if program is shown in Figure 4.48.
the condition is initially false. The entry
244
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Figure 4.48: Output a program to find a sum of integers raised to a given power
The Do Loop
The Do loop repeats a block of statements as long as a given condition is true or until
the condition becomes true. It can be tested either before entering the loop or at the
end of the loop. Similar to the While loop, if you test the condition before entering
the loop and the condition evaluates to false the loop body will not be executed
at all. If you test the condition at the end of a loop, the loop body is guaranteed to
be executed at least once. Alike to the While loop, the loop body alters a control
variable to ultimately make the loop stop. The Do loop is available through the Do...
Loop statement and has the following syntax.
245
Student’s Book Form Six Tanzania Institute of Education (TIE)
condition statements
statements Loop While/
Loop Until condition
As with the While loop, sometimes you
may want to exit a Do loop before the
loop condition becomes false/true. You
can achieve this by using the Exit Do
statement inside the loop body, usually
in an If statement inside the loop body. Figure 4.49: A Do Loop function to find
Similarly, sometimes you may want to the first Armstrong number
skip the current iteration and transfer
control to the next iteration of the
loop. You can achieve this by using the
Continue Do statement inside the loop
body.
Example 2
An Armstrong number of order N is an
N-digit number that has the property
that the sum of its digits raised to the Figure 4.50: Output a program to find
Nth power equals the number itself. For the first Armstrong number
example, 153 is an Armstrong number
of order 3 since 153 = 1^3 + 5^3 + 3^3 The For Each Loop
= 1 + 125 + 27 = 153. Write a function The For Each loop is used with
that finds the first Armstrong number of collections where it runs a block of
order 4. statements once for each element of the
Solution collection. To use the For Each loop
you specify a loop control variable
To do this we will need to split numbers. which will be assigned a value from the
For this purpose, we can make use of collection in each iteration. The loop
the SumDigits function in example 18. exits when all elements in the collection
The completed function is shown in have been processed. The For Each loop
Figure 4.49. The output of the program is available through the For Each...Next
statement and has the following syntax.
is shown in Figure 4.50
For Each element In group
statements
Next
246
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
condition in an If statement.
Example 3
Write a function that return the number of order 4 Armstrong numbers.
Solution
In this case the number of iterations is known in advance (testing the numbers
between 1000 and 9999), hence we can make use of the For Each loop. Again,
we make use of the SumDigits function in example 18. The completed function is
shown in Figure 4.51. The output of the program is shown in Figure 4.52
Figure 4.51: A For Each Loop function to find the count of Armstrong numbers
As with the If statement, you can put one loop inside another. When you do this,
the loops are said to be nested. You can nest any type of loop inside another. When
loops are nested, for each iteration of the outer loop the inner loop runs to the end.
247
Student’s Book Form Six Tanzania Institute of Education (TIE)
Visual Basic .NET procedures useful for taking one or more pieces of
and functions data, called arguments and performing
some tasks with them. Then the functions
Meaning of procedures
returns a value that indicates the results
A procedure is a block of Visual Basic of the tasks complete within the function.
statements enclosed by a declaration After the execution of a function, control
statement (function, Sub, Operator, Get, transfer to the main() method for further
and Set) and a matching end declaration. execution.
All executable statements in Visual
Syntax
Basic must be within some procedures.
A function procedure is a series of Private Function
Visual Basic statements enclosed by the procedureName([parameterList]) As
Function and End function statements. dataType
The function performs a task and then Statements
returns control to the calling function. Return expression
When it returns control to the calling End Function
function, it may also return a value. The
The statement’s syntax is Return
syntax of a function is FunctionName
expression, where expression represents
(arguments). There are two types of
the one and only value that will be
functions; Built-in functions and User
returned to the statement invoking the
defined functions as explained in the
function. The data type of the expression
following subsection.
must agree with the data type specified in
Functions the As dataType section of the function’s
Meaning of functions header.
The function is a separate group of Types of functions
codes that are used to perform a specific Built-in functions
task when the defined function is called
In this lesson, you will learn two very
in a program. Functions are like sub
basic useful internal functions of Visual
procedures, except they return a value
Basic the MsgBox ( ) and InputBox ( )
to the calling procedure. Functuions are
functions
248
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The objective of MsgBox is to produce
a pop-up message box that prompts Style Value will determine what type
the user to click on a command button of command buttons appear on the
before they can continue. The syntax is message box; refer to Table 4.8 for the
yourMsg=MsgBox (Prompt, Style Value, types of command buttons displayed.
Title). The Title argument will display the title
of the message board.
249
Student’s Book Form Six Tanzania Institute of Education (TIE)
250
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
251
Student’s Book Form Six Tanzania Institute of Education (TIE)
1.
Describe the following functions
in brief, the Exp(), Round(), Asc(), No. Object Description
Right() and Sqrt(). 1. Connection Used for
2.
Describe how parameters can be establishing a
passed. connection to
a specific data
3. In how many ways a function can source, e.g., MS
return value in VB.NET? SQL Server.
4. Describe the user-defined functions 2. Command Used for executing
with examples. commands against
5. Describe the procedure in VB.NET a data source.
3. DataReader Used for reading a
forward-only and
read-only stream
Linking Visual Basic .NET form of data from a data
to Data source source.
It is common for applications to require 4. DataAdapter Used for retrieving
persistent storage of data. This can be and saving data.
achieved through the use of files and
The .Net framework provides several
databases. The former is mostly used for
data provider for use when working
persistent storage of configuration data
with databases in VB.NET applications,
while latter is used for more elaborate
these are data providers for: SQL server,
data storage needs. This describes the Object Linking and Embedding (OLE)
how to work with databases in VB.NET. DB, Open Database Connectivity
The .NET framework provides facilities (ODBC), and Oracle. The choice of
for working with different databases. a data provider to use depends on the
These facilities are called data providers data source you are planning to use in
and are used to connect to a database your application as well as the nature
(data source), and running queries of your application (middle- or single-
(executing commands) for retrieving tier). For example, the ODBC provider
is recommended for middle- and single-
and modifying data in a data source. The
tier applications.
retrieved results can be processed by the
application or be shown to the user. Using the ODBC data provider in a
Data providers in .NET are made up VB.NET application
of four core objects as described in This section describes how to use the
Table 4.10. ODBC data provider to work with an
MS Access database. To do this we will
252
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Activity 4.6: Creating an employee database in MS Access
Create an Access database with one table for tracking students’ contact details (phone
number and email address). Name the table Contacts and add the following columns:
firstName, middleName, lastName, gender, phoneNumber, and emailAddress. Use
the default ID field as primary key. Save the database using the name employees.
accdb. The finished database should look similar to Figure 4.56.
The next step after creating a test database is to create a new Windows Forms project
in Visual Studio and add connect to the database. After connecting to the database
the data will appear in the Data Sources window where we can drag the table into a
form. The following steps takes you on this process.
253
Student’s Book Form Six Tanzania Institute of Education (TIE)
2. Select View > Other Windows > Data Sources to open the Data Sources
window as shown in Figure 4.58.
254
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Data Source Configuration Wizard will open (see Figure 4.59).
255
Student’s Book Form Six Tanzania Institute of Education (TIE)
256
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
7. If Data source is not set to Microsoft Access Database File, select the Change
button to change it to Microsoft Access Database File (OLE DB). Select
Microsoft Access Database File then click Continue (Figure 4.64).
257
Student’s Book Form Six Tanzania Institute of Education (TIE)
258
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
11. Click OK on the Add Connection dialog box.
12. Click Next on the Choose Your Data Connection page. The Save
connection String to the Application Configuration File dialog will be
displayed (Figure 4.67).
Figure 4.67: The Save Connection String to the Application Configuration File
dialog
lick Next on the Save Connection String to the Application Configuration file
C
dialog. The Choose Your Database Objects window will be displayed (Figure
4.68).
259
Student’s Book Form Six Tanzania Institute of Education (TIE)
and select the Contacts table to include it in the dataset then click Finish
(Figure 4.69). The table will appear in the Data Sources window as shown
in Figure 4.70.
260
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
1. Drag the Contacts table from the Data Sources window and drop it on the
form (Figure 4.71).
A data grid with all the fields in the Contacts table will appear on the form
(Figure 4.72). You may need to resize the grid to make all fields visible.
Figure 4.72: A data grid with all the fields from the Contacts table
2. Run the application. The data in the Contacts table will be shown in the grid as
in Figure 4.73.
Figure 4.73: Data from the Contacts table displayed on the form
261
Student’s Book Form Six Tanzania Institute of Education (TIE)
Exercise 4.8
1. List and describe elements that are contained in the connection string.
2. Weigh out the importance of testing a connection to a database before proceeding
to next steps in creating the connection to the database
3. State whether it is possible to use a form in Visual Basic .NET to delete or enter
data in a database. Justify your answer.
4. A database that was previously accessed from disk C was transferred to disk
E to guard against security breaches. However, following that modification,
nobody was able to access that database. Describe the steps you would take to
address the problem.
262
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Develop a program, which helps people
to purchase goods online. Draw objects, The properties window shows all
assign properties, attach code; use the controls a programmer can use
following as a guideline to your problem: to format the control to suit the
demand of the program. Moreover,
(a) Identify a problem we discussed about code editor,
(b) Analyse a problem which is used to write codes for
(c) Develop an algorithm to solve the different commands of the program
problem designed.
(d)
Code the program using visual 4. In addition, the chapter covered on
basic and link it to the MS Access how to install the Visual Basic .NET
database or spreadsheet as your IDE, functions of tools found in the
data source ToolBox of the IDE, how to open
IDE, saving a Visual Basic .NET
(e) Test the program program in the first time where you
(f) Document the program click save and then, save the form
and write the name of the form.
Also, we learned how to create our
Chapter summary first simple program in VB.NET,
1. This chapter has covered the major “My first VB.NET program” as our
parts of Visual Basic programming, first example.
providing discussion on each 5. After introducing VB.NET, the
key concept. Our discussion was chapter discussed data types
classified into subcategories. We including numeric and non-numeric
started on the general concept of data types. Numeric data types
Visual Basic .NET by defining involve mathematical conversions
it as a programming language such as bytes and integers as well
that lets users create programs as non-numeric data types such
by manipulating program as Boolean, String and Date. We
elements graphically rather than covered decision control structures
by specifying them textually. such as branching and iteration.
Advantages and disadvantages of Under iteration control structures,
Visual programming were outlined. we learned the While, Do and For
2. Visual Basic .NET tools, their Each loops.
uses, as well as the use of forms 6. The chapter ended with working
as the main part of designing with data sources. In this section,
VB.NET programs were discussed. we learned how to connect a
Controls such as CheckBox, VB.NET program to a database by
CommandButton, and TextBox focusing on the Microsoft Access
used in VB.NET applications were database. Through a data source
described. that we created, we were able
3. We also discussed about the project to manipulate data in an Access
database.
263
Student’s Book Form Six Tanzania Institute of Education (TIE)
264
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Introduction
Data and information is valuable resources in digital age. If it is not well managed
and protected may results into organisations functions and its operations jeopardised.
In this chapter, you will learn the concept of computer security, measures taken
to prevent loss and authorised data access; concepts of physical security, and
troubleshooting. The competence gained will enable you to be able to used data and
information ethically and responsibly.
265
Student’s Book Form Six Tanzania Institute of Education (TIE)
266
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
This information comes from one or reputation or branding
more of the following: 4.
Phishing attacks may expose
1. What the entity knows (such as critical computer resources to
passwords or secret information) unauthorised users
2. What the entity has (such as a 5.
Software vulnerabilities could
badge or card) allow an attacker to gain access to
3. What the entity is (such computer resources.
as fingerprints or retinal
characteristics)
4. Where the entity is (such as in Activity 5.1: Read the
front of a particular terminal) scenario about computer
5. What does the entity do (gain/ security and answer the
movements recognitions) questions that follow:
Also, the authentication process Juma lives with his parents in Dodoma.
consists of obtaining the information Juma’s father owns an Apple smartphone,
from an entity, analysing the data, and generally known as iPhone, whereas Juma’s
determining if it is associated with that mother uses an Android smartphone with
entity. This means that the computer the Android operating system.
must store some information about the
1. ith the help of Internet, in your
W
entity.
own words, compare the security
Authorisation allows us to specify features available in Android and
whether the party should be allowed iPhone smartphones. Give at least
or denied access. Once we have two main security features in each
authenticated the party in question, of the above smartphones.
authorisation enables us to determine
precisely what they are allowed to do. 2.
Write down the step-by-step
We typically implement authorization procedures that you will use to
using an access controls mechanism. ensure confidentiality, integrity,
availability, authentication, and
authorization for each of the above
Challenges of computer security
phone categories.
The following are some challenges of
computer security: 3. What will happen if confidentiality,
1. Damage or loss of computer integrity, availability, authentication,
resources and authorization are missing from
2. Requires high investment cost to any of the above phone categories?
achieve total computer security
267
Student’s Book Form Six Tanzania Institute of Education (TIE)
268
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Data privacy deals with properly
unauthorized access. Data protection
handling data, and it is the controlling
also safeguards private and important
information from compromise, process around sharing data with a third
corruption, and loss. The demand for party so that only authorized users can
data protection is also fueled by more access it. Data privacy is a set of rules
data generated in the current digital that govern how data is acquired and
world. The data source ranges from managed based on its sensitivity and
information systems, social media, and value. Data privacy is applied to Personal
service automation. Health Information (PHI) and Personally
A data protection policy: This is vital for Identifiable Information (PII). It includes
any organization that collects, handles, financial data, medical records, social
or stores sensitive data. It provides security or ID numbers, names, birth
guidance that prevents data loss, theft, dates, and contact information.
and corruption and helps to minimize
damage caused by a breach or disaster. Concerns over data privacy apply to all
sensitive information that firms handle,
Data protection policy including customers, shareholders,
A data protection policy (DPP) is a and employees. This information
security policy dedicated to standardising is frequently critical in corporate
and controlling data use, monitoring, operations, development, and finances.
and management. The main goal of
Data privacy helps to ensure that
this policy is to protect and secure all
data consumed, managed, and stored sensitive information is only available
by the organization. It is not required to authorised users. It secures data from
by law, but it is commonly used to being used by criminals maliciously and
help organizations to comply with data assists enterprises in meeting regulatory
protection standards and regulations. requirements.
Data protection policies should cover
Computer privacy
the following aspects:
1. The scope of required data protection Computer privacy is just the safeguard
of a computer whereby it is controlled
2. Data protection techniques and
from being used by other persons who
policies applied by relevant parties
such as individuals, departments, are not authorised. Privacy should be
devices, and the IT environment maintained when using computers
and information systems. The use of
3. Any applicable legal or compliance
requirements for data protection an information system should be kept
safe and secret, and no one should be
4. The roles and responsibilities
allowed to engage in illegal activity
related to data protection,
including data custodians and roles while accessing that information.
specifically responsible for data
protection activities
269
Student’s Book Form Six Tanzania Institute of Education (TIE)
270
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
penalised. The cybercrimes Act 2015, from fraud cases such as hacking,
came after significant impacts such as phishing, and identity theft.
financial loss, fraud and cyberbullying to (c) It gives consumers more confidence
the public and other stakeholders. Non- to buy items or things online. As
compliance may result in reputation a result, it increases revenue for
damages and monetary fines, depending enterprises both offline and online.
on the violation as instructed by each
law and governing entity. Data protection technologies
There are various technologies
A
ctivity 5.5: Searching for and practices to protect data in an
cybercrime Acts and related organisation. The most commonly used
regulations methods and technologies are as follows:
Resources: Data discovery: This entails determining
Library resources, internet connectivity, which data sets exist in the organisation,
the Tanzania cybercrime act and other which are essential to the organisation
related cyber-related regulations. role, and which contain sensitive
Procedures: information that may be subject to
compliance regulations.
1. Visit a library or search the current
Tanzania cybercrime act on the Data Loss Prevention (DLP): A set
Internet. of strategies and tools that you can
2.
Study various laws that govern use to prevent data from being stolen,
information security. lost, or accidentally deleted. Data loss
prevention solutions often include
3.
Write one section and its sub-
several mechanisms to protect against
sections of the act stating its phrase
and recover from data loss. Most
and explain how it addresses the
cyber-related activities/ offences in modern storage equipment with built-
the society in data protection provides built-in disk
clustering and redundancy.
Encryption: Changes the data content
Importance of data protection
into non-meaningful texts and uses an
Data protection has the following algorithm that can restore the original
importance: content using the correct encryption
(a)
The essential values of data key. It protects information from being
protection are safeguarding and accessed by rendering it impossible to
making available data under all read even if the data is stolen. More
circumstances. That describes information can be found in the data
the operational backup of data encryption guide.
and Business Continuity Disaster
Recovery (BCDR).
271
Student’s Book Form Six Tanzania Institute of Education (TIE)
Modern storage equipment have disc and mobile devices.) from being
clustering and redundancy to ensure compromised or attacked. Cybersecurity
data recovery during a disaster. involves identifying the critical data,
Screenshots to backups and snapshots: where it resides, its risk exposure, and
These are complete images of a protected the technology you must implement to
system, including data and system files. protect it.
The image can restore an entire system Cybersecurity, as a subset of information
to a specific time in the past. security, is the practice of defending
your organization’s cloud, networks,
Relationship between information computers, and data from unauthorized
security, cybersecurity, system digital access, attacks, or damage
security, and network security by implementing various defence
These terms sometimes are used processes, technologies, and practices.
interchangeably, but it depends on the With the countless sophisticated
area to be the emphasis for protection. Let threat actors targeting all types of
us look at the meaning and relationship organizations, your IT infrastructure
must be secured to prevent a full-
between these terms:
scale attack on your clouds, networks,
Information security: Information or endpoints and risk exposing your
security (also known as InfoSec) company to fines, data losses, and
ensures that both physical and digital damage to reputation.
data are protected from unauthorized
Network security: It is a subset of
access, use, disclosure, disruption,
cybersecurity which consists of the
modification, inspection, recording, or
policies, processes and practices
destruction. Information security differs
adopted to prevent, detect and
from cybersecurity in that, InfoSec aims
monitor unauthorized access, misuse,
to keep data safe in any form, not only
modification, or denial of a computer
data in digital format. For example,
network and network-accessible
suppose you have a paper document. In
resources. Network security involves
that case, securing this document is an
securing data access in a network, which
information security responsibility. Still,
the network administrator controls.
if you scan this document and transfer
Figure 5.2 shows the difference between
it into a digital file, this digital file’s
information security, computer/cyber
security is a cybersecurity responsibility.
security, system security and network
Cybersecurity: It is all about protecting security.
data that are found in electronic form
272
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
273
Student’s Book Form Six Tanzania Institute of Education (TIE)
have, something you do, and where you for the successful and effective
are. When you are prompted to enter the implementation of essential protection
PIN from the ATM card associated with requirements.
the card, you complete the transaction’s Information security models: These are
authentication portion. These are some procedures used to validate security
of the identification and authentication policies. They are designed to provide
methods used in daily life. specific instructions for a computer to
Accountability perform a security program’s critical
Accountability refers to the ability of a security processes, procedures, and
system to deliver audit trails of every concepts. These models might be either
transaction. The system managers must intuitive or abstract. Security models,
be able to offer information on every for example, define the road map for
transaction that has taken place because operating system security.
they are subject to external scrutiny. These security models are vital
Hence, the action impacting security components that must be considered
may be traced back to the accountable when engineering security systems and
party. Audit trails must be stored in policies in your organization. They
selective manner and protected to ensure should define the access rules necessary
their integrity. to instantiate the said policy and define
the entities (subjects governed by an
Non-repudiation organisation’s security policy).
Non-repudiation is the ability to Five security models: Define the rules
ensure that computer/network users or and policies that govern integrity,
participants do not deny (repudiate) their confidentiality, and data protection.
actions. Hence, assurance of security Confidentiality through information
service that provides proof of service, integrity and access controls is the main
origin and delivery is done by non- focus and reason for the security model
repudiation. In real life, the sender may implementation.
deny ownership of the exchanged digital The following are examples of security
data that originated with them. This models:
service ensures that digital data cannot
be repudiated by providing difficult-to- (a) Bell-LaPadula
deny proof of origin via digital signature (b) Biba
and encryption algorithms. (c) Clark-Wilson
Models of information security (d) Chinese Wall model
A security model: It is a framework that (e) Harrison–Ruzzo–Ullman.
determines how security is implemented
Bell-LaPadula (BLP)
by implementing security policies.
Without efficient and robust security The Bell-LaPadula (BLP) security model
models, no organisation can secure is also, called the multi-level model,
sensitive information or data. was proposed by Bell and LaPadula for
274
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(user) and each object (resources such procedures (TPs). The IVP’s job is to
as, files) is assigned one of the security ensure that the TPs produced by CDIs
levels: top secret, secret, confidential, are in a valid state, and all TPs must be
classified and unclassified. Therefore, certified to make a proper transformation.
the unclassified user can not access Authorized TPs can only manipulate
data at the upper levels ( classified, CDIs. The Clark-Wilson model
confidential, secret and top secret), and enforces integrity goals by using access
the files tagged as top secret can not triple (subjects, software transaction
be accessed by lower levels (secret, procedure and object), separation of
confidential, classified and unclassified). duties, and auditing. It uses well-formed
This kind of access control is also transactions (through access triple) and
called mandatory access control, which separation of user duties.
restricts access to an object based on the
sensitivity of the information contained Chinese Wall model
in that object and formally authorises The Chinese Wall model’s theory is based
the subject to access information based on a conflict of interest, which states that
on its sensitivity. a single user should not have access to
The Bell-LaPadula model has two confidential information belonging to
limitations: two separate interested and participating
1. It provides confidentiality only ( no stakeholders. User behaviour influences
integrity and authentication). access control policies. In other words,
2.
It provides no methods for the once one side’s data is accessed, the
management of classification (it other side’s data becomes inaccessible
assumes all data are assigned with or unavailable.
a classification and will never Harrison–Ruzzo–Ullman (HRU)
change).
The BLP model lacks mechanisms for
Biba model changing access rights and deleting
subjects and objects due to the results.
The Biba security model was published
The HRU model addresses these issues
to handle integrity issues which BLP
by defining an authorization system
Model did not address. The goal of the
Biba model was to prevent unauthorised to assign access rights and verify
users from making modifications to compliance with any policy, preventing
particular computer resources. unauthorized access.
Clark-Wilson Attacks
The Clark-Wilson model distinguishes An attack is an information security
between two types of objects, namely threat involving the unauthorized
Constrained Data Items (CDIs) and acquisition, modification, destruction,
Unconstrained Data Items ((UDIs). It removal, implant, or disclosure of
also addresses two types of transactions, information.
275
Student’s Book Form Six Tanzania Institute of Education (TIE)
Interruption
This occurs when the individual who is not authorised to access data gains access to
information between two communicating individuals making the services unavailable
temporarily or permanently. The person interrupts the information such as, files,
conversations, E-mails, etc., by blocking communication between two individuals,
making the services unavailable, as shown in Figure 5.4. Interruption is performed
when the data are in either motion or stationary. It is an attack on availability.
Figure 5.4: Interruption
276
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
This is editing the content of information from an individual without the person or
organisation’s consent. This is referred to as an integrity attack because the data
integrity is damaged. When the data is compromised, this can cause a severe problem
for an individual or organisation. Figure 5.5 shows the modification attack.
277
Student’s Book Form Six Tanzania Institute of Education (TIE)
278
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
A Trojan horse is a self-contained,
non-replicating program that serves a because they make hackers extremely
malicious intent despite its innocent difficult to locate. They are frequently
appearance. It masquerades as an used to penetrate and imprison other
authentic software or application computers as zombies, forcing them to
to capture user information such attack other machines, distribute spam,
as username, password, biometric or steal passwords. When attempting
information and passcodes. The to track down the creator of a rootkit,
information captured by hackers can the search usually ends with the first
be used to perform other malicious computer used as a zombie while the
activities. hacker remains undetected.
Logic bombs Bots
Logic bombs are malicious programs Bots, also known as Botnets, are
typically installed on a design by an automated processes interacting with
authorized user. They are composed of other network services. They are derived
some code or a program that remains from the word “robot.” Bots frequently
inactive for an extended time, waiting automate tasks and provide information
for a logical condition to be met before or services that humans would otherwise
executing its malicious payload. perform. Bots are typically used to gather
Spyware information (such as web crawlers) or to
interact with instant messaging (IM),
Spyware is a sneaky program that Internet Relay Chat (IRC), or other
attempts to steal your information such web interfaces automatically. It can
as credit card, banking information, also be used to interact with websites
web browsing data, and password to
dynamically. Bots can be used for either
various accounts. While spyware is not
good or evil purposes. A malicious bot is
intended to cause harm, it can harm
a self-propagating malware that infects
your computer’s performance over time.
a host and connects to a central server
Spyware is typically bundled with free
that serves as a Command and Control
software and installs itself alongside
(C&C) centre for an entire network of
the program you intend to use. Sudden
changes in your web browser such as, compromised devices, or “botnet.”
redirections of your search attempts Phishing attack
and the frequent display of pop-ups, are Phishing attacks use fake communication,
among the signs of spyware.
such as an email, to trick the receiver
Rootkit into opening it and carrying out the
A rootkit can be a single program or a instructions inside, such as providing a
group of programs designed to take credit card number. “The goal is to steal
complete control of a system. Hackers sensitive data like credit card and login
use this type of malware to gain access information or install malware on the
to all of the capabilities of a system victim’s machine.”
279
Student’s Book Form Six Tanzania Institute of Education (TIE)
internet users. The prefix “ph” in this terminology has gradually faded. Phishing
refers to attempting to contact a victim via email or phone while impersonating
a legitimate institution to trick the individual into providing sensitive information
such as banking information, credit card details, and passwords. Nevertheless, the
individual’s data can then be used to access their account, resulting in identity theft
and financial loss. Figure 5.7 shows a phishing attack.
280
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Figure 5.8: Man in the Middle attack
281
Student’s Book Form Six Tanzania Institute of Education (TIE)
282
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Exercise 5.1.
Zero-day exploit
A zero-day attack, also known as Day Zero, is an attack that takes advantage of
a severe possible software security vulnerability that the vendor or developer is
unaware. To limit the threat to software users, the software developer must act
quickly to address the fault. One example is the Microsoft Exchange attack that
compromised hundreds of thousands of organizations. Figure 5.11 illustrates a zero-
day exploit attack.
283
Student’s Book Form Six Tanzania Institute of Education (TIE)
284
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
pointing to a fake site rather than the accurate bank site.
The hacker’s DNS server then offers to perform a zone transfer, exchanging all
data with the target server. This information includes the forged Mwananchi Bank
address. The target DNS server has an entry for Mwananchi Bank. Instead of the
actual Mwananchi Bank website, the target DNS server has access to Mwananchi
Bank, pointing to the hacker’s website. If users on that Network enter the URL for
Mwananchi Bank, their DNS server will redirect people to the hacker’s site.
Natural threats
All threats that occur naturally without human intention, such as earthquakes, fire,
cyclones, and floods, pose additional threats to IT systems, data, and infrastructure.
Building and computer hardware damage can result in the loss or corruption of
customer records/transactions.
285
Student’s Book Form Six Tanzania Institute of Education (TIE)
286
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
You can categorize computer risks as the
risks that happen to hardware, software, are reviewed for security measures to
network, and human errors. determine the effectiveness of deployed
security layer to withstand attacks and
Computer risks in hardware misuses. Assessing the vulnerability
Computer risks in hardware result from helps to identify the weaknesses and
unsafe computing habits such as the flaws of vulnerabilities that could be
improper shutdown of the computer or exploited; and therefore, develop the
damaging hardware part that generates countermeasures strategies against or
threats to the computer itself and provide an additional security layer.
misconfiguration. The following procedures should be
followed in risk assessment process:
Computer risk in software
(a)
Identify threats and risks for
Computer risk in software causes damage a specific asset. The overall
to the computer internally (operative assessment results from a threat
system damage) without the permission and a vulnerability combined.
or knowledge of the user, like Viruses, Vulnerability in the absence of a
worms, ransomware, spyware, and corresponding risk, or a danger in
Trojan horses. Hence, those activities the lack of a related vulnerability,
can be done online by human error or is not a risk. For example, you may
offline by disgruntled employees. suggest items as both a potential
Computer risk in Network threat and a vulnerability.
287
Student’s Book Form Six Tanzania Institute of Education (TIE)
A. Risk Identification
C. Risk Evaluation
288
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
These tools include Intrusion Detection
Incident response System (IDS), Anti-Virus, firewall
If our risk management efforts fail, logs, proxy logs, and alerting Security
incident response is available to respond Information and Event Monitoring
to such events. Incident response should (SIEM).
focus primarily on the items you believe
Containment, eradication and recovery
will cause us pain as an organization,
which we should now be aware of based Most of the work to solve the incident
on our research. Risk-management occurs during the containment,
initiatives and the possible reactions eradication, and recovery phase, at least
to such incidents should be based on in the short term.
documented incident response plans Containment: This entails ensuring
reviewed regularly, tested, and practised that the situation does not cause any
by those expected to put them into more damage than it already has or, at
action in the field. The incident response the very least, that any ongoing harm
process, at a high level, consists of the is minimized. Suppose the problem is
following phases: a malware-infected server that a remote
(a) Preparation attacker is actively controlling. In that
case, this may entail disconnecting the
(b) Detection and analysis
server from the network, putting firewall
(c) Containment rules in place to block the attacker, and
(d) Eradication updating signatures or regulations on an
(e) Recovery Intrusion Prevention System (IPS) to
stop the malware traffic.
(f) Post-incident activity
Eradication: During eradication, you
Preparation will attempt to eliminate the issues
affecting our environment. You have
The incident response preparation phase already isolated our malware-infected
includes all of the activities you can server and disconnected it from its
perform before the incident to prepare command-and-control network. Users
us better to handle it. Typically it entails must remove the malware from the server
putting incident response and operating and ensure it is not visible anywhere else
policies and procedures, conducting in our environment.
training and education for incident
handlers and those expected to report Recovery: Lastly, you must come back
incidents, performing incident response to a stable state as you were before the
exercises, developing and maintaining incident (before the issue started), if you
documentation, and other activities. did not detect the problem immediately.
The recovery includes restoring devices
Detection and analysis or data from backup media, rebuilding
In this phase, detection is done as the systems, reloading applications, or other
result of frequently monitoring or related tasks. You also need to mitigate
289
Student’s Book Form Six Tanzania Institute of Education (TIE)
290
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
access control based on your keys.
Moreover, computer system access network’s servers, printers, or shared
control can be implemented in various devices. Access to these devices should
ways depending on the situation. These be restricted, protected, and constantly
include; locking your computer room monitored.
and system, restricting system access to Data Access: Users are constantly
logins and passwords, protecting one’s accessing data from a network resource.
data with file protection or encryption, Files, documents, and databases are
encrypting communication links, or made accessible and adapted by users.
validating a digital signature before Any data that is accessed should be
limited, protected, and monitored.
accessing the data. Authentication
mechanisms have two components Access control methodologies
of access control: authentication and Access control models can implement
authorization. An example of access authorization and deny or grant access
control is when entering a server room to parties based on which resources
or data centre using a physical key or you determine they must have access to
fingerprint authentication, in which something. The term may sound highly
unauthorised users are denied access technical and oriented toward high-
to restricted resources. Essentially, security computing facilities.
the user is prompted to provide a There are five access control
username and password when accessing methodologies which are: Mandatory
computing resources. Another example Access Control (MAC), Discretionary
is when the remote user is prompted to Access Control (DAC), Role-Based
Access Control (RBAC), Attribute-
provide a username and password when
Based Access control (ABAC) and
accessing the network from outside
Multilevel Access Control.
the organization and is denied access
while accessing confidential documents Mandatory access control (MAC)
related to the company or a client. Mandatory Access Control (MAC) is
a type of access control in which the
Types of access control resource owner does not have control
There are three kinds of access control over who has access to it. Still, a group
such as system access, network access or individual determines access with
and data access an authority to set access to resources.
Access to a given resource is frequently
Network Access: Users on a network dictated by the sensitivity label (such
have access to all network resources. as secret and top-secret), the level of
Consequently, network access should be sensitive information that the individual
restricted, protected, and monitored by can access (perhaps only secret),
users who can access the, for example, and whether the individual needs to
the Human Resources (HR) and finance access the resource. Figure 5.14 shows
divisions’ LAN. Mandatory Access Control (MAC).
291
Student’s Book Form Six Tanzania Institute of Education (TIE)
292
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
employee to have access to information Public Turing Test to Tell Computer
about customers’ payment status and and Human Apart, which is used to
information, shipping status, previous provide challenges that are difficult for
orders, and returns to assist customers. the computer to perform but relatively
easy for a human. CAPTCHAs prevent
Attribute-Based Access Control (ABAC)
automated tools from performing tasks
Attribute-Based Access Control (ABAC) such as creating new accounts or posting
is logically based on attributes. These spam comments on blogs. The attributes
can be characteristics of a specific related to a specific resource, such as
person, a resource, or an environment. an Operating System or application,
The elements of a particular individual are resource attributes. When you
are referred to as the subject attributes. encounter software that only runs on a
Humans can select from various features, particular operating system or websites
such as the classic “you must be this tall that only work with specific browsers,
to ride” access control, which exists to we frequently see this happen, though
prevent the difficulties and challenges usually for technical rather than security
of riding on amusement park rides that reasons. You could use this type of
may be hazardous to them. In theory, access control as a security measure by
such an assignment might be difficult for requiring the use of specific software or
a machine to perform since, it can not communication protocols, as shown in
differentiate between human and robot Figure 5.16.
293
Student’s Book Form Six Tanzania Institute of Education (TIE)
294
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
1. Provide traffic flow control File system ACLs filter access to files
2. Provide a basic level of security for or directories and tell operating systems
network access which users can access the system and
3. Decide which types of traffic are what privileges are allowed. When
forwarded or blocked at the router looking at the ACLs in most file systems,
interfaces you will notice three permissions in use,
4. Allow an administrator to control read, write, and execute, which will
what areas a client can access on a enable us to access the contents of a file
network or directory, write to a file or directory,
and execute the file, presuming the file
5. Limit network traffic and increase
contains either a program or a script that
network performance
can run on the system after execution.
6. Screen specific hosts to either allow A file or directory in a file system may
or deny access to part of a network
also be assigned multiple ACLs. For
7.
Deny user permission to access example, in UNIX-like Operating
only certain types of files, such as Systems, separate access lists for a
FTP or HTTP given file can be seen in user, group, and
Importance of access control other ACLs. You can grant an individual
user or a group of different users read,
(a) It ensures that security technology
and access control policies are write, and execute permissions. These
in place to protect confidential three permission sets will be represented
information such as customer as rwxrwxrwx, with the first rwx
secrets and employee data. permission set representing the user, the
(b) Nevertheless, reduce the possibility second the group, and the third the other.
of unauthorized access to physical Furthermore, access permission for
and logical systems. Most businesses each file and directory in UNIX (and
have infrastructure and procedures many other operating systems) is
to limit access to networks, controlled by two identifiers: the User
computer systems, applications, Identification Number (UID) and the
files, and sensitive data such as Group Identification number (GID).
personally identifiable information Every user has a different username and
and intellectual property.
belongs to at least one group. This data
(c) It monitors the system and regulates is retrieved from a password file. Only
by checking each person when the administrator has the authority to
entering and exiting the premises. implement or change a user’s name and
Types of Access Control Lists (ACLs) permissions. From the Linux or Ubuntu
operating system, the ls command is one
The Access Control List involves two
of the essential tools that lists files and
main types: File system ACLs and
Networking ACLs. directories with or without various
295
Student’s Book Form Six Tanzania Institute of Education (TIE)
Figure 5.18: An example of the output that is produced by the ‘ls –l’ command
296
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Figure 5.19(b) shows standard ACL configuration in which R2 is set to block all
trafic from R1 in site A [192.168.10.0/24] which is intended to go to destination
router 3 in site B [192.168.30.0/24]. Router 2 is also configured to filter traffic
from R1 in site A to all destinations reachable through R3. Further, router R3 is
configured to filter traffic from router R1 [192.168.10.0/24] intended for destination
R3 [192.168.30.0/24] .
Extended ACLs
Resembles the gatekeeper of the network that permits or denies traffic originating
from any address on the given/ specified range. For example to permit traffic
originating from any address on range 192. 168.30.0/24, network to any destination
host port 80(HTTP) can be configured through the following command:
access-list 103 permit tcp 192.168.30.0 0.0.0.255 any eq 80
Extended ACLs filter IP packets based on several attributes, including the following:
(a) Source and destination IP address
(b) Source and destination TCP and UDP ports
(c) Protocol type/ protocol number (example: IP, ICP, UDP, TCP)
Figures 5.19 (c) shows the extended access control lists configuration.
297
Student’s Book Form Six Tanzania Institute of Education (TIE)
298
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Internal network External network
Figure 5.20: Firewalls
Types of firewalls
There are two types of firewalls: packet the data link, network, and transport
filtering and proxy firewall. layers. The firewall compares data in
each datagram at each layer, such as the
Apart from that, there are variations of
source and destination addresses (The
two types of firewalls, commonly called
type of service requested and the type of
gateway or bastion.
data delivered). A data packet is denied,
accepted, or delayed based on one or
Packet filtering firewall more conditions: source address, a
A packet filter firewall is a multilevel destination address, TCP or UTP source
firewall that compares and filters all and destination port, ICMP message
inbound and sometimes outgoing type, Payload data type, Connection
network traffic passing through it. It initialization, and datagrams using TCP
contrasts those packets to a predefined ACK bit.
set of rules. The firewall accepts the Moreover, a packet filter firewall is itself
packet that matches a rule. A package divided into two configurations. One is
is rejected or logged for further a straight packet filter firewall, which
investigation if it does not match a rule. allows full-duplex communication.
Additional data packet screening may This two-way communication is made
be required for further investigation, possible by following specific rules
in which case the firewall directs the for communication application proxy.
datagram to the screening device. Travel traffic in each direction for each
Following further screening, the datagram is examined for the particular
datagram may be allowed through criteria given above, and if conformity
or denied. Many filter firewalls use to direction-specific rules is established,
protocol-specific filtering criteria at the firewall lets the datagram through.
299
Student’s Book Form Six Tanzania Institute of Education (TIE)
duplex filter firewall; however, it filters one-way rules for the stateful inspection
using a more complex set of criteria that filter firewall. Figure 5.21 shows the
involve more restrictions than those packet filter firewall.
Proxy firewalls
A proxy firewall is a network security system that safeguards network resources by
filtering messages at the application layer. A proxy firewall is also referred to as an
application firewall or a gateway firewall. Figure 5.22 illustrates the proxy firewall.
300
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Application-level proxy firewalls
A firewall generates a proxy for each application developed by a communicating
element. The proxy firewall inspects and forwards each application-generated traffic.
The presence of an application proxy makes logs and controls incoming and outgoing
traffic, offering a higher degree of security such as, user-level authentication, end-
to-end encryption, intelligent logging, information hiding, and access restrictions
based on service types. A proxy filter firewall is shown in Figure 5.23.
Internal networks like LANs usually have multiple application proxy firewalls,
including telnet, WWW, FTP, and SMTP (email). Although application proxy
firewalls are great as high-level filtering devices; they are more expensive to
install because they may require installing a proxy firewall for each application an
organization has, and that can be expensive to acquire, install, and maintain.
301
Student’s Book Form Six Tanzania Institute of Education (TIE)
filter and proxy firewalls, which gives it a record it as a log file to be used later
medieval castle flavour. Packets from the for statistics on network usage.
local network and outside the Network (iv) Prevention of modification of
can only reach their destinations through valuable information.
a firewall by passing through the filter
router and proxy by the station. Each Intrusion detection and prevention
application gateway combines a general- system
purpose router that acts as a traffic filter Intrusion detection
with an application-specific server that This refers to software or device
all application data must pass through. which monitors the network traffic for
Function of firewall malicious activity or policy violations.
Detecting intrusions is based on models
The following are the functions of and patterns of what something good
firewall: looks like (typically built by normal
(i)
As a network security guard. baseline behaviour) and looking for
It filter all traffic that enter and deviations/anomalies. These systems
leave the network according to the learn primarily by observing our
predefined roles, mechanisms and networks and systems in use and then
policies. simply having a much higher knowledge
(ii) Prevention of information leaking about the traffic. From this point of
without knowledge. Through a set view, IDS can reclaim attention when
of protocols, such as, FTP it can combined with a policy enforcement
detects and prevent users from system such as MAC to take action
sending valuable data to other against wrong sources of malicious
parties. traffic. Figure 5.24 depicts the intrusion
detection system and possible locations.
(iii) Keeping records of user activities.
302
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Typically, there are two types of IDS
which are Host-based IDS and Network- decision based on the system’s policy.
based IDS/IPS It should be capable of detecting both
Host-based IDS known and unknown attacks. The
majority of HIDS products can also
Host-based Intrusion Detection System is prevent attacks.
typically a software-based deployment
IDS in which an agent is installed on Nevertheless, it is initially deployed in
the local host to monitor and report the monitor mode, and once the system
on application activity, as depicted activity is understood, a baseline is
in Figure 5.25, HIDS monitors the created, and HIDS is deployed in the
system and access privileges and prevention mode. The functionality of
sends alerts for any unusual activity. HIDS depends on the records and the
It continuously monitors event logs, fact that attackers leave indications of
system logs, application logs, user their activities.
policy enforcement, rootkit detection, In general, hackers seek to gain access
file integrity, and other computer system to the system and install malicious tools
intrusions. to facilitate future access. If these tools
It continuously monitors these logs alter the operating system configurations
and establishes a baseline. If any new or registry entries, it is logged in the
log entries appear, HIDS compares the systems/event log, triggering an alert by
data to the baseline, and if any entries the HIDS system. Figure 5.25 shows a
are found outside of the baseline, HIDS host-based intrusion detection system.
generates an alert. If any unauthorized
303
Student’s Book Form Six Tanzania Institute of Education (TIE)
Network intrusion detection systems (IDS) and intrusion prevention systems (IPS)
protect the network and its resources from a network malicious activity standpoint.
For example, network intrusion detection systems (IDS) can detect reconnaissance
and denial-of-service attacks at the network level. As soon as these threats are
detected, NIDS generates alerts. NIDS is a hardware/software solution that operates
as an independent device (sensor) near the firewall and has a network operating
system (TCP/IP stack). Sensors have interfaces for monitoring the network
(monitoring interfaces), controlling and receiving alerts, and sending these alerts
to the central management console. Figure 5.26 depicts network-based intrusion
detection and prevention system.
IDS/IPS is another network-based intrusion detection which employs signature-
based and anomaly-based detection techniques.
304
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Figure 5.27: Intrusion Prevention System (IPS)
305
Student’s Book Form Six Tanzania Institute of Education (TIE)
306
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Secure Sockets Layer (SSL) and Transport Layer Security (TLS) generate a VPN
connection where the web browser acts as the client. User access is prohibited
to specific applications instead of the entire network. Online shopping websites
commonly use SSL and TLS protocols. It is easy to switch to SSL by web browsers
and with almost no action required from the user as web browsers are integrated
with SSL and TLS. SSL connections have “https” in the initial of the URL instead
of “http”.
Secure Shell (SSH)
Secure Shell generates the VPN tunnel through which the data transfer occurs and
ensures that the tunnel is encrypted. An SSH client causes SSH connections, and
data is transferred from a local port to the remote server through the encrypted
tunnel. Figure 5.28 shows Secure Shell (SSH).
307
Student’s Book Form Six Tanzania Institute of Education (TIE)
308
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
309
Student’s Book Form Six Tanzania Institute of Education (TIE)
310
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
performance. Every time a client needs proof safe where in case of any damage
to communicate over the network, a copy can be taken from on-site or
the client must establish a session and off-site to restore. A benefit is that files
encrypt the data to be sent. The recipient that have become fragmented can be
must decrypt the data. This process
reorganised to occupy contiguous space
increases the amount of network traffic
and requires network client machines when restored, resulting in quicker
to spend more time and CPU resources access.
encrypting and decrypting data. There
should be network cards that can take Types of data backups technologies
the encryption and decryption process
Digital linear tape (DLT) or Linear tape-
away from the CPU. Hence, it prevents
network clients from undergoing poor open (LTO) systems: These are rock solid
performance. which helps to address storage capacity
and access time. They also, increase the
total capacity and speed of the tape and
Exercise 5.3
disk when information is backed up into
1. What is Data Loss Prevention (DLP)? the tape.
2.
Type an E-mail message to your Robotic auto-changers are available for
teacher asking for test two (2) results. DLT, and LTO drives with plenty of
Apply the skill you have mastered headroom and can hold five tapes up to
in the session to encrypt email and large libraries that hold tens or hundreds
show how a message you sent was of videos.
encrypted. DLT S4 (800GB per tape) and LTO – 6
(2,500GB per tape): These are very fast
3.
When someone tries to send an and reliable with high per tape capacities.
encrypted message to your E-mail, Examples: Tape Vaulting, Remote Tape
what does an encrypted message Backup, and Offsite Backup.
look like for the external user?
Cloud Storage: Cloud storage involve
storing data to online servers located
and hosted somewhere else. This
Data backups and disaster recovery backup solution is unique because you
Data backup is the periodic storing of can back up all your local files and
copies of copied files regularly and securely store them in your chosen cloud
keeping them in a safe place or a safe provider. Caution on security should be
storage device. considered because the data are stored in
a third party.
Importance of data backup and
disaster recovery Even if your data centre experiences a
catastrophic event, your hosted data and
When files have been restored, they can territories will be preserved when using
be reorganized to occupy contiguous this type of backup.
311
Student’s Book Form Six Tanzania Institute of Education (TIE)
(a)
Keeping backups safe; backup
copies need to be held in a fireproof stand-by when it fails.
safe or preferably offsite Clustered servers are typically used
for applications that require frequent
(b) Data backups restorations strategies
data updates, with file, print, database,
(c) Keep the daily backups for a week and messaging servers being the most
(d) Keep Fridays back up for a month common clusters. Overall, clustering
(e) Keep one backup each month for a servers provide clients with higher
year availability, reliability, and scalability
than any single server could. In a
(f) To prevent mix-ups, give each tape clustered hosting environment, each
or disk a serial number and keep a server is responsible for the owners and
logbook control of its own devices and for getting
a copy of the operating system (along
Data recovery mechanism with any applications or services) used
Testing recovery procedures and the to run the other servers in the cluster.
effectiveness of backup systems need to Electronic Vaulting means that data are
be done regularly. It helps to ensure that backed-up. The output is electronically
a business can recover from a disaster. transmitted to a secured offsite storage
An additional contingency plan must location. Examples of server clusters are
be developed to consider alternative Tape Vaulting, Remote Tape Backup,
compatible equipment and security and Offsite Backup.
facilities, including temporary
office space provision of alternative Remote journaling
communications links. Remote journaling and electronic
vaulting are mainly used in systems
Fault tolerance mechanisms where data is a priority, ensuring that not
even a tiny section of the information
Fault tolerance is the ability of a system is changed or lost. It is the process
like a computer, network, cloud or of recording transactions at remote
cluster to continue operating without locations as a backup strategy. It allows
interruption when one or more of its the user to capture the occurrence of
components stop working. It includes changes and then copy them to a different
a server cluster, remote journaling, and location. It also keeps changes in data
server mirroring to secure situations. since the previous save. Recovering
Server clustering data requires replaying the changes and
A server cluster is a group of servers cleaning up any changes.
that work collaboratively on a single
system to provide users with increased Server mirroring
availability. These clusters mitigate Server mirroring is a network control
downtime and outages by allowing process that continuously creates an
some other server to take over in case exact copy of a server. Server mirroring
312
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Furthermore, it is primarily used to build A vulnerability analysis is a review that
a fault-tolerant and redundant server focuses on threat protection issues that
computing infrastructure. This process have a moderate effect on the system’s
is carried out by using specialized security.
backup software installed on the backup
server and the server to be mirrored. The
software routinely synchronizes and Penetration testing through hacking
backs up data from the primary server to Penetration testing is a method of
the backup server via a secure Internet testing the security of a network and the
connection or VPN. vulnerability of a company’s systems
and infrastructure by employing
ctivity 5.10: Creating
A various tools and techniques used by
backups attackers. The approach is similar to an
Resources: Sample files, a computer, attacker: enumerate the network, assess
external storage devices such as HDD, vulnerabilities, research vulnerabilities
memory sticks, internet connectivity and for known exploits, and then use
an active yahoo or Gmail email address, methods available to penetrate the
a computer and a smartphone. network. The attackers list a grid to
decide which machines are connected
Procedures:
and operationally useful for both an
1. Open your computer and access the
intruder and a system administrator. The
internet
data obtained from a network scan aids
2. Create an e-mail account if you
in determining the actual current layout.
don’t have one
3. Install and configure any cloud A few tools and techniques are available
storage tools such as Dropbox for both the Windows and Linux
4. Create a folder on your computer platforms to perform these tests. After
and link it to your cloud storage identifying the devices and their open
5. Save your file in the folder on your ports, a vulnerability scanner can be used.
computer and then The scanner will use its vulnerability
6. Use the smartphone to see if you database to see if the system has any
can access the file from such a vulnerabilities. These vulnerabilities
computer. are then researched further online, and
7. Make several copies of your file utilities that can be used to breach the
into the storage devices you have network are downloaded and executed.
A good penetration test should produce
8. Try to think about what will happen
if your flash is lost or corrupted a report explaining the weaknesses
discovered, ranking them from most
9. Share with your colleague and then
to the class and suggest the best critical to least critical, and offering
option for your class. suggestions for improving network
security.
313
Student’s Book Form Six Tanzania Institute of Education (TIE)
314
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
As the name implies, they are motivated
by white and black hat hacking political, or social gain.
motivations. They are the ones who State/Nation Sponsored Hackers
use both illegal and legal techniques to The government hires hackers to
exploit or improve a system. Moreover, gather information on other countries.
if a grey hat hacker exploits another These hackers are referred to as State/
person’s plan, they usually notify the Nation sponsored hackers. They use
owner of the exploits and then offer their knowledge to obtain confidential
suggestions on improving system information from other states to prepare
security. well for any potential threats to their
Script Kiddies country. The sensitive information
The Script Kiddies are a type of hacker aids in being on top of every situation
who is an amateur in hacking. They are and avoiding impending danger. They
trying to hack the system using scripts only document to their respective
written by other hackers. They are trying governments.
to compromise systems, networks, or Malicious insiders or Whistle-blowers
websites. The goal of hacking is to These types of hackers include
gain attention from their peers. Script individuals working in an organization
Kids are people who are unaware of the who can expose confidential information.
hacking process. The intent behind the exposure might
Red Hat Hackers be a personal grudge against the
Red Hat Hackers, sometimes called organization, or the individual might
Eagle-Eyed Hackers, are the same types have encountered illegal activities
of hackers as white hackers. The red within the organisation. The reason for
hat hackers intend to thwart the black disclosure defines the intent behind the
hat hackers’ attack. The distinction exposure.
between red hat and white hat hackers Hacking process
is in the process of hacking through The hackers always perform penetration
intention. Red hat hackers are ruthless testing processes. The process involves
when dealing with black hat hackers or a functional examination of the target
combating malware. The red hat hackers system for potential vulnerabilities from
continue to attack, and the entire system poor or incorrect system configuration,
setup may be changed. known and unknown hardware or
Hacktivist software flaws, and operational flaws in
These hackers intend to compromise process or technical countermeasures.
government websites. They pose as The hacking process has five phases. These
activists, which would be known as are:
a hacktivist. A hacktivist can be a (a) Reconnaissance
single person or a group of anonymous (b) Scanning
hackers whose goal is to gain access
to government websites and networks. (c) Access (gaining access)
315
Student’s Book Form Six Tanzania Institute of Education (TIE)
316
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
can be crowd-sourced from the internet allows you to examine every cookie on
through forums and other online hubs a website and initiate connections within
dedicated to hackers. Below are popular website applications.
hacking tools used today. Ettercap
Angry IP Scanner (ipscan) This tool helps launch man-in-the-
This tool commonly referred to as middle attacks, designed to make two
ipscan by experienced hackers, tracks different systems believe they are
computers using their IP addresses and communicating. At the same time, a
snoop for port numbers to look for hacker secretly relies on a different
gateways that will lead them directly message from the other. It helps to
into a targeted computer system. This manipulate or steal transactions or data
tool is also commonly used by system transfers between systems and listen in
engineers and administrators to scan on conversations.
for potential vulnerabilities in their Metasploit
authorised infrastructures. These are
examples of open-source software that Metasploit is well-known among
seems to be freely available. hackers because it is an effective tool
for identifying potential security issues
Kali Linux and validating system vulnerability
This Linux Operating System is one of mitigations. It has been one of the best
the favourites of hackers launched in cryptography tools for hackers since
2015 due to its abundance of features. it effectively masks the identities and
This security-centred toolkit allows you locations of an attack.
to run it right from a CD or through Wireshark and Aircraft-ng
a USB without any installation. It
contains most of the interfaces you need These tools detect wireless connections
for hacking, including creating fake and hack user IDs and passwords on a
networks, spoofing messages, and even Wi-Fi network. Wireshark is a packet
cracking Wi-Fi passwords. sniffer, and Aircraft-ng is a packet
capturing suite that allows monitoring of
Cain & Abel Wi-Fi security with various other tools.
Cain & Abel is one of the most effective Note: Brute force is one of the most
hacking toolkits for Microsoft operating effective techniques the attacker and
systems. This tool allows you to recover crackers use to crack login details such
wireless network passwords, and user as passwords and utilises the dictionary
account passwords, and crack passwords attack. While most hackers genuinely
using a few brute force methods. It think that brute force tactics take too
could also be used to record VoIP long to crack a password, John the
conversations. Ripper is one of the more efficient tools
Burp Suite for recovering encrypted passwords.
When mapping out vulnerabilities
317
Student’s Book Form Six Tanzania Institute of Education (TIE)
318
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
and its employees.
1.
What reasonable steps could the
(b)
Employees in an organization company have taken to prevent
should be restricted from using the Angela from finding out about
corporate network to access social company hardware, like router
networking sites. models?
(c) Devices and servers should be set 2.
What steps should the company
up to prevent data leakage. take to prevent or reduce the
efficacy of port scans?
3. Hashimu is a network administrator
Activity 5.10: for the ATCL Company. Hashim
Carry out the penetration test using the has been passed over for promotion
following procedure and produce a test three times. He is pretty vocal
report. in his dissatisfaction with this
situation. He begins to express
1. Footprinting and reconnaissance negative opinions about the
2. Scanning (and vulnerability organization in general. Eventually,
assessment) Hashimu quits and starts his own
3. Enumeration consulting business. Six months
after Hashimu’s departure, it was
4. Attacks or hacks
discovered that a competitor had
5. Security measures suddenly duplicated a good deal
6. Reporting of the ATCL Company’s research.
Executives at ATCL suspect that
Hashimu has done some consulting
work for this competitor and may
Exercise 5.4 have passed on sensitive data.
However, since Hashimu left, his
Scenario: Angela is a hacker committed to
computer has been formatted and
breaking into the TTCL Company. Eliza
reassigned to another person in
uses various passive reconnaissance
the interim. ATCL has no evidence
techniques and gathers extensive
that Hashimu did anything wrong.
information about the company. Angela
What steps might have been
discovers what model routers are used
taken to detect Hashimu’s alleged
from network administrator questions/
industrial espionage? What steps
comments in user groups. Again, she
might have been taken to prevent
finds a complete list of the IT staff and
his perpetrating such an offence?
their phone numbers from a personnel
directory on the company website. Also, 4.
Discuss the countermeasure of
she could find out what services were hacking via footprint attack.
running using a port scan.
319
Student’s Book Form Six Tanzania Institute of Education (TIE)
320
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
and its data are accessible to anyone The Internet of Things (IoT) is defined
via the Internet, authentication and as sophisticated interaction between
encryption are more critical than ever in the physical and digital world using
the public cloud.
sensors and actuators that support
Separation of a cloud provider’s users computation and network capabilities
(who may be competing companies or in any conceivable object located
even hackers) is one of the more obvious anywhere. Security in the IoT requires
cloud concerns to avoid accidental access special treatment because most Internet
to classified data. A cloud provider security measures need high-processing
typically uses virtual machines (VMs) machines amid the limited-processing
and hypervisors to separate customers. capabilities of sensors and actuators used
Currently, technologies available can in most IoT systems. Due to the limited
significantly improve the security of
resource capability, the security of IoT
VMs and virtual network separation.
considers three layering perspectives of
Furthermore, the trusted platform
sensing, network, and application that
module (TPM) can perform hardware-
map functions in support of IoT systems.
based confirmation of hypervisor and
VM integrity, helping to ensure good Security threats in IoT
network separation and security.
As depicted in Figure 5.32, IoT systems
Finally, legal and regulatory issues are have different security threats that
critical in cloud computing because they need different measures depending on
have security implications. To ensure the threatened function. For instance,
that a cloud provider has solid policies the common security threat to the
and practices to address legal and
sensing layer of IoT systems includes
regulatory issues, each customer must
the unavailability of devices, network
have its legal and regulatory experts
access, and seamless integration of
inspect its policies and procedures to
the device. Common network layer
ensure their sufficiency. Information
threats include routing modification,
security and transmission, compliance,
congestion that leads to denial of
auditing, data retention and destruction,
and legal discovery are all issues to service, unauthorized access to the
consider. Trusted storage and trusted network link, and data leakage. The
platform module access techniques can common threats to the application layer
play a crucial role in limiting access to include unauthorized use of collected
sensitive and vital data in data retention data, information leakage
and deletion.
321
Student’s Book Form Six Tanzania Institute of Education (TIE)
Information
leakage Routing
Lay ation
Ne ayer
modification
tw
L
er
plic
ork
IoT
Ap
Privacy Denial of
leakage service
Sensing
Layer
Seamless
intergration
Availability
Network
access
322
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The security requirements for the IoT system. Therefore, an organisation
application layer must guarantee end- has to employ security personnel; this
authentication method may include
to-end security, incremental deployment
electronic images for the guard to
and privacy to ensure privacy and
examine or a call to another employee
information leakage as well as authorise
to vouch for the individual. Some
the usage of information analyzed from businesses solely rely on the employee’s
collected data. signature in the appropriate register.
Physical security
Concepts of physical security Activity 5.11:
Physical security protects personnel, Search from libraries and the Internet
hardware, software, networks, and data specifically on the concept of physical
from physical actions and events that access control. Write a brief description
could cause profound loss or damage to
of physical access controls using the
an organization or institution. To enhance
following heading:
physical security the organisation
they use one or more options such as Meaning, types, importance and
installing camera, locks and deploying methods of enforcing physical access
security guards. control in security.
Categories of physical threats
When someone attempts to steal Physical security controls
someone else’s computer resources Physical access controls are an essential
or information, this is referred to as layer of preventive or detective controls
theft. For example, when a fire occurs that supplement or complement other
or there is heavy rainfall leading to
forms of control in mitigating the risk
flooding causes damage to computer
of inappropriate or improper access and
resources. This lead to losing personal
information modification.
or organisation’s important information.
Physical access control systems Types of physical security controls
Physical control involves security There are various types of physical
devices such as installation (CCTV control such as deterrent, detective, and
camera), and biometric fingerprint. preventive.
Employees with cameras watching their Deterrent
restroom trips or who must wear badges
to enter a facility will need time to adjust Deterrent controls are intended to avoid
to the new circumstances. Suppose anyone attempting to sidestep security
badges are to be provided to employees; controls, whether the intruder is from
in that case, the organization must also either external or internal. A variety of
implement a system for tracking the measures could be considered deterrents,
procedure for dealing with employees including several overlapping measures.
323
Student’s Book Form Six Tanzania Institute of Education (TIE)
324
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Evacuation is one of the best methods Particularly in extensive facilities,
to keep our people safe. In almost a complete evacuation can be a
any dangerous situation, an orderly complicated prospect. If you do not
evacuation away from the source of evacuate quickly and correctly, many
danger is the best thing you can do. lives may be lost in a genuine emergency.
When you make a thorough plan for an As an unfortunate attestation to this, you
evacuation, you ask yourself four basic can look at an example of attacking the
principle questions of where, how, who, 1998 US embassy in Dar es salaam.
and practice.
Where Administrative control
Where we will be evacuating is an Administrative systems are typically
essential piece of information to consider based on a set of rules. They can
in advance, whether we are evacuating be policies, procedures, guidelines,
a commercial building or a residence. regulations, laws, or other similar
We need to get everyone to a rallying bodies, and they can be implemented
point to ensure a safe distance and that at any level, from informal company
you can account for everyone. If we policies to legal provisions.
do not do this orderly and in consistent
fashion, you may have various issues. Businesses put several standard practices
In commercial buildings, evacuation to protect our people and our interests in
meeting places are often marked with general. The background check is one
signs and on evacuation maps. of the most common. When candidates
have progressed far enough through
How the hiring process, they are likely to be
When planning such routes, you should hired. Often, the hiring company will
consider where the nearest exit from a conduct a background check. Accu
given area can be reached and alternate Screen and LexisNexis are significant
routes if some courses are impassable firms that work such background checks
in an emergency. Also, avoid using worldwide. Depending on the location,
dangerous sites or unusable exits in such investigations will typically
emergencies, such as elevators or areas include criminal history statements,
that might be blocked by automatically past employment verification, proof of
closing fire doors. schooling, credit checks, drug testing,
Who and other items.
The most vital portion of the evacuation Examples entail drug tests administrated
is to ensure that you get everyone out by certain employers. Also, visit
of the building and that we can account any checks expected at the start of
for everyone at the evacuation meeting employment and are repeated similarly.
place. This process typically requires at Whether or not such verification is
least two people to be responsible for performed frequently depends on the
any given group of people: one person to specific employer in question, and some
ensure that everyone is liable to be safe. companies may not conduct them at all.
325
Student’s Book Form Six Tanzania Institute of Education (TIE)
326
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Hard-disk loading to the renter. Because of the nature of
its distribution, this method of piracy is
Hard-disk loading occurs when the not as standard as other forms of piracy,
individual or business sells computer but it still occurs. Renting unauthorised
systems preinstalled with illegal access copies of software has always
software updates on hard discs to entice been illegal.
customers to purchase their products
because this type of activity is intended. Ways to reduce software piracy
Software counterfeiting Enforcing strong laws, introducing
penalties, creating awareness and
The illegal duplication and sale of selling software at affordable prices can
copyrighted software to appear authentic minimise software piracy.
are known as software counterfeiting.
Counterfeit software includes the original Software companies are required
legitimate computer’s accompanying to implement anti-piracy protection
manuals and is typically sold below the mechanisms on their software-based
legitimate software’s retail price. It is a products.
type of software piracy, and numerous Enforcing strong laws: The government
organizations are working hard to and software associations should
stop it. Though counterfeit software enforce strong laws/ acts and creates
is inexpensive and widely available, awareness among users. The users
it is dangerous because it may contain should understand that, using pirated
ransomware. software carries high penalties under
Unauthorized use of academic software copyright law for users caught in the act.
They can be penalised and sentenced to
Many software companies sell jail or both punishments.
academic versions of their products to
public schools, universities, and other Product key: The anti-piracy system
educational institutions. The software of using the product key is the most
labelled only for academic or educational reliable. It uses a unique combination
purposes cannot be used for commercial of letters and numbers to differentiate
or other for-profit purposes. Using copies of the software. A product key
educational software for individual ensures that only one user can use the
use in violation of the software licence software per licence or purchase.
creates software piracy. It harms both Legal protection: Companies should
the software publisher and the institution ensure that their software is legally
entitled to receive the software. protected by implementing user
Renting agreements. This practice will inform
consumers that making unauthorized
Renting comprises someone renting copies is against the law. The user
out a copy of the software for business agreement will help prevent people from
or for short-term use, without the unknowingly breaking piracy laws.
copyright holder’s permission. In this
327
Student’s Book Form Six Tanzania Institute of Education (TIE)
328
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
How can you tell if a vendor has which strongly bears competitiveness
the legitimate right to sell another and growth. It influences investment
company’s software? decisions and the organization of
4. What are the risks associated with production. It plays a central role in how
using pirated software? societies distribute the benefits and bear
the costs of development strategies and
policies. For example, owners of the
Intellectual property land, corporate shares, or intellectual
Intellectual property refers to any property are unwilling to invest in the
creation of human mind that is protected improvement and keep up their property
by the law from unauthorised use. if their rights as owners are insecure.
Intellectual property is of the several Finally, intellectual property promotes
distinct types of legal monopolies over innovation. The different forms of
creations of the mind, both artistic and intellectual property, such as patents,
commercial, and the corresponding copyright and trademark, were similar
fields of law. Under intellectual property to traditional legal rights viewed as
law, owners are granted certain exclusive state favours of moral rights. However,
rights to a variety of intangible assets, IP rights are an essential economic
such as musical, literary, and artistic mechanism, an ‘intellectual currency’ of
works; discoveries and inventions; and sorts.
words, phrases, symbols, and designs. Legal issues on intellectual properties
Copyright, patent, and trademark, and They are focused on the use and
trade secrets are protected by both
ownership of computer software which
national and international laws.
is essentially a question of power
Importance of intellectual properties relations between persons today and for
Intellectual properties usually generate many years into the future;
economic activity and jobs in other 1. the forms of legal protection provided
sectors. Domestic companies in are both contingent and far from
developing countries also rely on the coherent in many dimensions; in other
trademark system to protect their brands words, such forms of protection are
at home and abroad. As with patents, not inevitable and could be changed,
trademarks are on the rise in developing indeed quite dramatically changed,
countries. Domestic companies
through reforming the structures and
constitute a substantial part of the users
content of legal regulation;
of these trademark systems. Compared
to developed countries, there is a high 2. the granting of intellectual property
rate of use of the trademark system in to computer software is a form of
developing countries relative to the legal subsidization to a particular
Gross Domestic Product (GDP). industry and technology; and
329
Student’s Book Form Six Tanzania Institute of Education (TIE)
directly impacted the ownership The main feature that makes proprietary
and user regimes that have been software different from open source is
established; the alternatives to that, in open source, the user has the
proprietary, open-source, and free freedom to use the software, own it free
software have been a philosophical and redistribute it to other users rather
and practical response to the current than proprietary software which is
legal issue. intended for selling for earning money.
330
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The legal issue in a computer system is
the area of an individual’s right to privacy the chance that the electronic document
versus the greater good of a larger entity has been altered must be developed.
such as a company or a society. Moreover, the protection of privacy
For example, tracking how employees in data and international policies pave
use computers, crowd surveillance, the way for the rapid development of
managing customer profiles, and networks and information processing.
monitoring a person’s travel with a Today, the computer allows large
passport. The legal issue is ensuring quantities of personal information to
the security of stored and transmitted be quickly acquired, exchanged, stored
information. and coordinated. As a result, the market
for computer-matched personal data has
The laws currently governing expanded rapidly, and the private-sector
commercial transactions, data privacy, information industry has grown around
and intellectual property were primarily the demand for such data.
developed for a time when telegraphs,
typewriters, and mimeographs were the Lastly, intellectual property is protected
commonly used office technologies, in the administration of digital libraries.
and business was conducted with paper The availability of protected intellectual
documents sent by mail. Computers, property in networked information
electronic networks, and information collections, such as digital libraries
systems are now used to process, and other digital information banks,
store, and transmit digital data in most is straining the traditional methods of
commercial fields. As the spread and protection and payment for the use
use of information technologies in the of intellectual property. Technologies
business world have quickened, the developed for securing information hold
failure of current laws to meet the needs promises to monitor the use of protected
of a digital, information-based society information and provide a means for
has become apparent. collecting and compensating intellectual
property owners.
331
Student’s Book Form Six Tanzania Institute of Education (TIE)
332
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
security tasks, such as Penetration click on things on your desktop.
Testing, Security Research, What should you do?
Computer Forensics and Reverse 4.
Distinguish between a Copyright
Engineering. and a Trademark.
3.
Lastly, the advancement of 5. What is the defining difference
technology brought ethical between computer security and
hacking into a business in society; information security?
consequently, cybercrimes,
terrorism crimes and money fraud 6. How informed do you keep yourself
robbery activities give a chance on network security-related news,
to nourish. Increasing crimes in and how often do you check out
society lead to existing software these stories? Where do you get
piracy and copyright that make your security news?
all misbehaviours and criminal 7. Do you think, for security reasons,
offences should be dealt with everything that happens on the
according to its laws. internet should be analysed by
public security services?
8. Elaborate on the following five
cybersecurity risks in the banking
Revision exercise industry: (a) Unencrypted data, (b)
1. Discuss in detail the risk assessment Malware, (c) Third-party services
process. that are not secure, (d) Data that
2.
A friend sends an electronic has been manipulated (e) Spoofing.
e-greeting card to your work email. 9. Define the term hijacking as it
You need to click on the attachment relates to cybersecurity.
to see the card. A while back, the 10.
Evaluate the weakness and
IT help desk received several the strengths of the Tanzania
complaints that one employee’s Cybercrime Act 2015
computer sent out Viagra spam.
They checked it out, and the 11. You discover an active problem in
reports were accurate. A hacker your organization’s network, but
had installed a program on the it’s out of your sphere of influence.
computer that automatically sent There’s no doubt that you can fix it,
out tons of spam emails without though, so what do you do?
the computer owner’s knowledge. 12.
What type of physical access
How do you think the hacker got control might you put in place to
into the computer to set this up? block access to a vehicle?
333
Student’s Book Form Six Tanzania Institute of Education (TIE)
Chapter
Six
career and environment
Introduction
Advances in Information Technology (IT) can never be discussed without associating
them with users (people) and their environments. Users’ knowledge of the benefits of
IT and their ability to apply that knowledge can lead to a successful personal career.
IT facilitates organisations to achieve their objectives and helps society to acquire a
superior quality of life. Hence, communities, businesses, and industries worldwide
reap huge benefits from IT if it is deployed intelligently and carefully. Therefore,
information systems must also be developed to be accepted and work well and safely
within their environments based on the intended business and country’s goals and
strategies. In this chapter, you will learn more about IT career opportunities and
the IT environment. The competence gained will enable you to effectively manage
businesses or guide you in making the right IT career choice.
334
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
revolutionising how they undertake their production schedule
daily activities. In that regard, there are (g)
Maintaining computer equipment
many areas where a person can work as and inventory and organise repairs
an IT professional. For example, when as needed
you anticipate working as a system
administrator, there are several roles, (h)
Creating and managing users
that you are required to perform. The credentials to ensure the security of
most common career opportunities the organization.
are such as, Computer operator,
Computer technician
Computer technician, computer system
analyst (CSA), System administrator, A computer technician regularly
Computer programmer, Network maintains, upgrades, and repairs
architect/or Network administrator, computers and their accessories. The
Cloud computing engineer, Database computer technician is on the front lines
administrator, IT project manager, Web of IT and performs the following duties:
developer, Information security officer, (a)
Troubleshooting and solving
Business Intelligence Analyst, and problems related to hardware and
Mobile application developer. software
(b)
Assembling, upgrading computers
Computer operator
and installing software patches and
According to standardised operating upgrades
instructions, the computer operator
(c) Monitoring servers and networks
monitors and manages computers and
electronic data-processing equipment. (d)
Maintaining computers and
Depending on the employer or peripherals, and managing data
employing institutions, key roles of the security
computer operator might include: (e)
Ensuring that computer systems
(a)
Managing and improving a are all optimised and run efficiently
company’s network performance (f)
Addressing users’ explanations of
by troubleshooting hardware and computer problems and evaluate
software problems their needs
(b)
Entering batch data into the (g)
Guiding users through the steps
computer for processing necessary to resolve their problems
(c) Logging all information processing and train them to use computer
activities and exceptions hardware and software properly.
(d) Performing backup to reduce the
Computer Systems Analyst
risk of data loss
A Computer Systems Analyst (CSA) is
(e) Identifying and correcting file and
responsible for analysing and designing
system errors
hardware and software tools to improve
335
Student’s Book Form Six Tanzania Institute of Education (TIE)
336
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
A Network administrator is responsible key responsibilities of a cloud computing
for analysing, defining, designing, engineer may vary depending upon
building, and maintaining various data the vertical position. Cloud computing
communication systems and networks, engineer may have many other
including LANs, WANs, and the subcategories of career, including;
Internet. The central roles of a Network (a) Cloud security engineer
administrator include the following: (b) Systems engineer
(a) Analyse the workflow and network (c) Cloud developer
security needs and establish the
network (d) Cloud architect
(b)
Assess network performance (e) Network engineer
problems and provide solutions
A Cloud computing engineer
(c)
Network installation and testing is responsible for the following
of equipment, connections, and responsibilities:
firewalls
(a) Developing and maintaining cloud
(d) Define the policies and procedures solutions following best practices
related to the network
(b) Designing and developing modular
(e) Monitor and analyse the network cloud-based systems
and troubleshoot related problems
(c) Ensuring efficient functions of data
(f) Fine-tune the network to enhance storage and processing functions in
the performance for users the cloud infrastructure
(g) Implement, monitor, and evaluate (d)
Responsible for securing cloud
security protocols infrastructure and its components
(h) Train the end-users on the safe and (e)
Conducting and managing data
secure use of the network analytics in the cloud environment
(i)
Test, evaluate, install network (f)
Providing technical support for
enhancements periodically and cloud clients and users in the
update the network organization
(j)
Maintain accurate documentation
and records of the network Database administrator
Nowadays, organisations and businesses
Cloud computing engineer produce and collect large amounts
A cloud computing engineer is of data to run their daily operations.
responsible for defining, designing, Therefore, the database administrator
implementing, and maintaining systems is needed to store, secure, and organise
and solutions that rely on cloud systems, the company’s or organisation’s
platforms, and infrastructure. The three massive data. The roles of a database
major types of cloud Engineers are administrator are as follows:
337
Student’s Book Form Six Tanzania Institute of Education (TIE)
338
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(a)
Monitor the systems for security A mobile application developer is a
risks or possible vulnerabilities software developer specialising in
(b)
Supervise the organisation-wide mobile technology, such as developing
implementation and management various applications (or apps) for Google’s
of safeguard measures such as Android, Apple’s iOS, and Microsoft’s
firewalls and antivirus software Windows Phone platforms. The typical
(c) Prepare reports related to security roles of a mobile application developer
risks and guide on the prevention include the following:
measures (a)
To prepare the entire application
(d)
Ensure timely systems testing to lifecycle (concept, design, test,
identify potential weaknesses and release, and support)
implement solutions
(b) To generate fully functional mobile
(e) Monitor network usage to ensure applications by writing clean code
compliance with security policies (i.e., coding, testing, debugging,
documenting, and monitoring)
Business intelligence analyst
A Business Intelligence (BI) analyst is (c)
To work together with various
responsible for retrieving and analysing departments in the organisation
data within a company or organisation. regarding new deployments
The roles of BI Analyst are as follows: (d) To contribute to the development
(a)
To make consultations with of project schedules and workflows
management and the essential (e)
To propose changes and
stakeholders to define goals enhancements to software
(b) To conduct research, develop, and applications
implement data-gathering methods
(f)
To prepare the unit and user
(c) To provide analysis/analytics and interface (UI) tests for identifying
synthesis of data (descriptive, malfunctions
diagnostic, predictive, and
prescriptive data analytics) (g) To conduct research and propose
new mobile products, applications,
(d) To report on research findings and
and protocols
recommend solutions
(e)
To collaborate with co-workers (h)
To stay up to date with new
and management in implementing technology trends
various strategies
(f)
To evaluate the effectiveness of
implemented strategies
(g) To develop and manage BI solutions
339
Student’s Book Form Six Tanzania Institute of Education (TIE)
340
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Principally, most of the roles of the relate to or interact with each other.
IT profession depend on each other. 3.
Use your report and experiences
There are various IT careers within the from activity 6.1 to ascertain how
organisation, each having its specific these IT carriers roles are related to
roles to be undertaken by involving each other.
various IT experts such as web 4. Share your finding with your fellow
developers working together with IT in the group to make a relationship
security specialists. Nevertheless, each among IT careers.
role is essential to the company’s overall
performance and operations. The IT 5. Present your findings to the whole
professional responsibilities do relate to class for discussion.
each other in some contexts. Similarly, 6.
Summarise the class discussion
a web developer sometimes needs an IT critical points on the relationship
security specialist to assess the website’s and interaction among the identified
vulnerability before launching. In other careers.
words, the two experts can interchange
or undertake some responsibilities
together.
IT and environment
It can be said that, within the IT industry, Technological advancement has had
the experts depend on each other based a tremendous impact to our natural
on their professional skills. Remember environment and on peoples’ daily lives.
that “you cannot be an expert on Technology carries both advantages and
everything.” You can only do the work disadvantages for human beings and the
related to your skills, and the rest will be environment. In other words, technology
done by others whose skills fit into that is a two-edged sword, capable of both
aspect. causing and repairing environmental and
people’s lives damage. The following
A
ctivity 6.3. The relationship are some positive and negative impacts
between various roles of technology on the environment.
and responsibilities of IT Air and water pollution: When dangerous
professionals or excessive amounts of gases such as,
Resources: carbon dioxide, carbon monoxide, sulfur
Computer or smartphone with Internet dioxide, nitric oxide, and methane, are
connectivity, library resources, IT roles produced during manufacturing and use
reports, piece of paper and pen. of IT device/equipment, into the earth’s
Procedures: atmosphere, they will damage or pollute
the air. Air pollution has damaging
1.
Visit multiple sources such as the
health effects on people and animals and
Internet, library, and employers.
contributes to global warming. It may
341
Student’s Book Form Six Tanzania Institute of Education (TIE)
342
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
1. Discuss the disadvantages of
online communication rather technology to human lives.
than face-to-face conversations,
so they tend to become more 2. Explain how youth can make use of
individualistic and introverted. technology to employ themselves.
(d) Job placement and replacement. 3. Explain any five advantages of being
The use of IT simplify work; the an IT expert in the 21st century.
work which can be performed 4.
What do you understand by the
manually by many people can statement “improper dumping of IT
be done by one person using a ‘end-of-life’ materials”?
computer-aided device.
5. Discuss any five impacts of IT
A
ctivity 6.4: Identify advancement on the environment.
information technology’s
impact on the environment Methods for safe disposal of computer
and provide ways to reduce and related hardware
its effects. The IT devices keep a lot of information;
Resources: therefore, when you dispose of, recycle, or
donate such devices to others, be careful
The computer with Internet connectivity
because you might unintentionally
and notebook.
disclose sensitive information, which
Procedures: cyber criminals could exploit. These IT
(a) Open the computer and the web devices may include but are not limited to:
browser of your preference. (a) Electronic gadgets (e.g., computers,
(b) Write the URL of the search engine tablets, smartphones) which can
like google, Aster vista, or dogpile automatically store and process
and press enter to open it data.
(c) Write the search terms in the search (b) Digital media such as digital
field to search for “the impact of cameras and media players which
information technology on the can create, store, and play digital
environment”. Read and document content.
the impacts. (c) External hardware and peripheral
(d) Search for, and document the ways devices (such as printers, monitors,
to reduce adverse effects and external hard drives) that
(e) Then, write your report about the contain permanently stored digital
findings using the following guided characters.
questions: (d) Electronic gaming consoles,
(i) What are the identified impacts computers, or digital devices that
of information technology on the output visual images or video
environment? signals or display a video game.
(ii) What have you determined as There is a variety of methods for the
ways to reduce adverse effects safe disposal of IT-related materials.
on the environment? Nevertheless, before disposing of IT
343
Student’s Book Form Six Tanzania Institute of Education (TIE)
344
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
IT devices. inevitable in offices.
Search from the Internet and identify 2. Studying IT may be an excellent
any five health hazards associated with choice if you are interested in
using IT devices. From your search, becoming a computer operator,
assess the uses of IT devices among the IT manager, System analyst,
community members and the impact System administrator, Computer
associated with their use. programmer, IT trainer, Data
clerk, Webmaster, IT laboratory
Exercise 6.3 technician, and Maintenance
engineer.
1. List down six (6) IT devises you 3. IT has made life easier, particularly
know. for those who can interact with
2. Outline five IT-related hazards opportunities like utilising the
due to the prolonged use of the Internet and social media.
computer. 4.
Advancement in IT has brought
3. Explain with examples the impact about a tremendous impact on
of improper disposal of ‘end-of- the environment, particularly
life’ computer hardware on the the negative impacts on our
environment. environment and people’s daily
lives.
4.
Discuss the precautions to avoid
the impact of prolonged use of IT- 5.
Prolonged use of computers,
related devices in your groups. tablets, and cellphones can lead to
digital eye strain, which can easily
5. Describe safe methods of disposing be realised with symptoms such as;
of the computer hardware. dry eyes, blurred vision, headaches,
6. What precautions should be taken and shoulder and neck pain.
before disposing of the computer 6.
Technology has a detrimental
hardware? impact on peoples’ lives,
particularly the youths trying to
cope with a changing world and
Chapter summary culture.
1. Information Technology is one of 7. For several reasons, it is essential to
the most competitive professions decide on the proper ways of safely
in the market. Professions like IT disposing of electronic devices.
Security, Artificial intelligence, 8.
Disposing of computers and
Cybercrime, and software IT-related devices should be
engineering are some of the considered for all unused ones.
competitive IT occupations. Since During disposal, proper procedures
most companies and organisations need to be followed.
345
Student’s Book Form Six Tanzania Institute of Education (TIE)
1. Search from the Internet and identify the career opportunity of your choice.
Explain the roles and necessary skills required for that career.
2. Using different sources, identify IT career opportunities that are currently
highly demanded.
3. The advancements in IT are associated with both advantages and disadvantages.
Explain them with vivid examples.
4. With examples, describe how one IT profession relates to each other.
5. List down the health-related problems linked to the use of IT devices.
6. Improper disposal of electronic waste may damage the environment and pose
various challenges to human health. Examine five of these challenges.
7. Addiction to IT devices like computers and mobile phones is an emerging
challenge for youths. Explain any four measures that can be taken to address
these challenges.
8. Study various technologies in Tanzanian society and point out any four adverse
effects they bring to peoples’ healthy and environments.
9.
Unemployment has been a serious global issue for youth, particularly in
developing countries like Tanzania. It adversely affects their economic growth.
So most youths seek limited office jobs. As an IT expert, how would you advise
the unemployed youth to take advantage of IT end-of-life disposed of materials
to address the issue of unemployment?
10. As a student in IT subject combination, how can you advise people to realise
the role of IT in 21st-century socio-economic advancements?
11.
End-of-life IT technological materials litter badly colour our surrounding
environments. Suppose one of the Community based organisations dealing
with environment and youth affairs requested you to give detailed advice on
how these end-of-life technological materials disposed of illegally can be an
opportunity to address youths’ unemployment; what would be your advice?
346
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Seven
and trends
Introduction
Since the end of the 18th century, the world has gone through four industrial
revolutions. In the first, second, and third industrial revolutions, production was
based on steam, electricity, and Information Technology respectively while the
fourth industrial revolution is derived by cyberphysical systems, which connect
intelligent machine, smart gadget, processes and customers. In this chapter,
you will learn about emerging digital technologies that drive the 4IR and their
relevance, application, and impact. The competencies developed will enable you
to understand and apply emerging technologies and trends driving 4IR in your
community and industry.
347
Student’s Book Form Six Tanzania Institute of Education (TIE)
348
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
nowadays, perform various jobs both
with high risk and with a risk free to
humans. Robots, for example, carry
out various repetitive tasks in advanced
manufacturing industries, such as
painting a car or welding metals. Figure 7.1
shows a robot welding metal in a factory.
They relieve humans from dangerous
environments, for example, excessively
hot temperatures, dangerous rays, and
toxic environments.
350
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The second industrial revolution was
sparked by discovering new energy
sources in about 1870, mainly electricity
and oil. Internal combustion engines
made this discovery possible, which
eventually succeeded steam engines.
During this time, telephones and vehicles
were also invented. Steel supplanted
iron in construction because it was more
durable and less costly, allowing train
lines to be built for less money. With
the invention of the telegraph and the
telephone, communication techniques
changed considerably, and transportation
systems evolved dramatically from
Figure 7.6: A steam-powered locomotive using steam to petroleum oil as crucial
fuel.
ctivity 7.1: Watching
A Before electricity, people used wood,
animation or videos of steam candles and gas lamps for lighthouses
powered engines. and factories. Therefore, the invention
of electricity brought a new era of high-
Resources: voltage alternating current. Besides the
Computer with internet connection, telephone invention, electricity led to
video playing software, pen and piece of other inventions such as light bulbs.
paper. Early automobiles built on combustion
Procedures: engines started to be sold to the public in
1. Open the YouTube channel (https:// this period. Also, this period witnessed
www.youtube.com/) the creation of the first aeroplane flights,
as shown in Figure 7.7. Furthermore,
2. Use the following phrase to search
the typewriter that computers have now
the animation or video: “steam
replaced constituted the inventions of
powered engine”
the second industrial revolution.
3.
Play and watch the video or
animation.
4.
After watching the video or
animation, answer the following
questions:
(a)
What was the source of energy
used to convert water into steam?
(b) How was mechanical energy
produced?
351
Student’s Book Form Six Tanzania Institute of Education (TIE)
352
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Cyber World
Cyber Space
Servers
Gather and Information
send on effecting
information Internet physical
process
Physical World
Real Space
P Incoming
driver
Q
Destination R
353
Student’s Book Form Six Tanzania Institute of Education (TIE)
vehicles. The second part is the cyber that there is a lot of traffic. Based on the
system, which consists of internet and remaining options and distance cost,
cloud services containing algorithms the cloud service algorithms will then
that advise incoming drivers on which suggest to the drivers which road to
path to take. The optimal route is take to reach their destination. In this
recommended based on the distance to situation, route “P” would be selected.
the destination and the amount of traffic To summarise, Figure 7.11 depicts the
expected ahead. Road “R” is longer than development of industries from the
“P,” and road “P” is longer than “Q” late eighteenth century to the present
in this case. Algorithms on the cloud day. It lays forth the path between one
server for an application, such as Google revolution and the next using textural
Maps, decide which road is congested descriptions and images.
by analysing vehicle movement speeds
• Cyber-Physical Systems
(CPS)
• IoT connected devices,
• Computerization network, process
• Use of embedded automation and data
Programmable Logic analytics
• Mass production based on Controllers
engines powered by • Automation of production
electricity processes
• Engines powered by water • Invention of assembly • Internet
and steam lines powered by
• Mechanisation of electricity
handcraft activities
1st Industrial Revolution 2nd Industrial Revolution 3rd Industrial Revolution 4th Industrial Revolution
End of 18th century 1870 1970 2010 Onwards
Activity 7.2: Creating a cyber- you that there are sensors that can be
physical system use case in connected to a physical thing and record
fourth industrial revolution the motion and location of the object to
which they are attached. These sensors
Ms. Halima is a pastoralist who lives
have the capacity to communicate the
in Tanga but keeps livestock in Kilosa
information they collect. Based on this
Morogoro. She employed staff to look
scenario:
after her cattle. Her issue is determining
when cows are going for grazing and 1. Identify infrastructure needed to
returning back home so that she can pay solve this problem;
her staff based on the worked hours. Ms. 2. Use a diagram to create a design of
Halima approaches you for assistance your solution to solve this problem;
to develop a solution to that dilemma. 3. Devise, using a diagram, how Ms.
Meanwhile, your relative who works Halima will get information related to
for a large IT firm previously informed what is going on in her farm in Kilosa
in real time.
354
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Answer the following questions:
to those carried out by humans. Under
1.
How did the availability of AI, machines are programmed to mimic
fossil fuels like coal enable the thoughts and actions of humans,
industrialisation? which means that those machines are
2. Identify the impact each industrial enabled to reason and respond by taking
revolution had on society. actions as a response. AI systems must
3.
What is the main difference be able to collect information (sensing/
between the first and second perceiving), manipulate facts from
industrial revolutions? newly sensed information and previous
experience (reasoning) and make actions
4.
Compare the third and fourth
(responses) mainly on their own.
industrial revolutions and outline
features that distinguish them. On the other hand, machine learning
is a branch of computer science that
focuses on using algorithms and existing
Emerging technologies and their data to build a model that can predict
applications an outcome of something. In creating
In this section, you will learn about the model, the algorithm has to learn
emerging digital technologies that from historical data. In that learning,
drive 4IR and their importance. Next, the algorithm is calibrated several
you will learn about the application of times until its accuracy or prediction
each technology in daily life. Digital level is confidently sufficient. Once the
technologies described in this section algorithm is ready and accurate, it may
are Artificial Intelligence, Blockchain, be subjected to a related problem with
cloud computing, 3D/4D/5D printing, a new data set to provide the desired
Big data, and the Internet of things. prediction.
Other technologies are drones, virtual Importance of artificial intelligence
and augmented reality, autonomous and machine learning
vehicles, robotics, and 5G.
AI systems have a critical relevance in
Artificial intelligence and machine our daily lives in various ways. First,
learning an intelligent machine can function in
John McCarthy first coined the term a risky environment without harming
Artificial Intelligence (AI) in 1956 itself; thus, relieving many of the
at the Dartmouth conference. John constraints placed on humans. Second,
McCarthy defined Artificial Intelligence humans are prone to errors, mainly while
(AI) as the science and engineering of doing repetitive tasks. Unlike humans,
making intelligent machines. AI is a intelligent machines are unique in that
technique for getting machines to work they seldom make errors.
and behave like humans. AI applies AI systems can make better judgments
contrived produced intelligence to solve faster because they can examine and
problems in the real world. AI comprises analyse all available options before
355
Student’s Book Form Six Tanzania Institute of Education (TIE)
from, most people find it challenging to go through them all and make an informed
decision. Additionally, AI systems do not require vacations or pay, and they do not
become ill or get tired.
Application of artificial intelligence and machine learning
AI has applications in many areas, including:
1. Health: To support diagnose illnesses and provide professional guidance
(expert systems)
2. Travel and transportation: Supplying pedestrians, car drivers and airlines
with map-based location and navigation services. Figure 7.12 shows AI-based
google location service in a selected route.
356
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
riding a bicycle, just as you can manage assets in a corporate network,
listen to music while driving a car. including real estate, money, and
It can also benefit visually impaired machinery equipment.
people to access such material Consider Village Community Banks
services for learning, working, and (VICOBA), where community members
any other purpose in their lives. join together to save money and obtain
credit. There are already mobile
Blockchain platforms where members may submit
Blockchain technology is a distributed their monthly savings using mobile
electronic ledger of digital records, events phones. Financial savings are centralised
or transactions that are cryptographically and administered by a governing body,
secure, extremely hard to forge, usually a member selected from a
and updatable through a consensus group. Other members may access the
protocol agreeable to all connected information, but only with restricted
nodes. A Blockchain is a decentralised, access. A client-server network with a
secure digital record of time-stamped, central database characterises this type
unchangeable transactions in several of record-keeping.
copies on internet-connected computers. In a Blockchain, however, each network
That copy is constantly accessible member has an equal ability to govern
to everybody at any time, and users records. That Blockchain consists of
modify it via distributed agreement. a distributed peer-to-peer network in
Blockchain technology focuses on which each member maintains their
creating distributed and decentralised records (ledger). Figure 7.13 shows the
databases with immutable records. network members of the VICOBA who
It does not allow for the deletion or are Fatuma, Simoni, Daudi, Upendo, and
updating of data; instead, new data is Wisebe. All these members must agree
added to the preceding to create a block to record a transaction in block zero (0).
of data connected in a chain. Instead If they agree, that successful transaction
of depending on a central authority will be time-stamped. If a transaction has
to handle everything, Blockchain to be updated, a new block of data, say
technology allows everyone to keep block one (1), is created and connected
records maintained in a ledger. As a to block zero instead of altering it.
result, each network member has equal
357
Student’s Book Form Six Tanzania Institute of Education (TIE)
0 1 2
Daudi
Agree/reject
0 1 2
Fatuma Agree/reject
Agreement 0 1 2
Upendo
0 1 2
Simoni Agree/reject
0 1 2
Wisebe Agree/reject
All members of the peer-to-peer network fail because other nodes will deny a
must agree to commit to the transaction to request to publish transactions to the
be successful. Each member is in charge network only because each node has a
of their record (ledger). No data block copy of all transactions completed.
may be erased, resulting in immutable
Increased transparency: Transactions
records. In Figure 7.13, subsequent data
and data are recorded instantly and
blocks are linked, producing a chain of
identically in many locations because of
data blocks, hence the term Blockchain.
distributed ledgers, allowing all network
Importance of Blockchain members with permission access to see
the same information simultaneously.
Blockchain is useful because it helps
guarantee trust in business networks, Reliability: The possibility of failure
which traditional business-to-business is scarce because multiple copies exist
systems cannot provide. For example, across the network.
with a shared database, there is no
Challenges of Blockchain
guarantee that an administrator has
not transpired with the transaction. Some challenges with Blockchain
Blockchain gives the participants of the technology need attention before being
transaction non-repudiation, which is a used for transactions. The following are
piece of evidence that the transaction some challenges of Blockchain:
was agreed upon. Other importance of Privacy: There is a possibility that
Blockchain are as follows: someone could track down a person’s
Improved security: Blockchain helps identity in the network through
prevent fraud and unlawful behaviour transactional data, just as web trackers
by producing a record that cannot be and cookies are generally used by
changed and is encrypted end-to-end. businesses. This proves that Blockchain
Any effort to change a transaction will is not 100 percent secure.
358
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
imagine with the issue of scalability in Unlike cryptocurrencies, they are
view. Each participant node must verify based on a country’s agreement
and approve a transaction, so one Bitcoin currency value and are developed
exchange can take up to several hours. in many nations. The CBDC
promotes safety, robustness and
Security: The attack can be implemented efficiency of payment, reduces
if the nodes in a network lie; the lie will cost, and increases transaction
be accepted as truth. Therefore, everyone convenience.
in the network will have to continually 3. Smart contracts: Smart contracts
have a lookout for it to perceive any refer to the computer code
unwanted influence. shared between participants of
Storage: Since Blockchain databases are the business network, and these
stored indefinitely on all network nodes, implement the business rules
the issue of storage surfaces. With the associated with each transaction.
increasing number of transactions, the As the code is shared, it can be
size of the database will only expand, executed by all relevant, and
and there is no way personal computers they can agree on the output.
can store unlimited data that just gets Contracts are maintained
appended. digitally on the Blockchain and
are automatically executed when
Regulations: Regulatory organisations particular criteria are met.
in the financial field are a challenge for 4. Property registry: In a property
Blockchain implementation. Blockchain registry, unchangeable records
applications will have to lay down are kept to determine how
the process of locating the offender future ownership transfers were
in case fraud occurs, which is a bit completed from the initial owner
challenging. Blockchain technology’s to subsequent owners.
other regulatory aspects will need to
be introduced first to facilitate its broad The characteristics of Blockchain
implementation. Secure: each transaction recorded
Application of Blockchain in the database is digitally signed
and mathematically guaranteed to be
Blockchain has many applications, authentic and impervious to fraud.
including:
Shared: The database’s primary value
1. Cryptocurrency: People and is shared between separate entities. The
organisations can send and more entities shared, the greater their
receive money without central value.
intermediation or banks.
Examples include Bitcoin and Distributed: Many copies of the
Ethereum. database exist, replicating each other in
2. Central Bank Digital Currency relative time.
(CBDC): The CBDC is a digital
359
Student’s Book Form Six Tanzania Institute of Education (TIE)
360
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
software such as Google documents Despite the benefits of cloud computing
(Google docs) and file storage such as usage, it is undeniable that this system
Dropbox and Google drive. also has some disadvantages such as:
Platform as a Service (PaaS): This type Internet connection dependent: The
of cloud computing service provides Internet is the only way to cloud
tools for developing and deploying computing. When there is no Internet
applications that run on a remote connection in your place or the Internet
server. An example of PaaS is writing, path to the cloud, the provider is in
compiling, and running computer trouble, then, the cloud computing
programs using online compilers (such machine is disconnected. The big
as C++ compiler). challenge in developing countries and
Importance of cloud computing remote areas is that they do not have
reliable internet access. The weakness
Cloud computing services are helpful in of the public cloud is that everyone
a variety of circumstances. Some of the accesses the same server, which will
benefits are: increase the risk of attack and put down
Backup and restoration: It is easy to the server.
back up your data offsite and restore it if
something goes wrong. Data confidentiality: There is always a
risk that other people can access user
Low cost: It allows you to save a lot of data. So, data and cloud protection must
money because it doesn’t require any be good because it will not be dangerous
hardware.
for data confidentiality.
Security: Cloud security covers the
set of controls, policies, technologies, The level of security: Secrecy and
procedures, and services that ensure security are among the most suspicious
the safety of the hosted services over things in cloud computing. Using a
the Internet and protect cloud data and cloud computing system means we are
infrastructure. The benefits of the rapid entirely entrusted with data security
operation, flexibility, and scalability and confidentiality to companies that
have made cloud computing famous provide cloud computing servers. When
among many business organisations. you experience a problem, you cannot
Cloud computing offers state-of-the-art sue the server for errors in the data.
security mechanisms that guarantee data
is stored and handled safely. Data mobility: It refers to the possibility
of sharing data between cloud services
Easiness in deploying an application:
It is easy to deploy an application you and how to retrieve data if one day
developed because you do not need to the user terminates cloud-computing
buy your server, manage and maintain it. services, and there is local storage
where the data can be used at any time
Convenience: Access to cloud-based as needed. If cloud-computing services
services may be done anywhere, is unavailable, the users will suffer if no
provided you have access to the Internet. other local storage is available.
361
Student’s Book Form Six Tanzania Institute of Education (TIE)
362
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Consider a scenario where your computer
(a) Assess the performance and connected to a printer can create tangible
quality of each document things such as a cup. 3D printing is a
converter. method of turning a computer-generated
(b) Did a layout of your document design into a three-dimensional object.
remain intact or was slightly Typically, printers that are used to print
changed? material things are not the same as the
(c) What are your opinions on ordinary printers we know and use in
this online service? our workplaces and homes. Unlike the
(d) Is this service a SaaS, IaaS, or regular printer that type-sets characters
PaaS? and images on paper, the 3D printer
works by layering (adding) new layers
ctivity 7.5: Removing
A on top of the old ones. Figure 7.14 shows
background of an image an example of a 3D printer.
Resources: Initially, an object to be printed is
A computer connected to the Internet, designed on a computer using computer-
notebook and pen aided design (CAD) software. Next,
Procedures: that logical design is commanded for
printing. Printing is done using materials
1.
Open a search engine such as
heated to a particular temperature to be
Google (https://www.google.
flexibly used to build an item in the form
com/).
of layers. As technology continues to
2. Use the following phrase to search: grow, other generations of 3D printing
“remove background from image are emerging. Although small things can
online”. now be printed, this technology is still
3. Open a link to an application of your growing. The world is now considering
choice that removes background of advancements in 4D and 5D printing.
an image.
4.
Follow instructions provided in
that specific application
5.
After removing background of
the image, answer the following
questions:
(a) Did the quality of your image
maintained or was slightly
changed? Figure 7.14: An example of a 3D printer
(b)
What are your opinions on 4D printing is an extension of 3D
this online service? printing. In 4D printing, an item is given
(c) Is this service a SaaS, IaaS or the ability to change its form or structure
PaaS? predictably over time after it has been
363
Student’s Book Form Six Tanzania Institute of Education (TIE)
364
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
about 4D printing The Internet evolved from a network of
Resources: computers to a network of computers and
A computer connected to the internet, people. We are now entering the world of
pen, and a notebook the Internet of things beyond computing
Procedures: and network devices, including animals,
1. Open the YouTube channel (https:// household appliances, and cars, to name
www.youtube.com/). a few. As a result, such typical Internet
2. Use the following phrase to search has earned the name “Internet of
video: “4D printing”. Things.” The Internet of Things (IoT) is
3. Watch more than three (3) videos. a network of linked devices that includes
4. After watching the videos, answer machines, goods, animals, and people
the following questions: that can exchange data without human
(a) What is the difference between interaction. Instead of having the
3D printing and 4D printing? Internet only for people and computers,
(b) In each video, what stimuli other things like smart refrigerators,
caused a material to change its television, car and microwave are
structure? equipped with small devices that can
(c) Reflecting back to our sense information and communicate it
individual lives and in
industries in Tanzania, identify to other devices or computers, hence,
at least four (4) things we can the Internet of things and the Internet
employ structures that change of everything. Figure 7.15 shows an
shape after being exposed to illustration of the Internet of Things.
external influences.
365
Student’s Book Form Six Tanzania Institute of Education (TIE)
366
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
containers
(e) Transport logistics for tracking the movement of cargo in shipping
(f) Traffic monitoring whereby mobile phones report our pace of movement on the
road. A slow pace from many devices implies the presence of traffic congestion
(g) In irrigation for sensing and controlling necessary watering required in a farm
Big data
Data is created in large volumes and at a high rate in today’s environment. For
example, mobile phones that use map location services generate a daily history
of our movements. The amount of data generated by global social media posts is
enormous. Yet, vehicles and aeroplanes create and share data while on the route in
transportation. Social media, sensors incorporated in machinery equipment (such as
machines in the manufacturing industry), transaction processing systems (such as
mobile money transactions), and IoT devices generate a large quantity of data, as
shown in Figure 7.16.
Social media
Internet transactions
(sales/purchases, banking)
Sources of
Big data IoT devices/
sensors
Mobile phones (calls,
SMS/IM/text, Location)
Databases
Archives
In line with the characterisation presented in the previous paragraph, Big data refers
to data that is often large in volume and generated at a high rate. Big data has four
primary characteristics: volume, velocity, variety, and veracity. These characteristics
are also referred to as the four Vs of Big data. The following is a brief description of
Big data characteristics as shown in Figure 7.17:
Volume: A large volume of data is generated every minute. Since the growth of
information is so rapid, then new types of database management are needed.
367
Student’s Book Form Six Tanzania Institute of Education (TIE)
Variety: Data is generated from various sources. Data generated may be unstructured,
semi-structured or structured, resulting in data that exists in a variety of forms.
Veracity: Signifies the trustworthiness of data, whether the data is correct and of
good quality. The data gathered may be of both excellent and lousy quality.
Volume
Data is generated in large quantities
Variety
Data exists in unstructured, semi-
structured and structured forms
368
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
and point to a predetermined destination in
(c) Prescriptive data analytics assists in autopilot mode. Autonomous cars, also
determining what should be done in known as self-driving vehicles, perform
terms of decisions and actions. driving functions on themselves without
human interaction. They can sense
Application of Big Data surroundings, accelerate speed, and
Application of Big Data include but bot apply brakes to reduce speed or stop the
limited to: car.
(a) Tracking customer behaviour
(b) Recomendeshen
Activity
7.8: Watching videos
(c) Smart and secure traffic
about autonomous vehicles
Unmanned aerial and smart vehicles 1. Open the YouTube channel (https://
A drone is an aircraft that has no pilot www.youtube.com/)
inside it. Drones are sometimes known
as Unmanned Aerial Vehicles (UAVs). 2. Use the following phrases to search
Drones differ in size, and they range video: “autonomous cars or self-
from large ones, such as military drones driving cars” and “Unmanned
carrying bombs and attacking in combat, Aerial Vehicles”
to small ones used to take video and still 3.
Watch more than six (6) videos,
pictures of a scene. Drones are usually three for drones and others for “soft
controlled using a remote, as shown in driving cars”
Figure 7.18. Small drones have many 4. After watching the videos, answer
components, including a GPS module
the following questions:
that offers location services, a battery
to power the drone, and an antenna and (a)
How does drones and self-
receiver for communicating signals. driving car see objects and
obstacles on their paths?
(b) What challenges could drones
and self-driving automobiles
face as a result of infrastructure
flaws?
(c) What are the benefits and
drawbacks of using drones
and self-driving cars?
(d)
Can our road infrastructure
Figure 7.18: A drone for spraying rice support autonomous vehicles?
fields to fight malaria in Zanzibar Explain why.
(Source: https://apnews.com/article/
b2131aa51d4b4043a7c18e69236464 47)
369
Student’s Book Form Six Tanzania Institute of Education (TIE)
370
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(c) Virtual reality in the military. Virtual
reality combined with sights and
sound may replicate dangerous
training scenarios to prepare and
train soldiers.
Application of AR are as follows:
(a) Augmented reality can be applied in
Figure 7.19: Using AR to find nearby picking products or parts stored in
shops warehouses.
Importance of virtual and augmented (b) Whether walking or driving,
reality augmented reality provides
On the one hand, VR immerses users guided navigation or guidance.
in a near-real world, allowing them It is beneficial while visiting a
to live and participate in a previously new location with which you are
unimaginable setting. The VR transports unfamiliar. The augmented reality
the user to a new experience obtained at may use the smartphone’s GPS to
a lower cost. Users can study or gain offer you directions that you may
a deeper understanding of a situation view in real-time until you arrive at
in prior. On the other hand, AR allows your location.
users to see actual objects broadly. It
empowers users with required details
when additional information is added to ctivity 7.9: Watching virtual
A
a physical scene or item. reality videos
Application of virtual and augmented Resources:
reality A computer with video streaming
software, internet connection, speaker/
Virtual reality and augmented reality headphones
have a wide range of applications. The
following are descriptions of a few of Procedures:
these applications: 1. Open the YouTube channel (https://
www.youtube.com/).
Application of VR are as follows:
2. Use the following phrases to search
(a) Virtual reality in health care: A video: “virtual reality in medical
medical doctor can practice doing the care”.
surgical operation through training
without being in a real operational 3. Watch more than three (3) videos
theatre. plug you headphones to reduce
noise.
(b) Virtual reality in entertainment: It
may be used at theatres to mimic
371
Student’s Book Form Six Tanzania Institute of Education (TIE)
(a)
Identify physical objects in painting robot, electrode and electrode
the videos holder for the welding robot, and
grasping claws for a robot that picks
(b) Identify virtual objects in the items.
videos.
(c)
Explain how virtual and
physical objects interact.
(d)
Discuss how this can be
applied and benefit our
community.
Robotics
Robotics is a term that describes the
designing, construction, and use of
machines (robot) to perform tasks that Figure 7.20: Robots in the car
are traditionally done by humans that manufacturing industry
can interact with the world. Typically, (Source: https://media.jaguarlandrover.
there are two groups of robots –physical
com/2016/manufacturing-success-story)
robots and software robots.
As shown in Figure 7.20, physical
robots deployed in industries have five Software robots are computer programs
main components: sensors, control that perform non-physical jobs.
systems, actuators, power supply, and Examples of these robots are search
end effectors. engines (that you use to search for
Using a variety of sensors, the sensory various information on the Internet) and
component gathers information about chatbots. Chatbots are known for pop-
the surrounding environment. Data ups when you open a particular website,
collection includes visual data (using a asking visitors about what they can do
camera), audio (using a microphone), to help. They work as employees of
pressure, light, and temperature. The the customer service department in an
control system analyses data collected organisation.
by sensors and decides on the best Importance of robots
course of action. After analysis and
decision, the actuator components of In general, robots do tasks autonomously
a robot do the robot’s real job. These or semi-autonomously. Semi-
actuators are also known as effectors in autonomous robots require human
some cases. The robot must be powered intervention to complete their jobs,
by electricity to work, which is the whereas autonomous robots do not.
robot’s fourth component. The end Some robots are intelligent, but others
effector’s last component comprises are not. Although it was programmed
372
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(SMS). It incorporated packet switching
not necessarily intelligent. On the other in the form of General Packet Radio
hand, an intelligent robot replicates Service (GPRS) and Enhanced Data
human behaviour by perceiving rates for GSM Evolution (EDGE). The
information, reasoning from facts, and 3G provided critical core network speeds
taking actions after a decision; take, for for smartphones. The 3G had a four
instance, Robot Sophia. Robot Sophia times 2G data transfer capacity, allowing
is realistic humanoid robot capable of video streaming and video conferences.
displaying human like expressions and The 4G provides high-quality data
interacting with people transfer speed, enabling video streaming
and other related services which demand
Application of robots
higher data transfer.
Robots may be applied in more expansive
ranges areas, as follows: The 5G technology is the next generation
of wireless telecommunications for
(a) Robots are a fantastic alternative
mobile internet connections. It has a fast
for investigating locations that
people cannot easily access, such connection and will allow smart homes,
as deep-ocean research and space automobiles, health care, and nearly
exploration. anything to connect to the Internet,
(b) Robots are used in the manufacturing creating an integrated environment. The
industry, for example, in car 5G is offers 100 times more data transfer
manufacturing industries. capacity than the 4G. The facts changing
(c) Robots are used in homes, for the digital world is influencing the
example, for doing cleanliness or demand for high Internet speed, which
cooking. may not be achieved from the traditional
(d) Robots are used in the health connection architecture of third and
industry, for example, in routine fourth generations. The 5G addressed
tasks and surgery. three critical challenges; ultra-high
throughputs, ultra-large connection, and
The 5G ultra-low latency. Generally, 5G has
The 5G refers to fifth-generation three main advantages:
wireless technology in cellular (a) It provides enhanced mobile
telecommunication. It’s important broadband of up to 20Gbits/s
to know what came before 5G to (b) It is a massive machine-type
comprehend it. The first generation –1G communication that has one
networks– allowed people to make phone million connections per second
calls, but they had a lot of flaws such as per square kilometre
reliability and signal interference. The (c) It has an ultra-reliable low
2G network was based on Global System latency of 1ms
for Mobile (GSM) communication. It
enabled circuit-switched mobile data
373
Student’s Book Form Six Tanzania Institute of Education (TIE)
374
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
The fourth industrial revolution
creates fewer jobs in new industries intelligence technologies keep growing,
than in previous revolutions. That is systems that can send and receive emails
especially true in light of rising levels are being invented. Regarding the nature
of automation in industry, as human of work, the need for physical working
occupations are increasingly being spaces is decreasing. Some employees
replaced by automated machinery. For can now work from remote areas on
example, the automation of some work different continents and countries or
in offices and manufacturing industries, even their homes.
results in fewer jobs. Furthermore, These developments mean that new
in ride-sharing, featured by seamless job skills will be required to adapt
algorithms, people, do not oversee the to a changing working environment
selection of which driver to meet and characterised by emerging technologies.
which customer to choose. Most emerging technologies such as AI,
Emerging technologies will continue augmented reality, robots, and cloud
to alter the nature of employment in all computing, will require personnel who
sectors and vocations, and automation can use these technologies. Computer
will increasingly replace human labour. programming, coding, and project
Many diverse types of jobs have already management skills will be more in
been automated, particularly those that demand than today. Critical thinking,
need mechanically repetitive and exact problem-solving, judgment and decision-
physical work. Many more will follow making, interpersonal communication,
as computational power expands rapidly. and emotional intelligence are other core
This implies that different professionals competencies needed in this situation.
must be aware of this trend and prepare Impact on business
themselves by being more innovative to The impact of emerging technologies
remain relevant. on business is observed from the
Impact on skills and nature of work perspectives of access over ownership
Robotics and artificial intelligence and data-enhanced products. These
are transforming how we live and perspectives are also referred to as
work. Soon, other technologies such new business models under the fourth
as machine learning, autonomous industrial revolution.
vehicles, and the Internet of Things Access over ownership
will also change our lives. Building on Access over ownership is a business
the example of the postal service for strategy that allows customers to utilise
sending and receiving mail, you can a product without purchasing and
imagine how administrative processes owning it. Access over ownership is
in offices and the lives of individuals are also described as a sharing economy
changing. Previously mail carriers and because it involves parties sharing
individuals could walk to the post office an asset in space or time. People are
to send or pick up mail. This manner of starting to refrain from owning some
operation has been replaced by emails, assets and opting to access those assets.
375
Student’s Book Form Six Tanzania Institute of Education (TIE)
meanwhile, some assets, such as drilling product. Imagine you are shopping
machines, are rarely used by owners. at a supermarket for a blender to use
Under the dimension of space, people at home in making juice, and you are
may share, for example, unused space unfamiliar with that sort of blender. It
in a personal car. Imagine driving alone is possible that the product information
from Dar es Salaam to Dodoma in a car written on the package is insufficient
with five seats while you are occupying to describe the blender and how to use
one seat only. You share unused (idle) it. A Quick Response (QR) code may
space when you allow other people to ride be helpful in this scenario. A QR code
with you in your car. Those passengers may be attached to the blender by the
do not need to own the vehicle (asset) manufacturer, allowing you to scan
but need access to it. Other examples the code with your smartphone (using
of ride-sharing are services offered by a specific mobile app). On scanning,
Uber, Bolt, Taxify and Bla Bla Car. more details about how the blender was
Moreover, vacation renting of homes or manufactured, how to operate it and its
rooms and car leasing services are forms life span are displayed in various formats
of sharing through renting but in the such as text, image and video. In this
dimension of time. case, a product has been enhanced with
Digital platforms that mediate data. Furthermore, augmented reality
interactions between service providers technology may be applied to improve
and consumers are critical to the the product in this particular case.
operational effectiveness of the access Impact on security
over ownership business model. The impact of emerging technologies
Typically, the asset provider (supplier) arises from the perspectives of cyber
registers on the digital platform and warfare and autonomous warfare.
gives relevant information such as the Cyberwarfare can take a variety of
description of the service they deliver forms, including attacks on financial
and the price. The consumer also creates infrastructure (bank and payment
an account on the digital platform by systems) and safety infrastructure
entering their information. Following systems (such as warning systems).
that, algorithms find the optimal match Autonomous weapons, a combination
between provider and consumer based of drone technology with artificial
on many parameters such as proximity, intelligence, can choose and engage
price, and preference. Digital platforms targets with limited or without human
like Uber, Bolt, and Taxify act as interaction, based on predefined criteria.
intermediaries between the driver and Drones which are flying robots, can also
the passenger, while seamless algorithms be used as weapons in combat while
perform their finest work behind the getting controlled remotely. The robot
scenes. will play a role in the war in future wars
Product data enhancement and involve deploying military robots
An application example from the retail and AI-powered automated weaponry.
376
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Emerging technology has a variety of
impacts on society and individuals, and close relatives? Despite continuous
including socio-economic inequality technological advancements, we as
and anti-government objectives. We humans still need a personal touch.
are already seeing how technology and However, the trend reveals that our
robotics are displacing human labour. social ties, once deeply rooted in
Existing and potential employees’ skill physical contact, are beginning to drift
sets are restricted and tailored to the apart as social exchanges migrate to
market’s requirements. Individuals social media, an aspect that needs a
with higher innovation abilities, such balance between the two.
as bringing new ideas, business models,
and products to market, will be valued Exercise 7.4
more than those with lower expertise.
Answer the following questions:
This upward tendency suggests that
those with the necessary abilities will 1.
Explain with examples how
survive and outperform the low-labour emerging technologies have started
skilled workforce. to impact people’s way of living,
Digital media has both beneficial and changing them from possessing
harmful effects. Digital (social) media assets to accessing assets
favour linking individuals to form 2.
Describe how robotics and
friendships in one-to-one networks automation affect skills and
and social groupings. This networking employment.
stretches across national borders, 3.
Identify the social impact of
allowing people to have incredible emerging technologies.
personal experiences and feelings.
Digital media, particularly social media,
which non-state players dominate, may Chapter summary
influence society with extreme agendas. 1. Unlike earlier industrial revolutions,
Some of these agendas have malicious the Fourth Industrial Revolution
intentions such as misinforming the (4IR) is progressing exponentially.
public and causing unrest. This is the outcome of our intimately
Furthermore, continued advancements interconnected society, and that new
in artificial intelligence and robotics technology opens us to previously
raise the question of whether or not unimaginable possibilities. The 4IR
we, as humans, will be able to govern builds on digital transformation and
intelligent machines. What if they one brings together a variety of emerging
day outstrip our ability to manage them? technologies that are causing
Algorithms are being used to choose extraordinary paradigm changes in
who should attend an interview, establish socioeconomic development.
prices for items in online stores, provide
health advice, determine who to date, 2.
Emerging technologies drive the
where to travel, and which hotel to 4IR. In particular, emerging digital
book, among other things. Do we now technologies such as artificial
377
Student’s Book Form Six Tanzania Institute of Education (TIE)
378
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
(a) Manufacturers 11. Discuss the impact of social media
(b) Retailers in business.
12. What is the influence of the fourth
8.
Explain the difference between industrial revolution on our daily
augmented reality and virtual lives?
reality. 13. Give five (5) examples of things you
9.
A vast amount of data about can print by using 3D technology.
academic records exists at a 14. Compare 3D-printed products and
particular high school in Tanzania. conventionally manufactured goods
The high school intends to safeguard in terms of strength and quality.
such information by regularly 15. Emerging technologies have both
backing up its records. The school’s positive and negative impacts on
ICT department is contemplating society globally. Discuss four of
using one of the following backup them.
systems; tape, hard drive, or cloud 16. Consider any four emerging
storage. Evaluate the three options technologies. Discuss their impact
and recommend, with reasons, the on people in Tanzania now and in
most suitable one. the future.
379
Student’s Book Form Six Tanzania Institute of Education (TIE)
A node It is a structure that contains a key or value and pointers in its child
node in the tree data structure.
Abstract data It is a special kind of the data objects that make up a data type
type and the functions that operate on these objects. These are special
kinds of the datatype whose behaviour is defined by a set of values
and operations. The keyword “Abstract” uses these data types and
performs different operations.
380
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
each unique record independently of any other data. A candidate
key is an attribute or set of attributes that can uniquely identify a
tuple. The remaining attributes in a table are candidate keys except
for the primary key.
Foreign key Foreign keys are the column of the table used to point to the
primary key of another table.
381
Student’s Book Form Six Tanzania Institute of Education (TIE)
Physical data A Data Model that defines how the system will be implemented
model using a particular DBMS system. The goal is to get the database up
and to run. It also helps visualise database structure by replicating
database column keys, constraints, indexes, and other RDBMS
features.
Primary Key It is the first key used to identify one and only one instance of an
entity uniquely in the table.
Selection sort It is a sorting algorithm that selects the smallest element from
an unsorted list in each iteration and places that element at the
beginning of the unsorted list until the required order is attained.
382
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
First Out (LIFO). This means the last element inserted inside the
stack is removed first. A good example is a pile of plates.
383
Student’s Book Form Six Tanzania Institute of Education (TIE)
5. Doorsamy, W., Paul, S. B., and Marwala, T. (2020). The Disruptive Fourth
Industrial Revolution: Technology, Society and Beyond. Springer. https://doi.
org/10.1007/978-3-030-48230-5
9. Gupta, M. (2020). Blockchain for dummies. 3rd IBM Limited Edition, John
Wiley & Sons, Inc., Hoboken, ISBN: 978-1-119-62196-6
10. Hallberg, B. (2015). Networking A beginner’s guide 6Th edition. McGraw Hill
Education, India
11. Halvorson, M (2010). Microsoft Visual Basic 2010, Microsoft Press, Redmond
Washinton
13. ITL Education solution Limited. (2011). Introduction to computer science 2nd
edition.Pearson, India
14. Kate T., Gauri S., Pooja Sehgal, Rupal Bansal, Nikhilesh Jasuja, Syed Ali
Husnain Gilan (2022, Oct., 23). Hardware vs Software. Diffen.com. Diffen
LLC, https://www.diffen.com/difference/Hardware_vs_Software
384
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
16. Kumar, V., & Sinha, D. (2021). A robust intelligent zero-day cyber-attack
detection technique. Complex & Intelligent Systems, 7(5), 2211-2234.
19. Pal, S., Hitchens, M., Rabehaja, T., & Mukhopadhyay, S. (2020). Security
requirements for the internet of things: A systematic approach. Sensors, 20(20),
5897.
20. Proudfoot, R. and Kelley, S. (2017). Can technology save the planet? WWF
Australia.
21. Proudfoot, R., & Kelley, S. (2017). Can technology save the planet? WWF
Australia. https://www.wwf.org.au/ArticleDocuments/360/pub-can-technology-
save-the-planet-30may17.pdf.aspx?Embed=Y
22. Schwab, K. (2016). The Fourth Industrial Revolution. World Economic Forum.
Cologny, ISBN-13: 978-1-944835-01-9
23. Schwab, K., Nadella, S., and Davis, N. (2018). Shaping the Fourth Industrial
Revolution. World Economic Forum. ISBN 9781984822611, Ebook ISBN
9781984822628
24. Sensors, E. (2019). The Impact of Technology on the Environment and How
Environmental Technology Could Save Our Planet. Accessed at: https://
edinburghsensors.com/news-and-events/impact-of-technology-on-the-
environment-and-environmental-technology/
25. Smith, A J (2011). Visual Basic programs to accompany programming logic
and design six edition, Course Technology 20 channel centre street Boston, MA
02210 USA
27. Writing, A. (n.a.). The Advantages & Disadvantages of Visual Basic. Techwalla.
https://www.techwalla.com/articles/the-disadvantages-of-ruby-programming
385
Student’s Book Form Six Tanzania Institute of Education (TIE)
386
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
computer, 1, 2, 6, 12, 19, 38, 49, 59,
60, 64, 66, 67, 68, 69, 70, 72, 73, 75, database, 17, 45, 63, 70, 74, 75, 77, 78,
76, 77, 105, 115, 116, 121, 122, 127, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89,
128, 129, 130, 131, 132, 134, 140, 90, 91, 92, 93, 94, 96, 98, 99, 100,
141, 142, 143, 146, 150, 152, 154, 101, 105, 106, 107, 108, 110, 111,
160, 161, 164, 168, 172, 184, 187, 112, 113, 262, 273, 277, 278, 282,
192, 193, 194, 196, 262, 263, 264, 297, 299, 303, 305, 311, 326, 327,
266, 267, 268, 269, 270, 271, 273, 347, 348, 349, 357
275, 276, 279, 280, 281, 282, 284,
DBMS, 78, 83, 84, 112
285, 289, 303, 304, 305, 308, 309,
310, 311, 313, 317, 318, 319, 320, decision, 33, 63, 64, 65, 68, 70, 74, 75,
321, 322, 323, 325, 326, 332, 333, 76, 82, 150, 192, 295, 339, 345, 362,
334, 335, 337, 342, 345, 349, 350, 363, 365
353, 360, 362, 368, 372
Defence in depth, 284
computer programmer, 326
demodulator, 146
Computer security, 262
dependency, 82, 86, 96, 97, 98, 103,
Concatenation, 27, 28 104, 113
conquer, 50, 57, 58 depletion, 161, 331
CPU, 31, 47, 302 digital library, 77
Crack -proofing, 318 Distinct type, 88
Creation operation, 27 Do....while loop., 44
Cyber terrorism, 305 domain, 85, 86, 87, 92, 101, 147, 150,
161, 279
Data, ix, 1, 2, 8, 11, 28, 50, 63, 69, 70,
75, 76, 78, 80, 82, 83, 91, 99, 101, Double, 4
106, 107, 108, 110, 112, 115, 116,
117, 118, 119, 121, 122, 125, 129, drones, 345, 358, 359, 360, 368
130, 144, 148, 150, 153, 155, 156, Dynamic, 5, 24, 25, 149, 191
157, 158, 159, 172, 179, 192, 193,
265, 266, 267, 268, 271, 285, 301, emerging technologies, 2, 326, 336,
302, 303, 311, 323, 324, 334, 351, 337, 339, 364, 365, 366, 367, 368
357, 363, 372 encapsulation, 155, 157, 158, 159, 193,
Data Access, 285 196
data model, 79, 81, 82, 83, 84, 85, 92, encryption, 112, 113, 268, 270, 285,
93, 100, 113, 117 293, 302, 311
387
Student’s Book Form Six Tanzania Institute of Education (TIE)
388
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Microwaves, 175, 176 Postorder, 33, 36, 61
mobile, 62, 70, 77, 102, 128, 132, 178, Preorder, 33, 35, 37
181, 268, 298, 322, 328, 329, 335,
primary key, 85, 86, 87, 91, 92, 98, 102,
336, 342, 347, 350, 357, 363, 366
103
Modem, 146
Primitive, 2, 3, 4, 5, 27, 59, 60
Multiplexer, 185, 186, 187, 188, 193
print, 32, 303, 353, 354, 355, 367
Multiplexing, 185, 186, 187, 188, 189,
Private Address, 160, 164
190, 191, 193, 196
Programming, ix, 1, 372
MySQL, 77, 92, 106, 112
project manager, 325, 327
Network, 70, 71, 80, 127, 128, 129,
130, 131, 132, 133, 135, 138, 140, properties window
142, 144, 146, 149, 150, 151, 153,
154, 155, 158, 159, 160, 161, 163, protection, 112, 119, 184, 262, 263,
164, 165, 168, 180, 181, 182, 183, 265, 266, 267, 268, 270, 280, 283,
184, 190, 193, 268, 280, 281, 283, 285, 304, 311, 314, 317, 318, 319,
285, 289, 290, 291, 294, 295, 296, 321, 322, 351
297, 298, 307, 324, 325, 326, 327, protocol, 147, 149, 153, 154, 155, 156,
363 157, 159, 160, 181, 192, 193, 197,
network layer, 149, 150, 153, 154, 155, 289, 290, 292, 294, 299, 300, 347
160, 295, 300 PUSH, 28, 29
normalization, 91, 99, 101, 105, 113 query, 82, 89, 91, 109, 110, 111, 113,
OSI, 151, 152, 153, 154, 155, 159, 193, 114, 277, 278
196 queue, 5, 26, 31, 32, 60, 61
PaaS, 350 Queues, 31, 32
packets, 147, 148, 149, 150, 153, 155, Quicksort, 57, 59
156, 157, 160, 161, 190, 276, 290,
292, 294, 298 radio, 70, 116, 127, 129, 175, 178, 179,
180, 182, 193
Passive, 285
real-time, 74, 75, 77, 115, 297, 361
Penetration testing, 305, 309
Records, 16, 17, 60
physical layer, 146, 152, 153, 193
recursion, 40, 41, 43, 57
piracy, 262, 316, 317, 318, 319, 322
Recursive algorithms, 40, 43
pollution, 331
389
Student’s Book Form Six Tanzania Institute of Education (TIE)
Recycling, 333 stack, 5, 24, 28, 29, 30, 45, 61, 296
Red Hat Hackers, 306 star, 133, 134, 135, 136, 147, 193, 197
redundancy, 78, 80, 98, 101, 268, 282 Switch, 148, 184
Renting, 317 Syntax, 8, 42
Robustness, 2 system administrator, 164, 275, 305,
325, 326
Router, 149, 150, 298
Systems Analyst, 325
Script Kiddies, 305, 306
TCP, 151, 154, 155, 156, 157, 159, 160,
security, 67, 91, 112, 113, 119, 132,
161, 193, 196, 197, 290, 292, 296,
141, 169, 183, 190, 193, 196, 262,
298
263, 264, 265, 266, 267, 268, 269,
270, 271, 278, 280, 281, 282, 283, Telecommunication, 70
284, 285, 286, 287, 288, 291, 293,
telephone, 64, 130, 132, 146, 169, 170,
297, 298, 299, 300, 302, 303, 304,
172, 173, 174, 176, 187, 190, 191,
305, 306, 307, 308, 309, 311, 312,
193, 341, 342
313, 314, 316, 321, 322, 323, 324,
325, 326, 327, 328, 330, 348, 350, terminator, 133, 172
351, 356, 364, 366, 368
topology, 127, 132, 133, 134, 135, 136,
Selection-sort, 50 137, 138, 139, 147, 192, 197, 291,
307
server, 106, 127, 130, 135, 140, 141,
142, 143, 144, 145, 193, 196, 197, transmission, 1, 70, 115, 116, 117, 118,
275, 276, 277, 278, 283, 284, 285, 119, 120, 121, 122, 123, 124, 125,
294, 299, 303, 304, 311, 327, 343, 126, 127, 131, 132, 133, 146, 148,
344, 347, 350, 351, 356 151, 153, 155, 168, 169, 170, 172,
173, 174, 175, 176, 177, 178, 179,
signal, 117, 118, 119, 122, 123, 125,
184, 186, 187, 188, 189, 190, 191,
126, 133, 134, 146, 147, 168, 169,
192, 196, 197, 262, 267, 298, 322,
172, 174, 175, 176, 177, 182, 183,
356
185, 186, 187, 188, 189, 190, 191,
192, 193, 363 Transmitter, 117
Simplex, 119, 125, 126 traversal, 26, 33, 34, 35, 36, 37
Software, 70, 131, 264, 316, 317, 318, Traversing, 27, 28
320, 322, 326, 350, 362
tree, 5, 32, 33, 34, 35, 36, 37, 60, 61,
Software as a Service, 350 79, 80, 133, 134, 138
Software counterfeiting, 317 Trojan, 274, 280, 281, 309
390
Tanzania Institute of Education (TIE) for Advanced Secondary Schools
Computer Science
Two-dimensional, 7, 8, 9, 80
UDP, 153, 155, 156, 157, 161, 193,
197, 290
Unmanned, 337, 358, 359, 360
User Datagram Protocol, 153, 155, 156
user interface, 68, 329
User-defined data, 4, 11, 19, 24
variable, 4, 7, 11, 12, 14, 16, 26, 32, 60,
161
VB.Net
VICOBA, 347, 348
WAN, 71, 129, 131, 132, 155, 178, 182,
192, 193
Web, 132, 317, 324, 325, 328, 330
While loop, 9, 44
White hat hackers, 306
Wi-Fi, 151, 180, 181, 182, 183, 193,
276, 308, 309
391
Student’s Book Form Six Tanzania Institute of Education (TIE)