Matric Tech Class 9th IoT Software Development - 2
Matric Tech Class 9th IoT Software Development - 2
Matric Tech Class 9th IoT Software Development - 2
Software Development
IX
This book has been written to meet the requirements of Matric Tech to train the
students in the Internet of Things (IoT). This book is specific for IoT software
development. Matric Tech in IoT has been introduced first time in the history of
Pakistan. This textbook is the first national effort to describe all the topics related
to IoT software development in one book. A key attempt has been made to make
the book interesting and useful. All the chapters covers the basic details
understandable to the students of Matric Tech. All chapters includes assessments
in form of MCQs, short questions and long questions.
The book covers 40% theory and 60% practical content. This content is equally
helpful for the students of electronics, computer sciences and networking.
Any improvements and suggestions for the betterment of this book will be highly
acknowledged.
1
About the Book
This book covers all the topics to train students in Internet of Things software
development. All the topics are explained in a convenient way understandable
to the students of Matric Tech. The books starts with the concepts of IoT and
provide concepts of operating systems and computer networks. Afterwards, we
explain computer programming and computer security. Programming is
explained in a way to quickly adapt to embedded systems programming. Last
chapter covers communication skills.
The book should not be crammed. It should be read conceptually. Perform all
the activities and tasks to have hands on experience on IoT. The sequence of
chapters can be ajdusted as per convenience of the tutor. Make sure you never
skip a pre-requisite of a chapter.
2
About the Author
Acknowledgements:
Special thanks to Dr. Faheem Gohar Awan for his contribution and guidance in
writing this book.
Reviewers:
Dr. Ahmed Mustafa
3
Table of Contents
Sr. No. Chapter Name Page Number
1. Introduction to IoT 6
1.1 Internet of Things 7
1.2 Scope of IoT 11
1.3 Verticals of IoT 12
2. Operating Systems 19
2.1 System Software vs Application Software 20
2.2 Operating Systems Abstractions 21
2.3 Firmware 24
2.4 Installing UBUNTU 26
2.5 Installing Windows 29
2.6 Installing new OS in VMware Workstation 33
2.7 Operating Systems Usage 36
2.8 Update vs Upgrade 45
3. Computer Networks 51
3.1 Computer Networks 52
3.2 Network cables and Specifications 58
3.3 Network Devices 65
3.4 Network Topologies 68
3.5 Configuring a Router 72
3.6 OSI Model 76
3.7 81
4
5. Introduction to C 103
5.1 C Programming 104
5.2 Structure of a C Program 105
5.3 Life Cycle of a C Program 105
5.4 Setting up Programming Environment 106
5.5 Input/Output Streams in C 109
5.6 Arithmetic Operators in C 116
5.7 Decision Making 127
5.8 Loops in C 132
5.9 Functions in C 136
5.10 Arrays in C 139
5.11 Strings in C 141
5
Chapter no. 1
Introduction to IoT
Do you know?
Initial concept of IoT was to create a separate network of “things”. It was not
necessary to connect things with the Internet.
Sensors/Devices:
Sensors or devices help in collecting very minute data from the surrounding
environment. All of this collected data can have various degrees of complexities ranging
from a simple temperature monitoring sensor or a complex full video feed. A device
can have multiple sensors. For example, our phone is a device that has multiple sensors
such as GPS, accelerometer, camera but our phone does not simply sense things.
7
Chapter 1
Connectivity:
The sensors can be connected to the cloud through various mediums of communication
such as cellular networks, satellite networks, Wi-Fi, Bluetooth, wide-area networks
(WAN), low power wide area network and many more. Each option has some
specifications and trade-offs between power consumption, range, and bandwidth.
So, choosing the best connectivity option in the IOT system is important.
Data Processing:
Once the data is collected and it gets to the cloud, the software performs processing on
the acquired data. This can range from something very simple, such as checking that
the temperature reading on devices such as AC or heaters is within an acceptable range.
It can sometimes also be very complex, such as identifying objects (such as intruders in
your house) using computer vision on video. There might be a situation when a user
interaction is required.
User Interface:
In an IoT systems, the information is made available to the end-user in some way. This
can be achieved by triggering alarms on their phones or notifying through texts or
emails. A user might also have an interface through which they can actively check in
on their IoT system. For example, a user has a camera installed in his house, he might
want to check the video recordings and all the feeds through a web server. However,
it’s not always this easy and a one-way street. Depending on the IoT application and
complexity of the system, the user may also be able to perform an action that may
backfire and affect the system. For example, if a user detects some changes in the
refrigerator, the user can remotely adjust the temperature via their phone. There are also
cases where some actions take place automatically. By establishing and implementing
some predefined rules, the entire IoT system can adjust the settings automatically and
no human has to be physically present. In case any intruders are sensed, the system can
generate an alert not only to the owner of the house but to the concerned authorities.
Figure 1.1 shows user dashboard of an IoT enabled smart home.
8
Chapter 1
Teacher Notes:
➢ Give real-life live examples of IoT systems to students.
All this is possible due to the connection of the IoT devices over the internet servers
that helps in sharing and exchanging the data. This technology reduces human efforts
and saves a lot of time.
10
Chapter 1
1.2 Scope of IoT
Internet of Things has emerged as a leading technology around the world. It has gained
a lot of popularity in lesser time. Also, the advancements in Artificial Intelligence and
Machine Learning have made the automation of IoT devices easy. Basically, AI and
ML programs are combined with IoT devices to make them intelligent. Due to this, IoT
has also expanded its area of application in various sectors. IoT applications are found
in smart homes, smart buildings, smart cities, smart agriculture and smart transportation
etc. Figure 1.4 enlists scope of IoT in different domains.
Do you know?
There are expected to be more than 30.9B IoT devices worldwide by 2025.
According to the latest research, the number of IoT-connected devices globally
reached 11.7 billion in 2020.
11
Chapter 1
1.3 Verticals of IoT
The following are some IoT vertical markets that have most noticeably adopted IoT
solutions to date.
12
Chapter 1
enterprise in the oil and gas industry successful. Regulatory compliance can be
accurately monitored and overall costs decrease.
Agriculture is one of the major industries constituting a large sector of economy. It
involving food farming, livestock farming and cotton farming. With the ever-increasing
population of the earth, it is important for the farming industry to operate as efficiently
and effectively as possible. IoT can enable local and commercial farming to be more
environmentally friendly, cost effective and production efficient. Figure 1.6 shows
components of Industrial IoT.
13
Chapter 1
predictive maintenance work together as an end-to-end solution. Figure 1.7 shows
components of a smart transportation system.
Do you know?
The Google Smart Home platform lets users control your commercially
available connected devices through the Google Home app and Google
Assistant, which is available on more than 1 billion devices, like smart
speakers, phones, cars, TVs, headphones, watches, and more.
14
Chapter 1
Interesting Information
➢ Singapore is the smartest city in the world, according to the IMD’s
inaugural Smart City Index.
15
Chapter 1
16
Fig. 1.10 Components of Smart Healthcare
Chapter 1
These are just a few of the many vertical markets adopting Internet of Things solutions
in the world today. Many of these solutions have no doubt had an effect on you, whether
noticed or not. In fact, the seamless experience of these solutions is actually one of the
most important aspects of IoT implementation and adoption by consumers. The
acceleration of the internet of things will only be more prevalent moving forward.
Key Points
➢ The Internet of Things (IoT) refers to the billions of physical devices around
the world that are connected to the Internet.
➢ An IoT system consists of Sensors, actuators, connectivity medium, IoT cloud
and a user interface.
➢ IoT applications are found in smart homes, smart buildings, smart cities, smart
agriculture and smart transportation etc.
➢ Smart building management involves collecting data from smart devices and
sensors to remotely monitor a property’s energy, security, landscaping,
HVAC, lighting and more.
➢ Industrial IoT (IIoT) uses system integration and sensors to gather data within
a process for analysing and optimizing different manufacturing and other
processes.
➢ In an IoT enabled smart transportation environment, fleet management, asset
tracking and predictive maintenance work together as an end-to-end solution.
➢ Consumers connecting smart devices within homes can enhance the home
experience, increase home security and conserve energy.
➢ A smart city addresses traffic, public safety, energy management and more for
its government and citizens.
➢ In healthcare, IoT enables critical business and patient monitoring decisions to
be made remotely and in real-time.
17
Chapter 1
Exercise
Multiple Choice Questions:
1. IoT stands for
a. Internet of Devices b. Internet of triangles c. Internet of Trees d. Internet
of Things
Short Questions:
1. Define IoT.
2. What is the importance of IoT?
3. What is the scope of IoT?
4. Enlist some applications of IoT.
Long Questions:
1. Explain different components of an IoT system.
2. Describe IoT verticals and their components.
18
Chapter 2
Chapter no. 2
Operating Systems
After Studying this chapter, you will be able to:
➢ define software and operating system.
➢ learn types of software: system software, application software.
➢ describe various types of operating systems: Windows, Linux.
➢ understand firmware.
➢ understand Installation of OS (windows and Linux).
➢ describe different steps of installation process.
➢ boot from storage media (DVD, Mass storage, external hard disk etc.).
➢ partitioning and formatting, selecting appropriate drive.
➢ install device driver.
➢ install operating system on virtual machine.
➢ know copying, moving, rename files and folders, search files and folders.
➢ personalize desktop settings and display settings.
➢ know files extensions, hide / unhide files / folders / system files.
➢ use device manager, task manager and command prompt.
➢ install application software on windows.
➢ differentiate between updating and upgrading.
➢ understand the process of updating.
➢ hard drive free space.
➢ downloading and applying updates to the OS.
➢ understand the process of upgrading.
19
➢ hard drive free space.
➢ booting from storage media (DVD, Mass storage, external hard disk etc.) or internet.
➢ selecting appropriate drive.
Chapter 2
2.1 System software v/s Application software
A software is a set of instructions or programs instructing a computer to do specific
tasks. Software is basically a generic term used to describe computer programs. In
general scripts, applications, programs and a set of instructions are terms often used to
describe a software.
On the basis of language in which software is developed and platform which is required
for its execution, we can classify software into two divisions: System software and
Application software. The following are some basic differences between a System
software and an Application software.
Installation System software are installed on the Application software are installed
computer when operating system is according to user’s requirements.
installed.
20
Chapter 2
Key System Software Application Software
Definition:
An operating system is a program that acts as an interface between the user and the
computer hardware and controls the execution of all kinds of programs.
2.2.1 Functions of an Operating System:
An operating system performs various functions as shown in Figure 2.1. The following
are some of important functions of an operating System.
• Memory Management
• Processor Management
• Device Management
• File Management
21
Chapter 2
• Security
• Job accounting
Memory Management
Memory management refers to management of Primary Memory or Main Memory.
Main memory is a large array of words (set of 2 bytes) or bytes where each word or
byte has its own address. Main memory provides a fast storage that can be accessed
directly by the CPU. For a program to be executed, it must in the main memory. An
Operating System does the following activities for memory management:
• Keeps tracks of primary memory, i.e., which parts of it are in use by whom,
which parts are not in use.
22
Chapter 2
• In multiprogramming, the OS decides which process will get memory when and
how much.
Processor Management:
In multiprogramming environment, the OS decides which process gets the processor
when and for how much time. This function is called process scheduling. An
Operating System does the following activities for processor management:
• Keeps tracks of processor and status of processes. The program responsible for
this task is known as traffic controller.
• Keeps tracks of all devices. Program responsible for this task is known as the I/O
controller.
• Decides which process gets the device when and for how much time.
• De-allocates devices.
File Management:
A file system is normally organized into directories for easy navigation and usage.
These directories may contain files and other directions. An Operating System does
the following activities for file management:
23
Chapter 2
• Decides who gets the resources.
2.3 Firmware
In electronic systems and computing, firmware is a tangible electronic component with
embedded software instructions, such as a BIOS. Typically, those software instructions
24
Chapter 2
are used to tell an electronic device how to operate. Typical examples of devices
containing firmware are embedded systems (such as traffic lights, consumer appliances,
and digital watches), computers, computer peripherals, mobile phones, and digital
cameras. The firmware contained in these devices provides the control program for the
device.
Firmware is stored in non-volatile memory devices such as ROM, EPROM, or flash
memory. Changing the firmware of a device may rarely or never be done during its
economic lifetime; some firmware memory devices are permanently installed and
cannot be changed after manufacture. Common reasons for updating firmware include
fixing bugs or adding features to the device. This may require ROM integrated circuits
to be physically replaced, or flash memory to be reprogrammed through a special
procedure. Firmware such as the ROM BIOS of a personal computer may contain only
elementary basic functions of a device and may only provide services to higher-level
software. Firmware such as the program of an embedded system may be the only
program that will run on the system and provide all of its functions.
Interesting Information
BIOS, computing, stands for Basic Input/Output System. The BIOS is a
computer program embedded on a chip on a computer's motherboard that
recognizes and controls various devices that make up the computer.
Do you know?
The first operating system was created by General Motors in 1956 to run a single
IBM central computer. In the 1960s, IBM was the first computer manufacturer
to take on the task of developing operating systems and began distributing
operating systems included in its computers.
25
Chapter 2
2.4 Installing Ubuntu
The Ubuntu desktop is easy to use, easy to install and includes everything you need to
run your organisation, school, home or enterprise. It’s also open source, secure,
accessible and free to download.
It is easy to install Ubuntu from a DVD. Follow the following steps to install Ubuntu:
1. Put the Ubuntu DVD into your optical/DVD drive.
2. Restart your computer.
As soon as your computer boots, you’ll see the welcome window (Figure 2.2).
Select ‘Install Ubuntu’, and press return to launch the desktop installer automatically.
Alternatively, select the first option, ‘Try Ubuntu without installing’, to test Ubuntu.
Boot from USB Flash Drive:
Most computers boot from USB automatically. Simply insert the USB flash drive and
turn on your computer. You should see the same welcome window we saw in the
previous ‘Install from DVD’ step, prompting you to choose your language and install
26
Chapter 2
or try the Ubuntu desktop. If your computer doesn’t automatically boot from USB, try
holding F12 when your computer starts. This will allow you to select the USB device
from a system-specific boot menu. F12 is the most common key for bringing up your
system’s boot menu, but Escape+F2 and F10 are common alternatives.
Prepare to install Ubuntu:
After booting from selected storage media, installation wizard asks you to select your
keyboard layout. If the installer doesn’t guess the default layout correctly, use the
‘Detect Keyboard Layout’ button to run through a brief configuration procedure. After
selecting ‘Continue’ you will be asked ‘What apps would you like to install to start
with?’ The two options are ‘Normal installation’ and ‘Minimal installation’. The first is
the equivalent to the old default bundle of utilities, applications, games and media
players. The second takes considerably less storage space and allows you to install only
the required components.
Below the “installation-type” question are two checkboxes; one to enable updates while
installing and another to enable third-party software.
Allocate Drive Space:
Use the checkboxes to choose whether you’d like to install Ubuntu alongside another
operating system, delete your existing operating system and replace it with Ubuntu, or
— if you’re an advanced user — choose the ’Something else’ option (Figure 2.3).
Do you know?
The word "Ubuntu" is an ancient Zulu and Xhosa word that means "humanity to
others". Ubuntu also means "I am what I am because of who we all are". It was
chosen because these sentiments precisely describe the spirit of the Ubuntu
distribution.
Begin Installation:
After configuring storage, click on the ‘Install Now’ button. A small pane will appear
with an overview of the storage options you’ve chosen, with the chance to go back if
the details are incorrect. Click Continue to apply those changes in place and start the
installation process.
Select Location:
If you are connected to the internet, your location will be detected automatically. Check
your location is correct and click ’Forward’ to proceed. If you’re unsure of your time
zone, type the name of a local town or city or use the map to select your location.
Login Details:
In the next step, a login window (Figure 2.4) will appear. Enter your name and the
installer will automatically suggest a computer name and username. Username will be
your login and account name. Next, enter a strong password. You can also choose to
enable automatic login and home folder encryption.
29
Chapter 2
the SSD or HDD that your existing OS is stored on. You should move the drive with
the installer files to the very top of the boot order menu. Now, when you restart your
device the Windows 10 installer should load up first.
Restart your device: Save your settings in the BIOS/UEFI and reboot your device.
Complete the installation: Your device should now load up the Windows 10
installation tool on restart. This will guide you through the rest of the installation
process.
Wait for your computer to restart. Once your computer finishes restarting, you'll see
a window here with your geographical data. You're now ready to begin setting up your
Windows 10 installation. Follow the following steps to complete the installation of
Windows 10.
Click Install Now. It's in the middle of the window (Figure 2.5).
30
Chapter 2
In the next window (Figure 2.7), click the "Accept" box and click Next. This will
indicate that you accept the terms of use.
31
Chapter 2
In the next window, it will ask: "Which type of installation do you want?". Upgrade
option installs Windows 10 while preserving your files, apps, and settings. Wait for
Windows 10 to install. This process may take anywhere from half an hour to several
hours, depending on your computer's previous operating system and processing speed.
Installing Drivers:
Driver updates for Windows 10, along with many devices, such as network adapters,
monitors, printers, and video cards, are automatically downloaded and installed through
Windows Update. You probably already have the most recent drivers, but if you'd like
to manually update or reinstall a driver, follow the steps given below:
Update the device driver:
1. In the search box on the taskbar, enter device manager, then select Device
Manager.
2. Select a category to see names of devices, then right-click (or press and hold) the
one you’d like to update. See Figure 2.8.
3. Select Search automatically for updated driver software.
4. Select Update Driver.
5. If Windows doesn't find a new driver, you can try looking for one on the device
manufacturer's website and follow their instructions.
32
Chapter 2
Step 2: Select Typical (recommended), and then press Next (see Figure 2.10).
33
Chapter 2
Step 3: Pick how to install the operating system. Select Installer disc if the operating
system is in the disc drive. Otherwise, choose Installer disc image file (iso) if you have
a file that contains the OS, like a Windows 10 ISO or an ISO for macOS. Refer to Figure
2.11.
Step 4: Choose precisely where the OS files are located.
34
Chapter 2
Step 5: Select storage for this virtual machine, and then press Next. Refer to Figure
2.12.
Step 6: Select Customize Hardware and make any necessary changes. You can
change details about the memory, processors, disc drive, network adapter, USB
controller, sound card, printer, and display.
Network Adapter is an important component here that you might end up having to
adjust later if your virtual machine doesn’t have internet access. There are multiple
options, and some may or may not work properly depending on how your host computer
is set up and how the guest OS (the VM) works. You can skip this for now to have the
default option chosen for you.
Step 7: Choose Close to exit the Hardware screen, and then press Finish. VMware
Workstation will create the virtual disk you specified in Step 5 and then turn on the
virtual machine automatically. This process might take a while, but you can watch the
progress bar for an estimation of when it will finish.
35
Chapter 2
Step 8: Follow the directions for your specific operating system install to add the OS to
VMware Workstation.
2. mv command:
The mv command stands for move is used to move files and directories in Linux
System. The syntax for mv command is: mv <source> <destination>. We can simply
use the mv command along with the source and destination as shown in Figure 2.13.
It enables the top-level optimization (-O3) and permits find to follow symbolic links (-
L). The find command in Linux searches through the whole directory hierarchy under
/var/www/ for files that have .html on the end.
37
Chapter 2
Basic Examples
1. find . -name thisfile.txt
If you need to know how to find a file in Linux called thisfile.txt, it will look for it in
current and sub-directories.
2. find /home -name *.jpg
Look for all .jpg files in the /home and directories below it.
3. find . -type f -empty
Look for an empty file inside the current directory.
4. find /home -user randomperson-mtime 6 -iname ".db"
Look for all .db files (ignoring text case) that have been changed in the preceding 6 days
by a user called randomperson.
1. Personalization:
Windows 10 makes it easy to customize the look and feel of your desktop. To access
the Personalization settings, right-click anywhere on the desktop, then
select Personalize from the drop-down menu as shown in Figure 2.14. The
Personalization settings will appear.
38
Chapter 2
2. To change the font size:
If you have difficulty seeing the text on your computer, you can increase the font size.
Increasing the font size will also increase the size of icons and other items on your
desktop.
1. Open the Settings app, then select System.
2. The Display options will appear as shown in Figure 2.15. Use the
drop-down arrow to scale up or down the size. Note that a larger
size may interfere with the way some items appear on the screen.
3. Once you've made your selection, the changes will take effect.
4. When you're done, click Finish. The ClearType settings will be
applied.
3. Windows File Extensions:
Windows file names have two parts; the file's name, then a period followed by the
extension (suffix). The extension is a three- or four-letter abbreviation that signifies the
39
Chapter 2
file type. For example, in letter.docx the filename is letter and the extension
is docx. Extensions are important because they tell your computer what icon to use for
the file, and what application can open the file. For example, the doc extension tells
your computer that the file is a Microsoft Word file.
4. Unhide Files and Folders:
1. Click on the start menu and type "Show hidden files and folders," then press the
enter key or select that option from the list of results as shown in Figure 2.16.
2. Under Advanced settings, select Show hidden files, folders, and drives, and
then select OK.
5. Hide a File or Folder on Windows:
To hide a file or folder on Windows, open a Windows Explorer or File Explorer window
and locate the file or folder you want to hide. Right-click it and select Properties. Enable
40
Chapter 2
the Hidden checkbox on the General pane of the Properties window as shown in Figure
2.17. Click OK or Apply and your file or folder will be hidden.
6. Device Manager:
Device Manager is defined as a Control Panel that is an extension of the Microsoft
Management Console. It provides users an organized, central view of the Windows-
recognized hardware attached to a computer. This includes devices like keyboards, hard
disk drives, USB devices etc. It sorts out all hardware, listing them on the basis of
various criteria and when a device malfunctions or stops working altogether, it
immediately notifies the user. Thus, it can be used to control devices, enable or disable
them, configure them and identify conflicts between devices etc.
41
Chapter 2
7.Task Manager:
The Windows Task Manager is a powerful tool packed with useful information, from
your system’s overall resource usage to detailed statistics about each process.
Launching the Task Manager:
Windows offers many ways to launch the Task Manager. Press Ctrl+Shift+Esc to open
the Task Manager with a keyboard shortcut or right-click the Windows taskbar and
select “Task Manager.” You can also press Ctrl+Alt+Delete and then click “Task
Manager” on the screen that appears or find the Task Manager shortcut in the Start
menu.
The first time you launch the Task Manager, you’ll see a small, simple window. This
window lists the visible applications running on your desktop, excluding background
applications. You can select an application here and click “End Task” to close it. This
is useful if an application isn’t responding—in other words, if it’s frozen—and you can’t
close it the usual way. Figure 2.18 shows a view of a task manager.
42
Chapter 2
1. Click Start.
2. In the Search or Run line, type cmd (short for command), and
press Enter.
Command prompt in Windows can be used to list contents of a certain directory, move
into a directory, run application programs etc. A view of command prompt is given in
Figure 2.19.
43
Chapter 2
3. If the installer offers a language selection, choose yours; likewise, agree to the
end-user license agreement, if requested. Many installers require you to accept
an end-user license agreement (EULA).
4. If the installer offers Express or Custom installation options, choose the Express
option to let the installer set up the program without further input from you. The
Custom option or Advanced Settings allows you to specify where to install the
program and, perhaps, which parts of the program to install. Some installers
provide other options to install documentation and other programs or to register
the program.
5. As the installer program continues to run and display dialog boxes, click the Next
or Continue button. You proceed to the next dialog box each time you click.
44
Chapter 2
6. Click the Finish or Close button in the last step of the installer program to
complete the process.
In a few cases, the setup program may ask you to restart Windows 7. In this case, you
don’t have to restart immediately, but you won’t be able to use the new program until
you do restart. The new program may appear automatically at the bottom of the first
screen of the Start menu. Look under All Programs as well. Newly installed programs
are highlighted in colour. Some installers add a program icon to the desktop.
Many programs try to connect to the Internet for updates during installation or when
you run the installed program. The first time you run a program, you may be asked if
you want to register the program or configure some aspect of the program. Go with
default (assumed) responses, if you’re not sure.
Updating Windows:
To manage update options and see available updates, select Check for Windows
updates. Or select the Start button, and then go to Settings > Update & Security >
Windows Update.
45
Chapter 2
Upgrade from Windows 7 to Windows 10
Users can either do an in-place upgrade on same computer or a new clean install on a
new PC. In both methods simply use the Windows 7 Serial key when asked and it will
work perfectly. Make sure you have enough free disk space before upgrading. Check
the minimum free disk space required for Windows 10 upgrade.
In-place Upgrade:
In place upgrade helps to upgrade your existing Windows7 or Windows8 system to the
latest windows10 by keeping all your programs and data migrated to the latest version.
However, we recommend you to take the backup of your data before starting the
procedure.
Step 1: Download & run media creation tool.
Step 2: Select the option ‘upgrade this PC’. When you run the media creation tool it
will give you two options as shown in Figure 2.21. Select the first one “Upgrade this
PC now”.
Step 5: Wait while upgrade process finishes. Click on the next button and it will start
the upgrade process and may restart the system several times.
Step 6: If everything goes smooth you are welcome by Welcome screen of Windows
10. It will ask you to set the privacy settings first. Set the privacy settings and you are
ready to go.
47
Chapter 2
Key Points
➢ A software is a set of instructions or programs instructing a computer to do
specific tasks.
➢ System software is an interface between application software and system.
➢ Application software is the type of software which runs as per user request. It
runs on a platform which is provided by the system software.
➢ An operating system is a program that acts as an interface between the user
and the computer hardware and controls the execution of all kinds of
programs.
➢ A firmware is a tangible electronic component with embedded software
instructions, such as a BIOS.
➢ A Virtual Machine (VM) is a compute resource that uses software instead of
a physical computer to run programs and deploy apps.
➢ The cp command stands for copy is used to copy files and directories in Linux
System.
➢ The mv command stands for move is used to move files and directories in
Linux System.
➢ It provides users an organized, central view of the Windows-recognized
hardware attached to a computer.
➢ Updating involves making changes to an app or an operating system is such a
way that it doesn’t affect its core structure.
➢ When a set of changes made to a software are significant and substantial
enough, it is called an Upgrade.
48
Chapter 2
Exercise
Multiple Choice Questions:
1. Windows is a
a. Operating Systems b. Firmware c. Application Software d. Both a and
b
2. VMware is a
4. cp command is used to
a. move files b. copy files c. delete files d. none of these
5. mv command is used to
a. move files b. copy files c. delete files d. none of these
Theoretical Questions:
1. Define Software.
2. Differentiate between applications software and system software?
3. Describe functionalities of an operating system.
4. Define Firmware.
5. Define Virtual Machine.
6. Define Task Manager.
7. Describe command prompt and its usage.
8. What is the purpose of Device Manager in Windows?
9. Differentiate Update and Upgrade.
49
Chapter 2
Practical Tasks:
1. Install Windows 10 on the given PC.
2. Replace Windows Installation with the Ubuntu Installation.
3. Install Ubuntu on VMware Workstation.
4. Use Command Prompt to copy the contents of a file into another file.
5. Uninstall an application program from Windows using Control Panel.
6. Upgrade Windows 7 to Windows 10 and make sure to keep all programs and
data in the Windows 10.
50
Chapter 3
Chapter no. 3
Computer Networks
After Studying this chapter, you will be able to:
➢ understand the basic types of computer network (LAN, WAN, MAN, PAN etc.).
➢ describe the basic knowledge of components used in networks.
➢ know and understand the communication media: unshielded twisted-pair (UTP), shielded
twisted pair (STP), fiber optics and coaxial cable. wireless media.
➢ describe terminologies used in computer network (data rate, Baud, Bit, Kbps, attenuation etc.).
➢ understand types of cables used in networking.
➢ differentiate straight and cross cable and understanding of connectors: RJ45, RJ-11, BNC.
➢ make cross wired and straight through connection.
➢ know about use of cable tester to test cable connector.
➢ understand fixing a cable and connector issue.
➢ know and understand of network components: modems, hubs, switches, bridges, routers etc.
➢ describe computer network topologies and differentiate active and passive network components.
➢ configure router settings and know about connecting cables with networking devices.
➢ know about network protocols (TCP / IP), OSI model, IPv4, IPv6, physical addresses.
➢ know about Static and dynamic IP and understanding of DHCP.
➢ know Setting of: IP Address (IP4/IP6) & subnet mask, gateway, classes of IP addressing.
➢ know about commands used in testing network (ping etc).
➢ check the Internet connectivity using router interface.
51
Chapter 3
3.1 Computer Network
A computer network is a group of computers linked to each other that enables them to
communicate with each other and share their resources, data, and applications.
52
Chapter 3
54
Chapter 3
▪ A Wide Area Network is widely used in the field of business, government, and
education.
55
Chapter 3
• Sharing of peripherals and internet access.
• Network gaming.
• Voice over IP (VoIP).
• Media Center Server.
• Centralize network administration, meaning less IT support.
• Flexibility.
• Allowing information sharing.
• Supporting distributed processing.
• User communication.
• Overcoming geographic separation.
In general, we can see “Communication” and “Sharing”, that is all networking is
about in simple terms. It enables everything that we do today. In the current scenario,
the business would not work without computer networking and our personal and social
life will also feel like it has been stopped.
56
Chapter 3
Transmission Media - Transmission media are the facilities used to interconnect
computers in a network, such as twisted-pair wire, coaxial cable, and optical fiber cable.
Transmission media are sometimes called transmission medium channels, links or lines.
Shared data - Shared data are data that file servers provide to clients such as data files,
printer access programs and e-mail.
Shared printers and other peripherals - Shared printers and peripherals are hardware
resources provided to the users of the network by servers. Resources provided include
data files, printers, software, or any other items used by clients on the network.
Network Interface Card - Each computer in a network has a special expansion card
called a network interface card (NIC). The NIC prepares (formats) and sends data,
receives data, and controls data flow between the computer and the network. On the
transmit side, the NIC passes frames of data on to the physical layer, which transmits
the data to the physical link. On the receiver's side, the NIC processes bits received from
the physical layer and processes the message based on its contents.
Local Operating System - A local operating system allows personal computers to
access files, print to a local printer, and use one or more disk and CD drives that are
located on the computer. Examples are MS-DOS, Unix, Linux, Windows 2000,
Windows 98, Windows XP etc. The network operating system is the software of the
network. It serves a similar purpose that the OS serves in a stand-alone computer
Network Operating System - The network operating system is a program that runs on
computers and servers that allows the computers to communicate over the network.
Hub - Hub is a device that splits a network connection into multiple computers. It is
like a distribution center. When a computer requests information from a network or a
specific computer, it sends the request to the hub through a cable. The hub will receive
the request and transmit it to the entire network. Each computer in the network should
then figure out whether the broadcast data is for them or not.
Switch - Switch is a telecommunication device grouped as one of computer network
components. Switch is like a Hub but built in with advanced features. It uses physical
device addresses in each incoming messages so that it can deliver the message to the
right destination or port.
57
Chapter 3
Unlike a hub, switch doesn't broadcast the received message to entire network, rather
before sending it checks to which system or port should the message be sent. In other
words, switch connects the source and destination directly which increases the speed of
the network.
Router - The device used to connect a LAN with an internet connection is called
Router. When you have two distinct networks (LANs) or want to share a single internet
connection to multiple computers, we use a Router.
LAN Cable - A local area network cable is also known as data cable or Ethernet cable
which is a wired cable used to connect a device to the internet or to other devices like
computer, printers, etc.
Twisted-pair Cables
The twisted-pair cable was primarily developed for computer networks. This cable is
also known as Ethernet cable. Almost all modern LAN computer networks use this
cable. This cable consists of color-coded pairs of insulated copper wires. Every two
58
Chapter 3
wires are twisted around each other to form pair. Usually, there are four pairs. Each
pair has one solid color and one stripped color wire. Solid colors are blue, brown,
green, and orange. In stripped color, the solid color is mixed with the white color.
Based on how pairs are stripped in the plastic sheath, there are two types of twisted-
pair cable; UTP and STP.
In the UTP (Unshielded twisted-pair) cable, all pairs are wrapped in a single plastic
sheath.
In the STP (Shielded twisted-pair) cable, each pair is wrapped with an additional metal
shield, then all pairs are wrapped in a single outer plastic sheath.
The following image (Figure 3.7) shows both types of twisted-pair cables.
59
Chapter 3
Fiber Optic Cable:
This cable consists of a core, cladding, buffer, and jacket. The core is made from thin
strands of glass or plastic that can carry data over a long distance. The core is wrapped
in the cladding; the cladding is wrapped in the buffer, and the buffer is wrapped in the
jacket. Fiber optic cable is completely immune to EMI and RFI. This cable can transmit
data over a long distance at the highest speed. It can transmit data up to 40 kilometres
at the speed of 100Gbps. Fiber optic uses light to send data. It reflects light from one
endpoint to another. Based on how many beams of light are transmitted at a given time,
there are two types of fiber optical cable; SMF and MMF as shown in Figure 3.8.
60
Chapter 3
What is Straight Through Cable?
Straight-through cable is a type of CAT5 with RJ-45 connectors at each end, and each
has the same pin out as shown in Figure 3.9. It is in accordance with either the T568A
or T568B standards. It uses the same color code throughout the LAN for consistency.
This type of twisted-pair cable is used in LAN to connect a computer or a network hub
such as a router. It is one of the most common types of network cable.
1. Plug one end of the cable into the transmit jack. The transmit jack on the tester
maybe be labelled "TX".
2. Plug the other end of the cable into the receiver jack. The receiver jack may be
labelled "RX" on the device. Some testers have a detachable receiver you can
use to test the cable across different rooms.
3. Check the lights on the tester. Most testers will have 2 sets of 8 LED lights that
correspond to the 8 pins on the transmitting and receiving end of the Ethernet
62
Chapter 3
cable. There will also be a G light for the ground. It will test each pin one at a
time. If all 8 pins light up on both ends, the cable is good. If any of the lights do
not light up on either end, this indicates a short in the cable. Don't worry if the G
light doesn't light up. If the lights on either end flash out of order, this indicates
that you are testing a crossover cable. As long as all 8 lights flash, the cable is
good.
Fixing a RJ45 Connector:
1. Strip the cable back 1 inch (25 mm) from the end.
2. Untwist and straighten the wires inside of the cable.
3. Arrange the wires into the right order.
4. Cut the wires into an even line 1⁄2 inch (13 mm) from sheathing.
5. Insert the wires into the RJ-45 connector.
6. Stick the connector into the crimping part of the tool and squeeze twice.
7. Remove the cable from the tool and check that all of the pins are down.
63
Chapter 3
Teacher Notes:
➢ Give a demonstration of speedtest.net to students.
Baud Rate:
Baud rate refers to the number of signal or symbol changes that occur per second. A
symbol is one of several voltage, frequency, or phase changes. NRZ (Non Return to
Zero) binary has two symbols, one for each bit 0 or 1, that represent voltage levels. In
this case, the baud or symbol rate is the same as the bit rate. However, it’s possible to
have more than two symbols per transmission interval, whereby each symbol represents
multiple bits. With more than two symbols, data is transmitted using modulation
techniques. By using multiple symbols, multiple bits can be transmitted per symbol. For
example, if the symbol rate is 4800 baud and each symbol represents two bits, that
translates into an overall bit rate of 9600 bits/s. Normally the number of symbols is
some power of two. If N is the number of bits per symbol, then the number of required
symbols is S = 2N.
Attenuation:
Attenuation in computer networking is the loss of communication signal strength that
is measured in decibels (dB). As the rate of attenuation increases, the transmission, such
as an email a user is trying to send or a phone call, becomes more distorted. Attenuation
occurs on computer networks because of:
• Range – over longer distances both wired and wireless transmissions
gradually dissipate in strength
• Interference – radio interference or physical obstructions, such as walls,
dampen communication signals on wireless networks
• Wire size – thinner wires suffer from more attenuation than thicker wires on
wired networks
64
Chapter 3
3.3 Network Devices
1. Repeater – A repeater operates at the physical layer. Its job is to regenerate the signal
over the same network before the signal becomes too weak or corrupted so as to extend
the length to which the signal can be transmitted over the same network. An important
point to be noted about repeaters is that they do not amplify the signal. When the signal
becomes weak, they copy the signal bit by bit and regenerate it at the original strength.
It is a 2-port device.
2. Hub – A hub is basically a multiport repeater. A hub connects multiple wires coming
from different branches, for example, the connector in star topology which connects
different stations. Hubs cannot filter data, so data packets are sent to all connected
devices. In other words, the collision domain of all hosts connected through Hub
remains one. Also, they do not have the intelligence to find out the best path for data
packets which leads to inefficiencies and wastage.
3. Bridge – A bridge operates at the data link layer. A bridge is a repeater, with add on
the functionality of filtering content by reading the MAC addresses of source and
destination. It is also used for interconnecting two LANs working on the same protocol.
It has a single input and single output port, thus making it a 2-port device.
4. Switch – A switch is a multiport bridge with a buffer and a design that can boost its
efficiency (a large number of ports imply less traffic) and performance. A switch is a
data link layer device. The switch can perform error checking before forwarding data,
which makes it very efficient as it does not forward packets that have errors and forward
good packets selectively to the correct port only.
5. Routers – A router is a device like a switch that routes data packets based on their
IP addresses. The router is mainly a Network Layer device. Routers normally connect
LANs and WANs together and have a dynamically updating routing table based on
which they make decisions on routing the data packets. Router divide broadcast
domains of hosts connected through it.
65
Chapter 3
66
Chapter 3
commands. Interfaces are configured in interface mode which is available from global
configuration mode after logging in. Generally, three types of interfaces are provided
to manage a Network switch:
Simple Network Management Protocol:
Also known as SNMP, it is a protocol that facilitates the exchange of management
information between network devices. SNMP queries can determine the health of a
network or the status of a particular device.
Command Line Interface:
Command Line Interface (CLI) is an exhaustive set of commands that can be accessed
via serial console, Telnet, and Secure Shell.
The Web Interface:
User can monitor and configure the switch from a browser, by entering a URL.
3.3.2 Wireless Devices and their Roles:
There are three major “modes” a Wi-Fi device can use. These modes define the role a
Wi-Fi device has in the network, and networks must be built out of combinations of
devices operating in these different modes. How the devices are configured depends on
the types of connections you want to use between parts of the network.
The three wireless roles are:
1. Wireless Clients (Station):
Devices such as computers, tablets, and phones are common clients on a network. When
you are accessing a wireless hotspot, or the router in your home or office, your device
is the client. This client mode is also known as “station mode” as well.
2. Access Points (Master):
Most wireless networks are made using Access Points - devices that host and control
the wireless connection for laptops, tablets, or smart phones. If you use Wi-Fi in your
home or office, it is most likely through an Access Point. When a router is set up as an
AP, it is said to be in “Master” or “Infrastructure” mode.
An AP is sometimes a stand-alone device that bridges between a wireless and wired
(Ethernet) network, or is part of a router. APs can cover a range of areas with a wireless
67
Chapter 3
signal, depending on the power of the device and the type of antenna. There are also
some APs that are weatherproof, designed to be mounted outdoors.
3. Ad-Hoc Node (Mesh):
Some wireless devices (laptops, smart phones, or wireless routers) support a mode
called Ad-Hoc. This allows those devices to connect together directly, without an
Access Point in-between controlling the connection. This forms a different type of
network - in Ad-Hoc mode, all devices are responsible for sending and receiving
messages to the other devices - without anything else in between. In an Ad-Hoc
network, every device must be in this role, and using the same configuration to
participate.
68
Chapter 3
one of the simple forms of networking where a failure of a device does not affect the
other devices. But failure of the shared communication line can make all other devices
stop functioning.
Both ends of the shared channel have line terminator as shown in Figure 3.14. The data
is sent in only one direction and as soon as it reaches the extreme end, the terminator
removes the data from the line.
Star Topology:
All hosts in Star topology are connected to a central device, known as hub device, using
a point-to-point connection. That is, there exists a point-to-point connection between
hosts and hub. The hub device can be any of the following:
• Layer-1 device such as hub or repeater
• Layer-2 device such as switch or bridge
• Layer-3 device such as router or gateway
69
Chapter 3
As in Bus topology, hub acts as single point of failure. If hub fails, connectivity of all
hosts to all other hosts fails. Every communication between hosts, takes place through
only the hub. Star topology is not expensive as to connect one more host, only one cable
is required and configuration is simple.
Ring Topology:
In ring topology, each host machine connects to exactly two other machines, creating
a circular network structure. When one host tries to communicate or send message to
a host which is not adjacent to it, the data travels through all intermediate hosts. To
connect one more host in the existing structure, the administrator may need only one
more extra cable. Ring topology is shown in Figure 3.16.
Failure of any host results in failure of the whole ring. Thus, every connection in the
ring is a point of failure. There are methods which employ one more backup ring.
Mesh Topology:
In this type of topology, a host is connected to one or multiple hosts. This topology has
hosts in point-to-point connection with every other host or may also have hosts which
are in point-to-point connection to few hosts only.
70
Chapter 3
• Switch
• Repeater
• Hub
• Bridge
• Router
• Print Server
• Access point (AP)
Passive Networking Hardware are those parts of computer network that are involved
in data transmission in the network, but they don’t change or affect the data. The passive
network hardware includes:
71
Chapter 3
3.5 Configuring a Router
Network configuration is the process of setting a network's controls, flow and operation
to support the network communication of an organization and/or network owner. This
broad term incorporates multiple configuration and setup processes on network
hardware, software and other supporting devices and components.
Before configuring, connect a computer to TP-Link router by cable or through wireless
network as shown in Figure 3.18. It is recommended to configure it by a wired
connection.
Log into the router’s web-based utility and follow the following steps:
Step 1
Select Wireless->Wireless Settings on the left side menu to open the wireless setting
page as shown in Figure 3.19.
Wireless Network Name (also called SSID for some models): Create a new name for
your wireless network. If you want to use the default TP-Link_****** wireless name,
you can also leave it here as default value.
Region: Select your current location.
"Enable Wireless Router Radio" and "Enable SSID Broadcast" should be both
ticked.
Please do not change other settings on this page if not necessary.
72
Chapter 3
Step 2
Select Wireless->Wireless Security on the left side menu as shown in Figure 3.20. It’s
recommended to use WPA/WPA2 Personal (Recommended), some models will name
that as WPA-PSK/WPA2-PSK instead.
74
Chapter 3
IP settings of a Network:
If your ISP provides the DHCP service, please select Dynamic IP (as shown in Figure
3.22), and the router will automatically get IP parameters from your ISP.
Static IP:
If your ISP provides a static or fixed IP address, subnet mask, default gateway and DNS
setting, please select Static IP in Figure 3.22 and fill the following fields:
•IP Address - Enter the IP address in dotted-decimal notation provided by your ISP.
•Subnet Mask - Enter the subnet mask in dotted-decimal notation provided by your
ISP. Normally 255.255.255.0 is used as the subnet mask.
•Gateway - Enter the gateway IP address in dotted-decimal notation provided by your
ISP.
•Primary/Secondary DNS Server - (Optional) Enter one or two DNS addresses in
dotted-decimal notation provided by your ISP.
•MTU (Bytes) - The normal MTU (Maximum Transmission Unit) value for most
Ethernet networks is 1500 Bytes. It is not recommended that you change the default
MTU size unless required by your ISP.
•Enable IGMP Proxy - IGMP (Internet Group Management Protocol) is used to
manage multicasting on TCP/IP networks. Some ISPs use IGMP to perform remote
75
Chapter 3
configuration for client devices, such as the modem router. The default value is
enabled, and if you are not sure, please contact your ISP or just leave it.
Application Layer: The application layer is used by end-user software such as web
browsers and email clients. It provides protocols that allow software to send and
receive information and present meaningful data to users. A few examples of
application layer protocols are the Hypertext Transfer Protocol (HTTP), File Transfer
Protocol (FTP), Post Office Protocol (POP), Simple Mail Transfer Protocol (SMTP),
and Domain Name System (DNS).
Presentation Layer: The presentation layer prepares data for the application layer. It
defines how two devices should encode, encrypt, and compress data so it is received
76
Chapter 3
correctly on the other end. The presentation layer takes any data transmitted by the
application layer and prepares it for transmission over the session layer.
Session Layer: The session layer creates communication channels, called sessions,
between devices. It is responsible for opening sessions, ensuring they remain open and
functional while data is being transferred, and closing them when communication ends.
The session layer can also set checkpoints during a data transfer—if the session is
interrupted, devices can resume data transfer from the last checkpoint.
Transport Layer: The transport layer takes data transferred in the session layer and
breaks it into “segments” on the transmitting end. It is responsible for reassembling the
segments on the receiving end, turning it back into data that can be used by the session
layer. The transport layer carries out flow control, sending data at a rate that matches
the connection speed of the receiving device, and error control, checking if data was
received incorrectly and if not, requesting it again.
Network Layer: The network layer has two main functions. One is breaking up
segments into network packets, and reassembling the packets on the receiving end. The
other is routing packets by discovering the best path across a physical network. The
network layer uses network addresses (typically Internet Protocol addresses) to route
packets to a destination node.
Data Link Layer: The data link layer establishes and terminates a connection between
two physically-connected nodes on a network. It breaks up packets into frames and
sends them from source to destination. This layer is composed of two parts—Logical
Link Control (LLC), which identifies network protocols, performs error checking and
synchronizes frames, and Media Access Control (MAC) which uses MAC addresses to
connect devices and define permissions to transmit and receive data.
Physical Layer: The physical layer is responsible for the physical cable or wireless
connection between network nodes. It defines the connector, the electrical cable or
wireless technology connecting the devices, and is responsible for transmission of the
raw data, which is simply a series of 0s and 1s, while taking care of bit rate control.
77
Chapter 3
TCP/IP model:
The TCP/IP model was developed prior to the OSI model. The TCP/IP model is not
exactly similar to the OSI model.
o The TCP/IP model consists of five layers: the application layer, transport layer,
network layer, data link layer and physical layer.
o The first four layers provide physical standards, network interface,
internetworking, and transport functions that correspond to the first four layers
of the OSI model and these four layers are represented in TCP/IP model by a
single layer called the application layer.
o TCP/IP is a hierarchical protocol made up of interactive modules, and each of
them provides specific functionality.
Here, hierarchical means that each upper-layer protocol is supported by two or more
lower-level protocols.
OSI vs. TCP/IP Model:
The Transfer Control Protocol/Internet Protocol (TCP/IP) is older than the OSI model
and was created by the US Department of Defence (DoD). A key difference between
the models is that TCP/IP is simpler, collapsing several OSI layers into one:
• OSI layers 5, 6, 7 are combined into one Application Layer in TCP/IP as shown
in Figure 3.24.
• OSI layers 1, 2 are combined into one Network Access Layer in TCP/IP –
however TCP/IP does not take responsibility for sequencing and
acknowledgement functions, leaving these to the underlying transport layer.
78
Chapter 3
What is IP?
An IP (Internet Protocol) address is a numerical label assigned to each device
connected to a computer network that uses the IP protocol for communication. An IP
address acts as an identifier for a specific device on a particular network. The IP address
is also called an IP number or Internet address. IP address specifies the technical format
of the addressing and packets scheme. Most networks combine IP with a TCP
(Transmission Control Protocol). It also allows developing a virtual connection between
a destination and a source.
IPv4:
IPv4 is an IP version widely used to identify devices on a network using an addressing
system. It was the first version of IP deployed for production in the ARPANET in 1983.
It uses a 32-bit address scheme to store 2^32 addresses which is more than 4 billion
addresses. It is considered the primary Internet Protocol and carries 94% of Internet
traffic. for Beginners Introduction to Linux Operating System
79
Chapter 3
IPv6:
IPv6 is the most recent version of the Internet Protocol. This new IP address version is
being deployed to fulfill the need for more Internet addresses. It was aimed to resolve
issues that are associated with IPv4. With 128-bit address space, it allows 340
undecillion unique address space.
Static IP address:
A static IP address is simply an address that doesn't change. Once your device is
assigned a static IP address, that number typically stays the same until the device is
decommissioned or your network architecture changes. Static IP addresses generally
are used by servers or other important equipment. Static IP addresses are assigned by
Internet Service Providers (ISPs). Your ISP may or may not allocate you a static IP
address depending on the nature of your service agreement.
Dynamic IP address:
As the name suggests, dynamic IP addresses are subject to change, sometimes at a
moment's notice. Dynamic addresses are assigned, as needed, by Dynamic Host
Configuration Protocol (DHCP) servers. We use dynamic addresses because IPv4
doesn't provide enough static IP addresses to go around. So, for example, a hotel
probably has a static IP address, but each individual device within its rooms would have
a dynamic IP address. On the internet, your home or office may be assigned a dynamic
IP address by your ISP's DHCP server.
MAC Address:
The MAC address is a unique value associated with a network adapter. MAC addresses
are also known as hardware addresses or physical addresses. They uniquely identify
an adapter on a LAN. MAC addresses are 12-digit hexadecimal numbers (48 bits in
length). By convention, MAC addresses are usually written in one of the following
formats:
MM:MM:MM:SS:SS:SS
MMMM-MMSS-SSSS
80
Chapter 3
Subnet mask:
A 32-bit combination used to describe which portion of an address refers to the subnet
and which part refers to the host.
Classes of IP addresses
TCP/IP defines five classes of IP addresses: class A, B, C, D, and E. Each class has a
range of valid IP addresses. The value of the first octet determines the class. IP addresses
from the first three classes (A, B and C) can be used for host addresses. The other two
classes are used for other purposes – class D for multicast and class E for experimental
purposes.
81
Chapter 3
o Ping statistics for 216.119.143.98:
Alternatively, if the remote host is down, or not configured to respond to ping requests,
you do not see any responses.
Using Router Interface:
To check internet connectivity using router interface, follow the steps given below:
1. Open Router configuration page.
2. Click System Tools and Diagnostic.
3. Select one of the diagnostic tools: Ping.
Note: Ping troubleshoots connectivity, reachability, and name resolution to a given host
or gateway.
4. Type the IP Address/Domain name of the PC/server you want to ping the IP Address/
Domain Name, as shown in Figure 3.25.
5. Start Diagnose and analyze the results.
82
Chapter 3
Key Points
➢ A computer network is a group of computers linked to each other that enables
the computer to communicate with another computer and share their
resources, data, and applications.
➢ Local Area Network is a group of computers connected to each other (as
shown in Figure 3.2) in a small area such as building, office.
➢ Personal Area Network is a network arranged within an individual person,
typically within a range of 10 meters.
➢ A metropolitan area network is a network that covers a larger geographic area
by interconnecting a different LAN to form a larger network.
➢ A Wide Area Network is a network that extends over a large geographical
area such as states or countries.
➢ Hub is a device that splits a network connection into multiple computers.
83
Chapter 3
Exercise
Multiple Choice Questions:
1. Which of the following is the hardware/physical address of a computer?
a. IP Address b. MAC Address c. Static IP d. Subnet Mask
4. Ping is used to
a. Assign IP b. Login c. Test a network d. search files
Short Questions:
1. Define Computer Networks.
2. Differentiate between wired and wireless networks.
3. What is the difference between accesspoint and stations?
4. Define Router.
5. Define Switch.
Long Questions:
1. Differentiate between LAN and PAN.
2. Differentiate between IP address and MAC address.
3. Differentiate between IPv6 and IPv4.
4. Describe network topologies.
5. Describe DHCP mode.
84
Chapter 3
Practical Tasks:
1. Assign static IP addresses to the computers in the computer lab.
2. Perform Ping test to check the Internet connectivity of your computer
85
Chapter 4
Chapter no. 4
Basics of Programming
Language
86
Chapter 4
4.1 PROGRAMMING
Programming is talking to computer. It is a language to communicate with your
computer. The main unit of a computer is microprocessor. Each microprocessor is
designed to execute a certain set of instructions. Through programming, we pass these
instructions to computer and computer executes these instructions in given order.
A Computer language is defined as a code or a syntax which is used to write programs
or any specific applications. Computer language is used to communicate with
computers. Broadly, it can be classified into three categories assembly language,
machine language, and high-level language. The machine language is considered as
oldest computer language among all three. In machine language, the input is directly
given as binary input which is processed by the machine. Binary inputs mean one and
zero form. For computer language processing the system needs compiler and interpreter
to convert the language in computer language so that it can be processed by a machine.
What is inside a Microprocessor?
A microprocessor contains millions of transistors and capacitive elements. All these
components operate after providing voltages. Presence of voltage means a signal 1 and
absence of voltage means signal 0. So, a computer is only able to understand presence
and absence of voltages.
Machine Language to C:
Computer only understands machine language also called binary language. A machine
language instruction consists of only 0s and 1s. For example, to add two numbers,
machine language instruction can be 00011001. It is very difficult to remember and
understand these machine language instructions for programmers.
To make the instructions understandable to the programmer, assembly language was
formed. Assembly language consists of some simple statements i.e., sum a, b. This
instruction is supposed to add a and b. Each processor has its own assembly language
instruction set. So, it can only execute instructions from its instruction set. Whenever
an assembly language instruction is executed, it is first converted into equivalent
machine language instruction (consisting of 0s and 1s).
Although assembly language is easier to understand for the programmers, there is
87
Chapter 4
still missing information in assembly language instructions, for example, sum a, b is
equivalent to a = a + b, but it cannot be inferred from the instruction that result will be
assigned to a. To facilitate the programmers further, another language was designed
named “C Language”. This language was implemented to write programs in
mathematical language. In C language, if we have to sum a and b and store the result in
a, the instruction will be: a = a + b. There is no hidden information in this statement.
What is Programming?
When a C program is executed, it is first translated into equivalent assembly language
code, which is further translated into equivalent machine language code. The computer
finally executes machine language instructions being translated from C program. Hence
a C program is “a set of sequence of commands being sent to microprocessor for
execution.”
Programming is not only writing instructions to the computer but it is instructions in the
right sequence to form a required logic (i.e., to sum a and b etc.).
Integrated Development Environment for C:
An IDE, or Integrated Development Environment, enables programmers to consolidate
the different aspects of writing a computer program. IDEs increase programmer
productivity by combining common activities of writing software into a single
application: editing source code, building executables, and debugging.
Compilation of a C program converts C code to machine language instructions. There
are many softwares available for compiling and running C programs. Some famous
IDEs are Microsoft Visual Studio, Visual C++ and Eclipse etc. Online compilers can
also be explored. In this chapter, we will only learn to use Microsoft Visual Studio.
88
Chapter 4
4.2 Different Types of Computer Languages:
Below are the top 3 types of computer language:
1. Machine Language:
The machine language is sometimes referred to as machine code or object code which
is a set of binary digits: 0 and 1. These binary digits are understood and read by a
computer system and it interprets it easily. It is considered a native language as it can
be directly understood by a central processing unit (CPU). The machine language is not
so easy to understand, as the language uses the binary system in which the commands
are written in 1 and 0 form which is not easy to interpret. There is only one language
which is understood by computer language which is machine language. The operating
system of the computer system is used to identify the exact machine language used for
that particular system.
The operating system defines how the program should be written so that it can be
converted to machine language and the system takes appropriate action. The computer
programs and scripts can also be written in other programming languages like C, C++,
and JAVA. However, these languages cannot be directly understood by a computer
system so there is a need for a program that can convert these computer programs to
machine language. The compiler is used to convert the programs to machine language
which can be easily understood by computer systems. The compiler generates the binary
file and executable file.
Example of machine language for the text “Hello World”.
01001000 0110101 01101100 01101100 01101111 00100000 01010111 01101111
01110010 01101100 01100100.
2. Assembly Language:
The assembly language is considered a low-level language for microprocessors and
many other programmable devices. The assembly language is also considered as
second-generation language. The first-generation language is machine language. The
assembly language is mostly famous for writing an operating system and also in writing
different desktop applications. The operations carried out by programmers using
assembly language are memory management, registry access, and clock cycle
89
Chapter 4
operations. The drawback of assembly language is that the code cannot be reused and
the language is not so easy to understand. The assembly language is considered a group
of other languages. It is used to implement the symbolic representation of machine code
which is used to program CPU architecture. The other name of assembly language is
assembly code. For any processor, the most used programming language is assembly
language.
In assembly language, the programmer does the operation which can be directly
executed on a central processing unit (CPU). The language has certain drawbacks as it
does not contain any variables or functions in programs and also the program is not
portable on different processors. The assembly language uses the same structure and
commands which machine language does use but it uses names in place of numbers.
The operations performed using the assembly language is very fast. The operations are
much faster when it is compared to high-level language.
Activity
➢ Find sum command for different microcontrollers from their datasheets.
Do you know
➢ Every microprocessor has its own assembly language instructions.
3. High-Level Languages:
The code written in low-level language for one machine cannot be transferred to other
machines. Thus, it led to the development of high-level language. The high-level
language is easy to understand as the programs written are user-friendly. The other
advantage of code written in a high-level language is that the code is independent of a
computer system which means the code can be transferred to other machines. The high-
level of language uses the concept of abstraction and also focus on programming
language rather than focusing on computer hardware components like register
utilization or memory utilization.
90
Chapter 4
Higher-level languages were created to write a human-readable program that can be
easily understood by any user. The only requirement in a high-level language is the need
of compiler. The program written in a high-level language is not directly understood by
the computer. It needs to be converted to machine level language before the execution
of high-level programs,. The examples of high-level language are C++, C, JAVA,
FORTRAN and Python etc.
When you are programming to control the behavior of hardware components, then low
level programming languages are used. For Instance, C is used to interface sensors with
microcontrollers. Whereas, Python is used for Artificial Intelligence.
91
Chapter 4
A compiler is processor-dependent and platform-dependent. This dependence has been
addressed by a special compiler, a cross-compiler (which compiles a program for
another different microprocessor) and a source-to-source compiler. Before choosing a
compiler, user has to identify first the Instruction Set Architecture (ISA), the operating
system (OS) and the programming language that will be used to ensure that it will be
compatible.
Interpreter:
Just like a compiler, interpreter is a translator used to convert high-level programming
language to low-level programming language. It converts the program one at a time
and reports errors detected at once, while doing the conversion. With this, it is easier
to detect errors than in a compiler. An interpreter is faster than a compiler as it
immediately executes the code upon reading the code.
It is often used as a debugging tool for software development as it can execute a single
line of code at a time. An interpreter is also more portable than a compiler as it is not
processor-dependent, you can work between hardware architectures.
Assembler:
An assembler is a translator used to translate assembly language to machine
language. It is like a compiler for the assembly language but interactive like an
interpreter. Assembly language is difficult to understand as it is a low-level
programming language. An assembler translates a low-level language, an assembly
language to an even lower-level language, which is the machine code. The machine
code can be directly understood by the CPU.
• Problem Definition
92
Chapter 4
• Problem Analysis
• Algorithm Development
• Coding & Documentation
• Testing & Debugging
• Maintenance
93
Chapter 4
2. Problem Analysis:
In phase 2, we determine the requirements like variables, functions, etc. to solve the
problem. That means we gather the required resources to solve the problem defined in
the problem definition phase. We also determine the bounds of the solution.
3. Algorithm Development:
During this phase, we develop a step-by-step procedure to solve the problem using the
specification given in the previous phase. This phase is very important for program
development.
4. Coding & Documentation:
This phase uses a programming language to write or implement the actual programming
instructions for the steps defined in the previous phase. In this phase, we construct the
actual program. That means we write the program to solve the given problem using
programming languages like C, C++, Java, etc.,
5. Testing & Debugging
During this phase, we check whether the code written in the previous step is solving the
specified problem or not. We also test whether it is providing the desired output or not.
6. Maintenance
During this phase, the program is actively used by the users. If the user encounters any
problem or wants any enhancement, then we need to repeat all the phases from the
starting, so that the encountered problem is solved or enhancement is added.
94
Chapter 4
Process
A box indicates some particular operation.
95
Chapter 4
Document
This represents a printout, such as a document or a report.
Decision
A diamond represents a decision or branching point. Lines coming out from the
diamond indicates different possible situations, leading to different sub-processes.
Data
It represents information entering or leaving the system. An input might be an order
from a customer. Output can be a product to be delivered.
On-Page Reference
This symbol would contain a letter inside. It indicates that the flow continues on a
matching symbol containing the same letter somewhere else on the same page.
Off-Page Reference
This symbol would contain a letter inside. It indicates that the flow continues on a
matching symbol containing the same letter somewhere else on a different page.
96
Chapter 4
Delay
Identifies a delay.
Flow
Lines represent the flow of the sequence and direction of a process.
Benefits of Flowcharts:
Using a flowchart has a variety of benefits:
• It helps to clarify complex processes.
• It identifies steps that do not add value to the internal or external customer,
including delays; needless storage and transportation; unnecessary work,
duplication, and added expense; breakdowns in communication.
• It helps team members gain a shared understanding of the process and use this
knowledge to collect data, identify problems, focus discussions, and identify
resources.
• It serves as a basis for designing new processes.
97
Chapter 4
End
Simple Algorithms
A flowchart can also be used in visualizing algorithms, regardless of its complexity.
Here is an example (Figure 4.4) that shows how flowchart can be used in showing a
simple summation process.
98
Chapter 4
99
Chapter 4
Teacher Notes:
➢ Give examples of recursive flow charts.
100
Chapter 4
Key Points
➢ The computer language is defined as code or syntax which is used to write
programs or any specific applications.
➢ The main unit of a computer is microprocessor. Each microprocessor is
designed to execute a certain set of instructions.
➢ Presence of voltage means a signal 1 and absence of voltage means signal 0.
So, a computer is only able to understand presence and absence of voltages.
➢ Computer only understands machine language also called binary language.
➢ Assemble language consists of some simple statements i.e., sum a, b.
➢ C language was implemented to write programs in mathematical language.
➢ Hence a C program is “a set of sequence of commands being sent to
microprocessor for execution.”
➢ An IDE, or Integrated Development Environment, enables programmers to
consolidate the different aspects of writing a computer program.
➢ There is a step wise debugger available in many IDEs which helps you to
troubleshoot your program.
➢ The other advantage of code written in a high-level language is the code is
independent of a computer system which means the code can be transferred to
other machines.
➢ A translator is a programming language processor that converts a computer
program from one language to another.
➢ An assembler is a translator used to translate assembly language to machine
language
101
Chapter 4
Multiple Choice Questions:
1. Assembly is a
a. High level language b. Low level language c. Machine Language d. Both
a and b
Short Questions:
1. What is programming?
2. What is the difference between high level and low level programming
languages?
3. Define program development cycle.
4. What is the difference between a debugger and a compiler.
Long Questions
1. Explain program translation steps?
2. What are flow chart and why are they used?
3. Differentiate between Interpreter and Compiler.
Flow Charts:
1. Draw a flow chart to solve quadratic equations.
102
Chapter 5
Chapter no. 5
Introduction to C
After Studying this chapter, you will be able to:
➢ understand structure and life cycle of C program.
➢ define integrated development environment (IDE).
➢ install C Compiler and IDE.
➢ develop a program of printing hello world in Programming language C/C++.
➢ understand input and output statements.
➢ understand of format specifier for printf and scanf statement.
➢ understand data types and variable.
➢ understand mathematical operators available in C.
➢ understand precedence of operators.
➢ implement arithmetic expression in C.
➢ describe and implement conditional statements and its types.
➢ understand nested decision statements.
➢ define concept of loop.
➢ understand handling control variables for a loop.
➢ understand breaking a loop.
➢ implement loops in a program in C.
➢ understand nested loop.
➢ describe functions and its types.
➢ understand return types and input parameters. 103
➢ describe data types of arrays and its declaration.
➢ understand “string”.
Chapter 5
5.1 C Programming
C is a general-purpose, procedural computer programming language supporting
structured programming, and recursion, with a static type system. C is the most widely
used computer language. It keeps fluctuating at number one scale of popularity along
with Java programming language and Python scripting.
Interesting Information:
104
Chapter 5
5.2 Structure of a C Program
Hello World Example:
A C program basically consists of the following parts:
• Preprocessor Commands
• Statements & Expressions
• Main Function
As an example, see the following program to print “Hello World”:
#include <stdio.h> // Preprocessor Commands
return 0;
}
105
Chapter 5
▪ Compilation - Using a Compiler program to convert C expanded source to
assembly source code.
▪ Loading - Using a Loader program to load the executable code into CPU for
execution.
106
Chapter 5
107
Chapter 5
108
Chapter 5
You can run your code line by line to find out the reason for errors rather than running
the code at once. Follow Figure 5.8 to perform step-wise debugging.
109
Chapter 5
char str[100];
int i;
return 0;
}
When the above code is compiled and executed, it waits for the user to input some text.
When the user enters a text and presses enter, then the program proceeds and reads the
input and displays it as follows:
Enter a value: seven 7
You entered: seven 7
Here, it should be noted that scanf() expects input in the same format as you provided
%s and %d, which means you have to provide valid inputs like "string integer". If you
provide "string string" or "integer integer", then it will be assumed as wrong input.
Secondly, while reading a string, scanf() stops reading as soon as it encounters a space,
so "this is test" are three strings for scanf().
Format Specifiers:
Format specifiers are used in C for input and output purposes. Using this concept, the
compiler can understand that what type of data is in a variable during taking input using
the scanf() function and printing using printf() function. Here is a list of format
specifiers.
%c Character
%d Signed integer
%f Float values
%i Unsigned integer
110
Chapter 5
Format Specifier Type
%lf Double
%o Octal representation
%p Pointer
%s String
%u Unsigned int
%x or %X Hexadecimal representation
These are the basic format specifiers. We can add some other parts with the format
specifiers:
• A minus symbol (-) sign tells left alignment
• A number after % specifies the minimum field width. If string is less than the
width, it will be filled with spaces
• A period (.) is used to separate field width and precision
Example:
#include <stdio.h>
int main() {
char ch = 'B';
printf("%d\n", x);
printf("%i\n", y);
111
Chapter 5
float f = 12.67;
int a = 67;
printf("%s\n", str);
Output
B
45
90
12.670000
1.267000e+001
103
43
Hello World
Hello World
Hello World
Hello
Hello
We can use these format specifiers for the scanf() function in the same manner.
112
Chapter 5
Integer Types:
The following table provides the details of standard integer types with their storage
sizes and value ranges:
To get the exact size of a type or a variable on a particular platform, you can use
the sizeof operator. The expressions sizeof(type) yields the storage size of the object or
type in bytes. Given below is an example to get the size of various type on a machine
using different constant defined in limits.h header file:
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <float.h>
113
Chapter 5
printf("SHRT_MAX : %d\n", SHRT_MAX);
printf("SHRT_MIN : %d\n", SHRT_MIN);
printf("UCHAR_MAX : %d\n", UCHAR_MAX);
printf("UINT_MAX : %u\n", (unsigned int) UINT_MAX);
printf("ULONG_MAX : %lu\n", (unsigned long) ULONG_MAX);
printf("USHRT_MAX : %d\n", (unsigned short) USHRT_MAX);
return 0;
}
When you compile and execute the above program, it produces the following result
(specifically for Linux):
CHAR_BIT : 8
CHAR_MAX : 127
CHAR_MIN : -128
INT_MAX : 2147483647
INT_MIN : -2147483648
LONG_MAX : 9223372036854775807
LONG_MIN : -9223372036854775808
SCHAR_MAX : 127
SCHAR_MIN : -128
SHRT_MAX : 32767
SHRT_MIN : -32768
UCHAR_MAX : 255
UINT_MAX : 4294967295
ULONG_MAX : 18446744073709551615
USHRT_MAX : 65535
Floating-Point Types:
The following table provides the details of standard floating-point types with storage
sizes and value ranges and their precision:
114
Chapter 5
return 0;
}
When you compile and execute the above program, it produces the following result on
Linux:
Storage size for float : 4
FLT_MAX : 3.40282e+38
FLT_MIN : 1.17549e-38
-FLT_MAX : -3.40282e+38
-FLT_MIN : -1.17549e-38
DBL_MAX : 1.79769e+308
DBL_MIN : 2.22507e-308
-DBL_MAX : -1.79769e+308
Precision value: 6
Void Type:
The void type specifies that no value is available. It is used in the following kinds of
situations:
115
Chapter 5
5.6 Arithmatic Operators in C
An operator is a symbol that tells the compiler to perform specific mathematical or
logical functions. C language is rich in built-in operators and provides the following
types of operators −
• Arithmetic Operators
• Relational Operators
• Logical Operators
• Bitwise Operators
• Assignment Operators
• Miscellaneous Operators
Arithmetic Operators:
The following table shows all the arithmetic operators supported by the C language.
Assume variable A holds 10 and variable B holds 20 then:
116
Chapter 5
Example
See the following example to understand all the arithmetic operators available in C:
#include <stdio.h>
main() {
int a = 21;
int b = 10;
int c ;
c = a + b;
printf("Line 1 - Value of c is %d\n", c );
c = a - b;
printf("Line 2 - Value of c is %d\n", c );
c = a * b;
printf("Line 3 - Value of c is %d\n", c );
c = a / b;
printf("Line 4 - Value of c is %d\n", c );
c = a % b;
printf("Line 5 - Value of c is %d\n", c );
c = a++;
printf("Line 6 - Value of c is %d\n", c );
c = a--;
printf("Line 7 - Value of c is %d\n", c );
}
When you compile and execute the above program, it produces the following result −
Line 1 - Value of c is 31
Line 2 - Value of c is 11
Line 3 - Value of c is 210
Line 4 - Value of c is 2
Line 5 - Value of c is 1
Line 6 - Value of c is 21
Line 7 - Value of c is 22
Relational Operators:
The following table shows all the relational operators supported by C. Assume
variable A holds 10 and variable B holds 20 then:
117
Chapter 5
== Checks if the values of two operands are equal or not. If yes, then (A == B)
the condition becomes true. is not
true.
!= Checks if the values of two operands are equal or not. If the values (A != B)
are not equal, then the condition becomes true. is true.
> Checks if the value of left operand is greater than the value of right (A > B)
operand. If yes, then the condition becomes true. is not
true.
< Checks if the value of left operand is less than the value of right (A < B)
operand. If yes, then the condition becomes true. is true.
>= Checks if the value of left operand is greater than or equal to the (A >= B)
value of right operand. If yes, then the condition becomes true. is not
true.
<= Checks if the value of left operand is less than or equal to the value (A <= B)
of right operand. If yes, then the condition becomes true. is true.
Example
See the following example to understand all the relational operators available in C:
#include <stdio.h>
main() {
int a = 21;
int b = 10;
int c ;
if( a == b ) {
printf("Line 1 - a is equal to b\n" );
} else {
printf("Line 1 - a is not equal to b\n" );
}
if ( a < b ) {
printf("Line 2 - a is less than b\n" );
} else {
printf("Line 2 - a is not less than b\n" );
}
if ( a > b ) {
printf("Line 3 - a is greater than b\n" );
} else {
printf("Line 3 - a is not greater than b\n" );
}
118
Chapter 5
a = 5;
b = 20;
if ( a <= b ) {
printf("Line 4 - a is either less than or equal to b\n" );
}
if ( b >= a ) {
printf("Line 5 - b is either greater than or equal to b\n"
);
}
}
When you compile and execute the above program, it produces the following
result:
Line 1 - a is not equal to b
Line 2 - a is not less than b
Line 3 - a is greater than b
Line 4 - a is either less than or equal to b
Line 5 - b is either greater than or equal to b
Logical Operators
The Following table shows all the logical operators supported by C language. Assume
variable A holds 1 and variable B holds 0, then:
&& Called Logical AND operator. If both the operands are non- (A && B) is
zero, then the condition becomes true. false.
! Called Logical NOT Operator. It is used to reverse the logical !(A && B) is
state of its operand. If a condition is true, then Logical NOT true.
operator will make it false.
Example
See the following example to understand all the logical operators available in C:
#include <stdio.h>
main() {
119
Chapter 5
int a = 5;
int b = 20;
int c ;
if ( a && b ) {
printf("Line 1 - Condition is true\n" );
}
if ( a || b ) {
printf("Line 2 - Condition is true\n" );
}
if ( a && b ) {
printf("Line 3 - Condition is true\n" );
} else {
printf("Line 3 - Condition is not true\n" );
}
if ( !(a && b) ) {
printf("Line 4 - Condition is true\n" );
}
When you compile and execute the above program, it produces the following result:
Line 1 - Condition is true
Line 2 - Condition is true
Line 3 - Condition is not true
Line 4 - Condition is true
Bitwise Operators
Bitwise operator works on bits and perform bit-by-bit operation. The truth tables for
&, |, and ^ is as follows:
0 0 0 0 0
0 1 0 1 1
1 1 1 1 0
1 0 0 1 1
120
Chapter 5
A = 0011 1100
B = 0000 1101
-----------------
A&B = 0000 1100
A|B = 0011 1101
A^B = 0011 0001
~A = 1100 0011
The following table lists the bitwise operators supported by C. Assume variable 'A'
holds 60 and variable 'B' holds 13, then:
& Binary AND Operator copies a bit to the result if it exists in both (A & B) = 12,
operands. i.e., 0000
1100
^ Binary XOR Operator copies the bit if it is set in one operand but (A ^ B) = 49,
not both. i.e., 0011
0001
~ Binary One's Complement Operator is unary and has the effect of (~A ) = ~(60),
'flipping' bits. i.e,. -0111101
<< Binary Left Shift Operator. The left operands value is moved left by A << 2 = 240
the number of bits specified by the right operand. i.e., 1111
0000
>> Binary Right Shift Operator. The left operands value is moved right A >> 2 = 15
by the number of bits specified by the right operand. i.e., 0000
1111
Example
See the following example to understand all the bitwise operators available in C:
#include <stdio.h>
121
Chapter 5
main() {
c = a | b; /* 61 = 0011 1101 */
printf("Line 2 - Value of c is %d\n", c );
c = a ^ b; /* 49 = 0011 0001 */
printf("Line 3 - Value of c is %d\n", c );
When you compile and execute the above program, it produces the following result:
Line 1 - Value of c is 12
Line 2 - Value of c is 61
Line 3 - Value of c is 49
Line 4 - Value of c is -61
Line 5 - Value of c is 240
Line 6 - Value of c is 15
Assignment Operators:
The following table lists the assignment operators supported by the C language:
122
Chapter 5
-= Subtract AND assignment operator. It subtracts the right operand C -= A is
from the left operand and assigns the result to the left operand. equivalent to C =
C-A
Example
Try the following example to understand all the assignment operators available in C:
#include <stdio.h>
main() {
int a = 21;
123
Chapter 5
int c ;
c = a;
printf("Line 1 - = Operator Example, Value of c = %d\n", c );
c += a;
printf("Line 2 - += Operator Example, Value of c = %d\n", c );
c -= a;
printf("Line 3 - -= Operator Example, Value of c = %d\n", c );
c *= a;
printf("Line 4 - *= Operator Example, Value of c = %d\n", c );
c /= a;
printf("Line 5 - /= Operator Example, Value of c = %d\n", c );
c = 200;
c %= a;
printf("Line 6 - %= Operator Example, Value of c = %d\n", c );
c <<= 2;
printf("Line 7 - <<= Operator Example, Value of c = %d\n", c
);
c >>= 2;
printf("Line 8 - >>= Operator Example, Value of c = %d\n", c
);
c &= 2;
printf("Line 9 - &= Operator Example, Value of c = %d\n", c );
c ^= 2;
printf("Line 10 - ^= Operator Example, Value of c = %d\n", c
);
c |= 2;
printf("Line 11 - |= Operator Example, Value of c = %d\n", c
);
}
When you compile and execute the above program, it produces the following result:
124
Chapter 5
Line 11 - |= Operator Example, Value of c = 2
Operators Precedence in C:
Operator precedence determines the grouping of terms in an expression and decides
how an expression is evaluated. Certain operators have higher precedence than others;
for example, the multiplication operator has a higher precedence than the addition
operator.
For example, x = 7 + 3 * 2; here, x is assigned 13, not 20 because operator * has a
higher precedence than +, so it first gets multiplied with 3*2 and then adds into 7.
Here, operators with the highest precedence appear at the top of the table, those with
the lowest appear at the bottom. Within an expression, higher precedence operators
will be evaluated first.
125
Chapter 5
Bitwise OR | Left to right
Example
Understand the following example to understand operator precedence in C:
#include <stdio.h>
main() {
int a = 20;
int b = 10;
int c = 15;
int d = 5;
int e;
e = (a + b) * c / d; // ( 30 * 15 ) / 5
printf("Value of (a + b) * c / d is : %d\n", e );
e = ((a + b) * c) / d; // (30 * 15 ) / 5
printf("Value of ((a + b) * c) / d is : %d\n" , e );
e = a + (b * c) / d; // 20 + (150/5)
printf("Value of a + (b * c) / d is : %d\n" , e );
return 0;
}
When you compile and execute the above program, it produces the following result:
Value of (a + b) * c / d is : 90
126
Chapter 5
Value of ((a + b) * c) / d is : 90
Value of (a + b) * (c / d) is : 90
Value of a + (b * c) / d is : 50
C programming language assumes any non-zero and non-null values as true, and if it
is either zero or null, then it is assumed as false value. C programming language
provides the following types of decision-making statements:
1 if statement
127
Chapter 5
An if statement consists of a boolean expression followed by one or more
statements.
2 if...else statement
An if statement can be followed by an optional else statement, which executes
when the Boolean expression is false.
3 nested if statements
You can use one if or else if statement inside another if or else if statement(s).
4 switch statement
A switch statement allows a variable to be tested for equality against a list of
values.
If-else Statement:
An if statement can be followed by an optional else statement, which executes when
the Boolean expression is false.
Syntax:
The syntax of an if...else statement in C programming language is:
if(boolean_expression) {
/* statement(s) will execute if the boolean expression is true
*/
} else {
/* statement(s) will execute if the boolean expression is
false */
}
If the Boolean expression evaluates to true, then the if block will be executed,
otherwise, the else block will be executed.
C programming language assumes any non-zero and non-null values as true, and if it
is either zero or null, then it is assumed as false value.
Example
128
Chapter 5
#include <stdio.h>
int main () {
return 0;
}
When the above code is compiled and executed, it produces the following result:
a is not less than 20;
value of a is : 100
Nested If Statements:
It is always legal in C programming to nest if-else statements, which means you can
use one if or else if statement inside another if or else if statement(s).
Syntax
The syntax for a nested if statement is as follows:
if( boolean_expression 1) {
Example
#include <stdio.h>
int main () {
129
Chapter 5
/* local variable definition */
int a = 100;
int b = 200;
return 0;
}
When the above code is compiled and executed, it produces the following result:
Value of a is 100 and b is 200
Exact value of a is : 100
Exact value of b is : 200
Switch Statements:
A switch statement allows a variable to be tested for equality against a list of values.
Each value is called a case, and the variable being switched on is checked for
each switch case.
Syntax
The syntax for a switch statement in C programming language is as follows:
switch(expression) {
case constant-expression :
statement(s);
break; /* optional */
case constant-expression :
statement(s);
break; /* optional */
130
Chapter 5
The following rules apply to a switch statement:
• You can have any number of case statements within a switch. Each case is
followed by the value to be compared to and a colon.
• The constant-expression for a case must be the same data type as the variable
in the switch, and it must be a constant or a literal.
• When the variable being switched on is equal to a case, the statements following
that case will execute until a break statement is reached.
• When a break statement is reached, the switch terminates, and the flow of
control jumps to the next line following the switch statement.
• Not every case needs to contain a break. If no break appears, the flow of
control will fall through to subsequent cases until a break is reached.
• A switch statement can have an optional default case, which must appear at the
end of the switch. The default case can be used for performing a task when none
of the cases is true. No break is needed in the default case.
Example
#include <stdio.h>
int main () {
switch(grade) {
case 'A' :
printf("Excellent!\n" );
break;
case 'B' :
case 'C' :
printf("Well done\n" );
break;
case 'D' :
131
Chapter 5
printf("You passed\n" );
break;
case 'F' :
printf("Better try again\n" );
break;
default :
printf("Invalid grade\n" );
}
return 0;
}
When the above code is compiled and executed, it produces the following result:
Well done
Your grade is B
5.8 Loops in C
Loops are used when a block of code needs to be executed several times. In general,
statements are executed sequentially: The first statement in a function is executed first,
followed by the second, and so on. Programming languages provide various control
structures that allow for more complicated execution paths.
C programming language provides the following types of loops to handle looping
requirements.
while loop
Repeats a statement or group of statements while a given condition is true. It tests the condition
before executing the loop body.
for loop
Executes a sequence of statements multiple times and abbreviates the code that manages the loop
variable.
do...while loop
It is more like a while statement, except that it tests the condition at the end of the loop body.
nested loops
132
Chapter 5
You can use one or more loops inside any other while, for, or do..while loop.
While Loop:
A while loop in C programming repeatedly executes a target statement as long as a
given condition is true.
Syntax
The syntax of a while loop in C programming language is:
while(condition) {
statement(s);
}
Here, statement(s) may be a single statement or a block of statements.
The condition may be any expression, and true is any nonzero value. The loop iterates
while the condition is true.
When the condition becomes false, the program control passes to the line immediately
following the loop.
Example
#include <stdio.h>
int main () {
return 0;
}
When the above code is compiled and executed, it produces the following result:
value of a: 10
value of a: 11
value of a: 12
value of a: 13
value of a: 14
value of a: 15
value of a: 16
value of a: 17
value of a: 18
133
Chapter 5
value of a: 19
For Loop:
A for loop is a repetition control structure that allows you to efficiently write a loop
that needs to execute a specific number of times.
Syntax
The syntax of a for loop in C programming language is:
for ( init; condition; increment ) {
statement(s);
}
Below is the flow of control in a 'for' loop −
• The init step is executed first, and only once. This step allows you to declare
and initialize any loop control variables. You are not required to put a statement
here, as long as a semicolon appears.
• Next, the condition is evaluated. If it is true, the body of the loop is executed. If
it is false, the body of the loop does not execute and the flow of control jumps
to the next statement just after the 'for' loop.
• After the body of the 'for' loop executes, the flow of control jumps back up to
the increment statement. This statement allows you to update any loop control
variables. This statement can be left blank, as long as a semicolon appears after
the condition.
• The condition is now evaluated again. If it is true, the loop executes and the
process repeats itself (body of loop, then increment step, and then again
condition). After the condition becomes false, the 'for' loop terminates.
Example
#include <stdio.h>
int main () {
int a;
134
Chapter 5
printf("value of a: %d\n", a);
}
return 0;
}
When the above code is compiled and executed, it produces the following result:
value of a: 10
value of a: 11
value of a: 12
value of a: 13
value of a: 14
value of a: 15
value of a: 16
value of a: 17
value of a: 18
value of a: 19
break statement
Terminates the loop or switch statement and transfers execution to the statement
immediately following the loop or switch.
continue statement
Causes the loop to skip the remainder of its body and immediately retest its condition prior
to reiterating.
goto statement
135
Chapter 5
• It can be used to terminate a case in the switch statement (covered in the next
chapter).
If you are using nested loops, the break statement will stop the execution of the
innermost loop and start executing the next line of code after the block.
Syntax
The syntax for a break statement in C is as follows:
break;
5.9 Functions in C
A function is a group of statements that together perform a task. Every C program has
at least one function, which is main(), and all the most trivial programs can define
additional functions. You can divide up your code into separate functions. How you
divide up your code among different functions is up to you, but logically the division
is such that each function performs a specific task.
A function declaration tells the compiler about a function's name, return type, and
parameters. A function definition provides the actual body of the function.
The C standard library provides numerous built-in functions that your program can
call. For example, strcat() to concatenate two strings, memcpy() to copy one memory
location to another location, and many more functions.
A function can also be referred as a method or a sub-routine or a procedure, etc.
Defining a Function
The general form of a function definition in C programming language is as follows:
return_type function_name( parameter list ) {
body of the function
}
The following are the parts of a function −
• Return Type − A function may return a value. The return_type is the data type
of the value the function returns. Some functions perform the desired operations
without returning a value. In this case, the return_type is the keyword void.
• Function Name − This is the actual name of the function. The function name
and the parameter list together constitute the function signature.
136
Chapter 5
• Parameters − A parameter is like a placeholder. When a function is invoked,
you pass a value to the parameter. This value is referred to as actual parameter
or argument. The parameter list refers to the type, order, and number of the
parameters of a function. Parameters are optional; that is, a function may contain
no parameters.
• Function Body − The function body contains a collection of statements that
define what the function does.
Example
Given below is the source code for a function called max(). This function takes two
parameters num1 and num2 and returns the maximum value between the two.
/* function returning the max between two numbers */
int max(int num1, int num2) {
return result;
}
Function Declarations
A function declaration tells the compiler about a function name and how to call the
function. The actual body of the function can be defined separately. A function
declaration has the following parts:
return_type function_name( parameter list );
For the above defined function max(), the function declaration is as follows −
int max(int num1, int num2);
Parameter names are not important in function declaration only their type is required,
so the following is also a valid declaration:
int max(int, int);
Function declaration is required when you define a function in one source file and you
call that function in another file. In such case, you should declare the function at the
top of the file calling the function.
137
Chapter 5
Calling a Function
To use a function, you will have to call that function to perform the defined task. When
a program calls a function, the program control is transferred to the called function. A
called function performs a defined task and when its return statement is executed or
when its function-ending closing brace is reached, it returns the program control back
to the main program.
To call a function, you simply need to pass the required parameters along with the
function name, and if the function returns a value, then you can store the returned value.
For example:
#include <stdio.h>
/* function declaration */
int max(int num1, int num2);
int main () {
return 0;
}
return result;
}
138
Chapter 5
We have kept max() along with main() and compiled the source code. While running
the final executable, it would produce the following result:
Max value is : 200
5.10 Arrays in C:
Arrays a kind of data structure that can store a fixed-size sequential collection of
elements of the same type. An array is used to store a collection of data, but it is often
more useful to think of an array as a collection of variables of the same type. Instead
of declaring individual variables, such as number0, number1, ..., and number99, you
declare one array variable such as numbers and use numbers[0], numbers[1], and ...,
numbers[99] to represent individual variables. A specific element in an array is
accessed by an index.
All arrays consist of contiguous memory locations. The lowest address corresponds to
the first element and the highest address to the last element.
Declaring Arrays
To declare an array in C, a programmer specifies the type of the elements and the
number of elements required by an array as follows:
type arrayName [ arraySize ];
This is called a single-dimensional array. The arraySize must be an integer constant
greater than zero and type can be any valid C data type. For example, to declare a 10-
element array called balance of type double, use this statement:
double balance[10];
Here balance is a variable array which is sufficient to hold up to 10 double numbers.
Initializing Arrays
You can initialize an array in C either one by one or using a single statement as follows:
double balance[5] = {1000.0, 2.0, 3.4, 7.0, 50.0};
The number of values between braces { } cannot be larger than the number of elements
that we declare for the array between square brackets [ ].
139
Chapter 5
If you omit the size of the array, an array just big enough to hold the initialization is
created. Therefore, if you write:
double balance[] = {1000.0, 2.0, 3.4, 7.0, 50.0};
You will create exactly the same array as you did in the previous example. Following
is an example to assign a single element of the array:
balance[4] = 50.0;
The above statement assigns the 5th element in the array with a value of 50.0. All arrays
have 0 as the index of their first element which is also called the base index and the
last index of an array will be total size of the array minus 1. Shown below is the
pictorial representation of the array we discussed above:
int main () {
return 0;
140
Chapter 5
}
When the above code is compiled and executed, it produces the following result:
Element[0] = 100
Element[1] = 101
Element[2] = 102
Element[3] = 103
Element[4] = 104
Element[5] = 105
Element[6] = 106
Element[7] = 107
Element[8] = 108
Element[9] = 109
5.11 Strings in C
Strings are actually one-dimensional array of characters terminated by a null character
'\0'. Thus, a null-terminated string contains the characters that comprise the string
followed by a null.
The following declaration and initialization create a string consisting of the word
"Hello". To hold the null character at the end of the array, the size of the character
array containing the string is one more than the number of characters in the word
"Hello."
char greeting[6] = {'H', 'e', 'l', 'l', 'o', '\0'};
If you follow the rule of array initialization then you can write the above statement as
follows:
char greeting[] = "Hello";
There is no need to place the null character at the end of a string constant. The C
compiler automatically places the '\0' at the end of the string when it initializes the
array. Let us try to print the above mentioned string:
#include <stdio.h>
int main () {
Teacher Notes:
141
➢ Inbuilt string handling functions can also be taught i.e., strcpy and strtok etc.
Chapter 5
Exercise
Multiple Choice Questions:
1. Which of the following characters are used to comment in C.
a. \\ b. /* */ c. % d. Both a and b
Practical Questions:
1. Write a program to take input of name, rollno and marks obtained by a student
in 5 subjects. Each subject have 100 full marks. Display the name, roll no with
percentage score secured.
2. Write a program to add two numbers (5&7) and display its sum.
3. Write a program to input marks of 5 subjects (Physics, Chemistry, Math, English
& Biology) for a student. Display the rank of each subjects and also the result of
total marks and percentage obtained with his/her rank in the class. The rank is
categorized as fail (marks < 40%), pass & third division (marks between 40 to
55%), second (marks between 55 to 65%), first (marks between 65 to 80%),
142
Chapter 5
Distinction (marks between 80 to 95%), extra ordinary (marks above 95 to
100%).
4. Write a program to input two integer numbers and display the sum of even
numbers between these two input numbers.
5. Write a program to add, subtract, multiply and divide two integers using user
defined type function with return type.
6. Write a program to find separately the sum of the positive and negative integer
elements of an array of size 10. Define a function called sortarray(int[]), pass the
array to this function and display the array elements into ascending order.
7. Write a program to read a sentence and count the number of characters & words
in that sentence.
143
Chapter 6
Chapter no. 6
Computer Security
After Studying this chapter, you will be able to:
➢ differentiate computer security and cyber security.
➢ understand information system and information system assets.
➢ understand threats to information system assets.
➢ describe attack vector, understand malware and its type.
➢ understand the basic of: confidentiality, integrity, authentication, availability, and accountability.
➢ understand basic techniques used for confidentiality, integrity and availability.
➢ understand protection and various tools to protect information system from intruders and hacker.
➢ download and install anti malware software online and from DVD/CD.
➢ update anti malware database/repository and perform complete malware scan on any system.
➢ delete / quarantine all the malware successfully which are detected as a result of scan.
➢ know well-known firewalls and knowledge of: users account, privileges setting, IP, zones etc.
➢ describe process of configuring a firewall for: deletion of default account, renaming an account.
➢ ensuring password protection and applying privileges setting.
➢ setting inbound and outbound setting and its importance, access control list.
➢ knowledge of logging services in firewall, reports and logs and explain its importance.
➢ know about encryption and decryption, encryption tools used in windows.
➢ perform encryption of drive data using encryption tool.
➢ understand backup and restore and know importance of schedule backup.
➢ describe tools used in windows for backup and restore.
➢ perform backup a data and perform restoring a data.
144
Chapter 6
6.1 Computer Security and Cyber Security
Computer security means dealing with the security of a computer’s software and
hardware. One of the most important aspects of computer security is keeping stand-
alone machines updated and properly patched.
Cyber security, on the other hand, involves the security of individual computers plus
the network they belong to and the intercommunication between all the computers in an
organization. It can be easy to remember the difference by knowing that the meaning of
the word ‘cyber’ is a ‘culture of computers.’ It encompasses everything that is
connected.
Common Security Threats
There is always an ever-evolving list of security threats and dangers. Some of the most
common cyber threats are:
Viruses are malicious programs that get loaded onto victims’ computers without their
knowledge or permission. Typically, they replicate and infect files and programs
installed on the computer.
Worms are software programs that will copy themselves from one computer to another,
automatically. They use up disk space and can quickly replicate with larger volumes
and speed.
Keylogger or a keystroke logger tracks the real-time activity of someone using their
computer. It records every keystroke made on a keyboard and is a powerful threat as it
can steal individuals’ usernames, passwords and login credentials.
Botnet are when a group of computers connected online have all been compromised by
a hacker using a virus. The victims’ computers are typically then used for malicious
activities and bigger attacks such as denial-of-service attacks.
Phishing is when criminal disguises themselves as a business or individual to steal
sensitive data or personal information, typically via fraudulent emails and malicious
links. Phishing is so dangerous because it is easy to execute and hackers are getting
more sophisticated at making their emails look legitimate.
145
Chapter 6
6.2 Information Systems
Information systems incorporate computers to help manage data and achieve business
objectives, they do not necessarily have to include computers. There are different types
of information systems that can serve a variety of purposes depending on an
organization’s needs. Examples include:
• Data warehouses: Data warehouses are data management systems that support
analytics and other business intelligence activities. They consolidate and analyze
data from a large variety of sources. Data warehouses can provide insight into
businesses to help improve decision-making.
• Enterprise systems: Enterprise systems, also known as enterprise resource
planning (ERP) systems, are integrated systems that combine all the hardware
and software a business uses for different functions in its operations. These
organization-wide systems help information flow between departments and
allow processes from different parts of the business to be integrated across a
company.
• Expert systems: Expert systems use artificial intelligence to mimic human
decision-making. The software uses human knowledge to solve problems that
would typically require a person’s expertise. Expert systems can be applied in
areas such as medical diagnoses, accounting and coding.
• Geographic information systems: Geographic information systems (GIS) are
tools that gather, organize, map and analyze data with a spatial component. GIS
can improve analysis and decision-making by allowing users to visualize data on
a map. Global information systems are a type of GIS that synthesize worldwide
data.
• Office automation systems: Office automation systems combine
communication technology, people and computers to help perform office
activities, such as preparing written communication, printing, scheduling or
creating reports.
146
Chapter 6
6.2.1 Components of Information Systems
Every information system includes several key components: hardware, software,
telecommunications, people and data.
• Hardware refers to the physical pieces of the information system
• Software is the programming that controls the information system
• Telecommunication transmits information through the system
• Humans manage and interact with the information system
• Data is information stored within and processed by the system.
Hardware
The hardware component of an information system comprises the physical elements of
the system. People can touch and feel pieces of hardware. These mechanisms,
equipment and wiring allow systems like computers, smartphones and tablets to
function.
Input and output devices are essential pieces of technology that allow humans to interact
with computers and other information systems. Keyboards, mice, microphones and
scanners are all examples of input devices.
Output devices might include printers, monitors, speakers and sound and video cards.
Pieces of hardware including microprocessors, hard drives, electric power supply units,
and removable storage also allow computers to store and process data.
Software
Software are the intangible programs that manage information system functions,
including input, output, processing and storage. System software – such as the MacOS
or Microsoft Windows operating systems – provides a base for application software to
run. Application software operates programs for particular uses in information systems.
For instance, word processing applications are used to create and edit text
documents. Graphical user interface (GUI) software is among the most common
application software. It presents the information stored in computers and allows users
to interact with computers through digital graphics – such as icons, buttons and scroll
bars – rather than through text-based commands.
147
Chapter 6
Software can be either open source or closed source. Open-source software coding is
publicly available for users and programmers to manipulate, whereas closed source
software is proprietary.
Telecommunications
Telecommunications systems connect computer networks and allow information to be
transmitted through them. Telecommunications networks also allow computers and
storage services to access information from the cloud.
There are a number of methods telecommunications networks use to convey
information. Coaxial cables and fiber optic cables are used by telephone, internet and
cable providers to transmit data, video and audio messages.
Local-area networks (LANs) connect computers to create computer networks in a
designated space, like a school or home. Wide-area networks (WANs) are collections
of LANs that facilitate data-sharing across large areas. A virtual private network (VPN)
allows a user to protect their online privacy by encrypting data on public
networks. Microwaves and radio waves can also be used to transmit information in
telecommunications networks.
Data
Data are intangible, raw facts that are stored, transmitted, analysed and processed by
other components of information systems. Data are often stored as numerical facts, and
they represent quantitative or qualitative information. Data can be stored in a database
or data warehouse, in a form that best suits the organization using it.
Databases contain collections of data that can be queried or retrieved for specific
purposes. Databases allow users to perform fundamental operations, such as storage and
retrieval. Data warehouses, on the other hand, store data from multiple sources for
analytical purposes. They allow users to assess an organization or its operations.
Human Resources
Human resources are a crucial part of information systems. The human component of
information systems encompasses the qualified people who influence and manipulate
the data in information systems. Humans involved in information systems may
include business analysts, information security analysts or system analysts. Business
analysts work to elevate an organization’s operations and processes. They often focus
148
Chapter 6
on improving efficiency and productivity or streamlining distribution. Information
security analysts work to prevent data breaches and cybersecurity attacks.
149
Chapter 6
Reputation Damage
Losses associated with an external actor's perception of your organization whereby its
main value proposition is diminished.
Do you know
➢ In common language, the word hacker is mostly used instead of cracker. In
this book, the word hacker is used throughout instead of cracker. While,
Section 6.5 describes their differences.
150
Chapter 6
networks or applications that potentially exposes you to threats. When a threat targets
a vulnerability that exists in your IT infrastructure, network or applications, it can
result in risk to your assets, data or business.
Risk: An organization’s risk profile fluctuates depending on internal and external
environmental factors. It incorporates not just the potential or probability of a negative
event, but the impact that event may have on your infrastructure. And though risk can
never be 100% eliminated—cybersecurity is a persistently moving target, after all—
it can be managed to a level that satisfies your organization’s tolerance for risk.
Threat: Today’s cybersecurity landscape roils with an endless stream of potential
threats—from malware that plants dangerous executables in your software and
ransomware that locks up your systems to specially targeted hacker attacks. All of
these threats look for a way in, a vulnerability in your environment that they can
exploit. Some threats, however, hold more potential for exploitation than others.
Vulnerability: Vulnerabilities are weak spots within your environment and your
assets—weaknesses that open you up to potential threats and increased risk. And
unfortunately, an organization can have thousands, often millions of vulnerabilities.
151
Chapter 6
A failure to maintain confidentiality means that someone who shouldn’t have access
has managed to get access to private information. Through intentional behaviour or by
accident. A failure in confidentiality can cause some serious devastation.
Some information security basics to keep your data confidential are:
1. Encryption
2. Password
3. Two-factor authentication
4. Biometric verification
Integrity
Integrity refers to the accuracy and completeness of data. Security controls focused on
integrity are designed to prevent data from being modified or misused by an
unauthorized party. Integrity involves maintaining the consistency and trustworthiness
of data over its entire life cycle. Data must not be changed in transit, and precautionary
steps must be taken to ensure that data cannot be altered by unauthorized people. For
example, in a data breach that compromises integrity, a hacker may seize data and
modify it before sending it on to the intended recipient. Some security controls designed
to maintain the integrity of information include:
1. Encryption
2. User access controls
3. Version control
4. Backup and recovery procedures
5. Error detection software
Availability
Data availability means that information is accessible to authorized users. It provides
an assurance that your system and data can be accessed by authenticated users whenever
they’re needed. Similar to confidentiality and integrity, availability also holds great
value.
152
Chapter 6
Availability is typically associated with reliability and system uptime, which can be
impacted by non-malicious issues like hardware failures, unscheduled software
downtime, and human error, or malicious issues like cyberattacks and insider threats. If
the network goes down unexpectedly, users will not be able to access essential data and
applications.
Making regular off-site backups can limit the damage caused to hard drives by natural
disasters or server failure. Information only has value if the right people can access it at
the right time. Information security measures for mitigating threats to data availability
include:
1. Off-site backups
2. Disaster recovery
3. Redundancy
4. Failover
5. Proper monitoring
6. Environmental controls
7. Virtualization
8. Server clustering
Authentication:
Authentication is the process of identifying users that request access to a system,
network, or device. Access control determines user identity according to credentials like
username and password. Other authentication technologies like biometrics and
authentication apps are also used to authenticate user identity.
Non-repudiation:
Non-repudiation is the assurance that someone cannot deny the validity of something.
Non-repudiation is a legal concept that is widely used in information security and refers
to a service, which provides proof of the origin of data and the integrity of the data.
Digital signatures (combined with other measures) can offer non-repudiation when it
comes to online transactions, where it is crucial to ensure that a party to a contract or a
communication can't deny the authenticity of their signature on a document or sending
the communication in the first place. In this context, non-repudiation refers to the ability
153
Chapter 6
to ensure that a party to a contract or a communication must accept the authenticity of
their signature on a document or the sending of a message.
Accountability:
Accountability is an essential part of an information security plan. The phrase means
that every individual who works with an information system should have specific
responsibilities for information assurance. One example would be a policy statement
that all employees must avoid installing outside software on a company-owned
information infrastructure.
154
Chapter 6
3. Keep Your Computer Updated: Ensure every software within your computer
is properly patched up and up-to-date. This includes the operating system and
the other third-party software which might be a part of it. Because most of the
security threats exploit your system’s security vulnerabilities and keeping your
system up-to-date can eliminate such threats.
4. Use Complex Passwords: Another aspect which is very important but quite
often ignored are strong and unguessable passwords. Each password you possess
(not just your system password) to various accounts you might be having pose a
serious threat to your PC and your digital identity.
5. Follow Security Best Practices: Finally, follow the security best practices like
not clicking on suspicious mails, not downloading suspicious attachments, not
visiting dangerous websites etc., to keep your computer and digital identity safe.
155
Chapter 6
3. Does your software run accurately and efficiently?
4. Is your antivirus software easy to use?
6.7.2 Installing an antivirus program on a computer
To install an antivirus program on your computer, follow the steps below.
1. If you purchased the antivirus program from a retail store, insert
the CD or DVD into the computer's disc drive. The installation process should
start automatically, with a window opening to help guide you through the install
process.
2. If you downloaded the antivirus program on the Internet, find the downloaded
file on your computer. If the downloaded file is a zip file, unzip the file to extract
and access the installation files. Look for a file named setup.exe, install.exe, or
something similar, then double-click that file. The installation process should
start, with a window opening to help guide you through the install process.
3. In the installation process window, follow the steps provided to install the
antivirus program. The install process provides recommended options so the
antivirus program will function properly, which in most cases can be accepted as
is.
4. When the install process is complete, close the install window.
The antivirus program is now installed and ready to use. It is recommended to
restart your computer so that any modified settings in the operating system can take
effect correctly.
Updating the antivirus Program:
Without the latest definitions, the antivirus program will not know about the most
recently created viruses and spyware, making your computer vulnerable to an infection.
After installing the antivirus program, we highly recommend you update it with the
latest virus and spyware definitions. The updates allow the antivirus program to protect
your computer from all viruses and spyware. In many cases, the antivirus program
automatically checks for and installs the latest updates. If prompted to do so, select Yes
to update the antivirus program. If it does not prompt you to update immediately.
156
Chapter 6
Performing a Scan:
Correctly setting up and running an antivirus scan on your computer is one of the best
starting defences for keeping your system free of malicious software. A strong defence
begins with selecting an antivirus solution for your computer and understanding how to
get the most out of it. Learning to properly use a virus scan will keep you much safer:
without regular full scans, your system may be hiding some unpleasant surprises.
Virus scans search through your system to locate and remove any malicious threats on
your device. You’ll find most antivirus software guards against malware.
Follow these steps to run your first scan:
1. Verify that all security updates are downloaded. Updates will include all
heuristic virus definitions and other data needed to scan properly.
2. Execute a full virus scan. This will scan hard drives, removable media, system
memory, email and the like for viruses.
3. Clean your backups first by executing a virus scan before restoring any data.
4. Read any result reports for further action. Malware will usually be
quarantined to await action from you. You’ll have to decide what to do with the
potential threat. Most antivirus apps give you a recommended action to simplify
the decision for you.
5. Follow prompts to remove or keep potential threats. You’ll want to remove
most quarantined files usually. On occasion, you may find a clean file that has
been miscategorized and given you a false positive. High-quality antivirus
software should rarely label clean files as threats, so be sure you do your research
on detection rates.
Teacher Notes:
➢ Perform an antivirus scan in class and discuss the results with students.
157
Chapter 6
6.8 Firewalls
A firewall is a network security device that monitors incoming and outgoing network
traffic and decides whether to allow or block specific traffic based on a defined set of
security rules. It establishs a barrier between secured and controlled internal networks
that can be trusted and untrusted outside networks, such as the Internet. A firewall can
be hardware, software, or both.
158
Chapter 6
• Palo Alto
• SonicWall
• GlassWire Firewall
• Cisco
Configuring a Firewall:
Step 1: Secure your firewall
If an attacker is able to gain administrative access to your firewall it is “game over” for
your network security. Therefore, securing your firewall is the first and most important
step of this process. Never put a firewall into production that is not properly secured by
at least the following configuration actions:
Update your firewall to the latest firmware.
• Delete, disable, or rename any default user accounts and change all default
passwords. Make sure to use only complex and secure passwords.
• If multiple administrators will manage the firewall, create additional
administrator accounts with limited privileges based on responsibilities. Never
use shared user accounts.
• Disable simple network management protocol (SNMP) or configure it to use a
secure community string.
Step 2: Architect your firewall zones and IP addresses
In order to protect the valuable assets on your network, you should first identify what
the assets (for example, payment card data or patient data) are. Then plan out your
network structure so that these assets can be grouped together and placed into networks
(or zones) based on similar sensitivity level and function. For example, all of your
servers that provide services over the internet (web servers, email servers, virtual private
network (VPN) servers, etc.) should be placed into a dedicated zone that will allow
limited inbound traffic from the internet (this zone is often called a demilitarized zone
or DMZ). Servers that should not be accessed directly from the internet, such as
database servers, must be placed in internal server zones instead. Likewise,
workstations, point of sale devices, and voice over Internet protocol (VOIP) systems
can usually be placed in internal network zones. Generally speaking, the more zones
you create, the more secure your network. But keep in mind that managing more zones
159
Chapter 6
requires additional time and resources, so you need to be careful when deciding how
many network zones you want to use.
Step 3: Configure access control lists
Now that you have established your network zones and assigned them to interfaces, you
should determine exactly which traffic needs to be able to flow into and out of each
zone.
This traffic will be permitted using firewall rules called access control lists (ACLs),
which are applied to each interface or sub interface on the firewall. Make your ACLs
specific to the exact source and/or destination IP addresses and port numbers whenever
possible. At the end of every access control list, make sure there is a “deny all” rule to
filter out all unapproved traffic. Apply both inbound and outbound ACLs to each
interface and sub interface on your firewall so that only approved traffic is allowed into
and out of each zone.
Step 4: Configure your other firewall services and logging
If your firewall is also capable of acting as a dynamic host configuration protocol
(DHCP) server, network time protocol (NTP) server, intrusion prevention system (IPS),
etc., then go ahead and configure the services you wish to use. Disable all the extra
services that you don’t intend to use. Configure your firewall to report to your logging
server, and make sure that enough details are included.
Step 5: Test your firewall configuration
In a test environment, verify that your firewall works as intended. Don’t forget to verify
that your firewall is blocking traffic that should be blocked according to your
configurations. Testing your firewall should include both vulnerability scanning and
penetration testing. Once you have finished testing your firewall, your firewall should
be ready for production.
Logging Services in Firewall:
A firewall, at its most basic form, is created to stop connections from suspicious
networks. It inspects the source address (of data packet), destination address, and the
destination port of all connections, and decides if a network can be trusted. For
simplicity, we can aggregate information on the source address, source port, and
destination address and port. The success of any firewall typically relies on the rules
160
Chapter 6
used to configure it. To be most effective, a firewall rule set must be augmented with a
successful logging feature. The logging feature documents how the firewall deals with
traffic types. These logs offer insights into, for example, source and destination IP
addresses, protocols, and port numbers.
Uses of Firewall:
• To see if new firewall rules work well or to debug them if they do not work
properly.
• To discover if any malicious activity is occurring within your network. However,
it doesn’t offer the information you need to isolate the source of the activity.
• If you identify repeated unsuccessful tries to access your firewall from a single
IP address (or from a group of IP addresses), you may wish to create a rule to
stop all connections from that IP.
• Outgoing connections derived from internal servers, for example, web servers,
may show that someone is using your system as a launch pad. They could be
launching attacks against computers on other networks from your system.
161
Chapter 6
6.9 Encryption and Decryption
Encryption is the process of translating plain text data (plaintext) into something that
appears to be random and meaningless (ciphertext). Decryption is the process of
converting ciphertext back into plaintext.
162
Chapter 6
system administrator at each site should establish routine backup procedures for the
entire system. However, application programmers should know enough about these
procedures to understand what is being backed up and with what frequency.
Creating Back up of Windows:
There are several ways to back up your PC.
1. Select the Start button, then select Control Panel > System and
Maintenance > Backup and Restore.
2. Do one of the following:
▪ If you've never used Windows Backup before, or recently upgraded your
version of Windows, select Set up backup, and then follow the steps in
the wizard.
▪ If you've created a backup before, you can wait for your regularly
scheduled backup to occur, or you can manually create a new backup by
selecting Back up now.
▪ If you’ve created a backup before, but want to make a new, full backup
rather than updating the old one, select Create new, full backup, and
then follow the steps in the wizard.
Restore your files with File History
If you're missing an important file or folder that you've backed up, here's how to get it
back:
1. In the search box on the taskbar, type restore files, and then select Restore your
files with File History.
2. Look for the file you need, then use the arrows to see all its versions.
3. When you find the version you want, select Restore to save it in its original
location. To save it in a different place, right-click Restore, select Restore to,
and then choose a new location.
Find your backups created on previous versions of Windows
If you use Backup and Restore to back up files or create system image backups in
previous versions of Windows, your old backup is still available in Windows 10. In the
163
Chapter 6
search box on the taskbar, type control panel. Then select Control Panel > System
and Security > Backup and Restore (Windows 7).
164
Chapter 6
Key Points
➢ Computer security means dealing with the security of a standalone computer’s
software and hardware.
➢ Cyber security involves the security of individual computers plus the network
they belong to and the intercommunication between all the computers in your
organization, mobile devices, printers and more.
➢ Viruses are malicious programs that get loaded onto victims’ computers
without their knowledge or permission.
➢ Worms are software programs that will copy themselves from one computer
to another, automatically.
➢ An attack vector is a path or means by which an attacker or hacker can gain
access to a computer or network server in order to deliver a payload or
malicious outcome.
➢ Hackers are people who use their knowledge for a good purpose and do not
damage the data, whereas a cracker is someone who breaks into the system
with a malicious purpose and damages data intentionally.
➢ Risk is the potential for loss, damage or destruction of assets or data caused
by a cyber threat.
➢ Threat is a process that magnifies the likelihood of a negative event, such as
the exploit of a vulnerability.
➢ A vulnerability is a weakness in your infrastructure, networks or applications
that potentially exposes you to threats.
➢ Authentication is the process of identifying users that request access to a
system, network, or device.
➢ Firewalls help control network traffic in the system by acting as barriers for
incoming traffic.
➢ Antiviruses protect systems against internal attacks by perceiving or spotting
malicious files and viruses.
165
Chapter 6
Exercise
2. _____ are the people who use their knowledge for good purpose.
Theoretical Questions:
1. Define Computer Security.
2. Differentiate between Computer Security and Cyber Security.
3. Define threats, attack vectors and vulnerability.
4. What are Information systems?
5. Describe assets of an Information system.
6. Define hacker, cracker and security expert..
166
Chapter 6
7. Define confidentiality, integrity and authenticity.
8. Describe Encryption and Decyption.
9. Describe Malware.
10. Differentiate between Firewall and Anti-virus.
Practical Tasks:
1. Install antimalware software on Windows.
2. Perform a malware scan on Windows.
3. Install and configure a firewall on Windows.
4. Configure firewall to create log files.
5. Perform a system restore on Windows.
167
Chapter 7
Chapter no. 7
Communication Skills
168
Chapter 7
7.1 Communication
Communication is simply an act of transferring information from one place, person or
group to another. Every communication involves (at least) one sender, a message and a
recipient. This may sound simple, but communication is actually a very complex
subject. The transmission of the message from sender to recipient can be affected by a
huge range of factors. These include our emotions, the cultural situation, the medium
used to communicate, and even our location.
7.1.1 Categories of Communication
There are various ways in which we communicate. The different categories of
communication include:
• Spoken or Verbal Communication, which includes face-to-face, telephone,
radio or television and other media.
• Non-Verbal Communication, covering body language, gestures, how we dress
or act, where we stand, and even our scent. There are many subtle ways that we
communicate (perhaps even unintentionally) with others. For example, the tone
of voice can give clues to mood or emotional state, whilst hand signals or
gestures can add to a spoken message.
• Written Communication, which includes letters, e-mails, social media, books,
newspapers, magazines, the Internet and other media. Until recent times, a
relatively small number of writers and publishers were very powerful when it
came to communicating the written word. Today, we can all write and publish
our ideas online, which has led to an explosion of information and
communication possibilities.
• Visualizations: graphs and charts, maps, logos and other visualizations can all
communicate messages.
7.1.2 Principles of Effective Communication:
The following are the principles of effective communication:
• Listening: One of the most important aspects of effective communication is
being a good listener.
• Non-Verbal Communication.
169
Chapter 7
• Be clear and be concise.
• Be confident.
• Be empathetic.
• Always have an open mind.
• Convey respect.
170
Chapter 7
generalities, and so forth. Occasionally, one person is so entrenched in their way of
communicating, they find it difficult to communicate with others who rely on a different
style. You might hear comments such as, “Mary never explains what she wants me to
do, she’s never specific” or “Bill gets so caught up in the weeds, that I lose focus on the
bigger picture.”
Conflicts in the Workplace:
Conflict can happen for a variety of reasons and when it does, it becomes a barrier to
effective communication. The nature of the conflict is not necessarily important, what
is important is working to resolve the conflict. When conflict is not eradicated, it grows
and then people begin to take sides, which further impedes effective communication.
Cultural Differences & Language:
It is important to understand the cultural differences in communication. There can also
be regional differences. For instance, a northerner might not like the term "y’all" or
even understand the more comprehensive version, "all y’all.".
7.1.4 Principles for Effective Team Communication:
Principles of effective communication are:
1. Have an open-door policy
2. Use project management software
3. Be open to feedback
4. Be clear about individual task responsibility
5. Do fun stuff to boost morale
6. Give purpose to coffee breaks
7. Consider formal communications training
8. Decide what forms of communication work best
9. Identify group leaders
10. Understand diversity issues
171
Chapter 7
including contacting friends, communicating with professors and supervisors,
requesting information, and applying for jobs, internships, and scholarships. Depending
on your purposes, the messages you send will differ in their formality, intended
audience, and desired outcomes. The following are some important components of an
email:
Subject Lines
Email subject lines are like newspaper headlines. They should convey the main point
of your message or the idea that you want the reader to take away. Therefore, be as
specific as possible. One-word subjects such as “Hi,” “Question,” or “FYI” are not
informative and don’t give the reader an idea of how important your message is. If your
message is time sensitive, you might want to include a date in your subject line, like
“Meeting on Thurs, Dec 2”.
Teacher Notes:
➢ Compose an example email in class.
172
Chapter 7
well, you may be confused about how to address them (“What do I call my
TA/professor?”) or how to sign off (Best? Sincerely?). Nonetheless, it is always better
to make some kind of effort. When in doubt, address someone more formally to avoid
offending them. Some common ways to address your reader are:
• Dear Professor Smith,
• Hello Ms. McMahon,
• Hi Mary Jane,
If you don’t know the name of the person you are addressing, or if the email addresses
a diverse group, try something generic, yet polite:
• To whom it may concern,
• Dear members of the selection committee,
• Hello everyone,
Your closing is extremely important because it lets the reader know who is contacting
them. Always sign off with your name at the end of your message. If you don’t know
the reader well, you might also consider including your title and the organization you
belong to; for example:
Mary Watkins
Senior Research Associate
Bain and Company
Joseph Smith
UNC-CH, Class of 2009
For your closing, something brief but friendly, or perhaps just your name, will do for
most correspondence:
• Thank you,
• Best wishes,
• See you tomorrow,
• Regards,
For a very formal message, such as a job application, use the kind of closing that you
might see in a business letter:
• Sincerely,
• Respectfully yours,
173
Chapter 7
Cc: and Bcc: (‘carbon copy’ and ‘blind carbon copy’)
Copying individuals on an email is a good way to send your message to the main
recipient while also sending someone else a copy at the same time. This can be useful
if you want to convey the same exact message to more than one person. In professional
settings, copying someone else on an email can help get things done, especially if the
person receiving the copy is in a supervisory role. For example, copying your boss on
an email to a non-responsive co-worker might prompt the co-worker to respond. Be
aware, however, that when you send a message to more than one address using the Cc:
field, both the original recipient and all the recipients of the carbon copies can see all
the addresses in the To: and Cc: fields. Each person who receives the message will be
able to see the addresses of everyone else who received it.
Blind copying emails to a group of people can be useful when you don’t want everyone
on the list to have each other’s addresses. The only recipient address that will be visible
to all recipients is the one in the To: field. If you don’t want any of the recipients to see
the email addresses in the list, you can put your own address in the To: field and use
Bcc: exclusively to address your message to others. However, do not assume that blind
copying will always keep recipients from knowing who else was copied—someone who
is blind copied may hit “reply all” and send a reply to everyone, revealing that they were
included in the original message.
174
Chapter 7
175
Chapter 7
• Brand reputation - You can respond instantly to industry developments and be
seen as 'thought leader' or expert in your field. This can improve how your
business is seen by your audience.
• Cost effective - It can be much cheaper than traditional advertising and
promotional activities. The costs of maintaining a social media presence are
minimal. If you choose to invest in paid advertising, you can spend as much or
as little as your budget allows.
• Website traffic - Social content can boost traffic to your website. This can lead
to increased online conversions such as sales and leads.
• Evaluation - It is easy to measure how much website traffic you receive from
social media. You can set up tracking to determine how many sales are generated
by paid social advertising.
• Customer interaction - You can deliver improved customer service and
respond effectively to feedback. Positive feedback is public and can be
persuasive to other potential customers. Negative feedback highlights areas
where you can improve.
• Target audience - Customers can find you through the social media
platforms they use most. You can choose to maintain a presence on particular
platforms that are in line with your target audience. For example, if you are
targeting young people, you could reach them through Snapchat. If you are
seeking business customers, LinkedIn may be the best channel.
Disadvantages of Social Media:
Some of the disadvantages of using social media include:
• Resources: Resources are required to manage presence on social media i.e.,
responding to feedback and producing new content. This can include hiring and
training staff, investing in paid advertising and paying for the costs of creating
video or image content.
• Ineffective use: Social media can be used ineffectively. For example, using
social media to push for sales without engaging with customers, or failing to
respond to negative feedback - may damage your reputation.
176
Chapter 7
Key Points
➢ Communication is simply the act of transferring information from one place,
person or group to another.
➢ These barriers can be categorized into four main types of constraints to
effective communication: Physical, psychological, organizational, as well as
semantic barriers.
➢ Email subject lines are like newspaper headlines. They should convey the
main point of your message or the idea that you want the reader to take away.
➢ Copying individuals on an email is a good way to send your message to the
main recipient while also sending someone else a copy at the same time.
➢ Blind copying emails to a group of people can be useful when you don’t want
everyone on the list to have each other’s addresses.
➢ Marketing is a tool we use to inform consumers about our products, who we
are, and what we offer.
177
Chapter 7
Exercise
Multiple Choice Questions:
1. Which opion hides other recipients from all recipients.
a. CC b. BCC c. Subject Line d. All of these
a. 5 b. 3 c. 4 d. Both a and b
Theoretical Questions:
1. Define Communication Skills.
2. Whats are the different forms of communication?
3. What are the principles for an effective communication?
4. What are the common barriers in communication?
5. What are themain components of an email?
6. What communication skills are required in a team work?
7. Describe advantages and disadvantages of social media.
178
Chapter 7
Glossary
ADSL: Asymmetric digital subscriber line (ADSL) is a type of digital subscriber line (DSL)
technology, a data communications technology that enables faster data transmission over
copper telephone lines than a conventional voiceband modem can provide.
AI: Artificial intelligence (AI) is a wide-ranging branch of computer science concerned with
building smart machines capable of performing tasks that typically require human intelligence.
Algorithm: A process or set of rules to be followed in calculations or other problem-solving
operations, especially by a computer.
ANSI: The American National Standards Institute - ANSI - facilitates and coordinates the U.S.
voluntary standards and conformity assessment system.
Arithmetic: Arithmetic is the branch of mathematics that deals with the study of numbers using
various operations on them
BIOS: BIOS (basic input/output system) is the program a computer's microprocessor uses to
start the computer system after it is powered on.
Cyber: relating to, or involving computers or computer networks (such as the Internet).
Data Warehouse: In computing, a data warehouse (DW or DWH), also known as an enterprise
data warehouse (EDW), is a system used for reporting and data analysis and is considered a
core component of business intelligence.
DNS: The Domain Name System (DNS) is the phonebook of the Internet.
EEPROM: EEPROM (electrically erasable programmable read-only memory) is user-
modifiable read-only memory (ROM) that allow users to erase and reprogram stored data
repeatedly in an application.
Extension: A filename extension, file extension or file type is an identifier specified as a suffix
to the name of a computer file.
Floating Point: In computing, floating-point arithmetic (FP) is arithmetic using formulaic
representation of real numbers as an approximation to support a trade-off between range and
precision.
FORTRAN: FORTRAN is a general-purpose, compiled imperative programming
language that is especially suited to numeric computation and scientific computing.
Gateway: A gateway is a node (router) in a computer network, a key stopping point for data
on its way to or from other networks.
Geographic: based on or derived from the physical features of an area.
Hotspot: A hotspot is a physical location where people can access the Internet, typically using
Wi-Fi, via a wireless local area network (WLAN) with a router connected to an Internet service
provider.
Java: Java is a high-level, class-based, object-oriented programming language that is designed
to have as few implementation dependencies as possible.
179
Chapter 7
Logistics: the commercial activity of transporting goods to customers.
Machine Learning: Machine learning (ML) is the study of computer algorithms that can
improve automatically through experience and by the use of data.
Network Traffic: Network traffic is the amount of data moving across a computer network
at any given time.
NFC: Near-Field Communication (NFC) is a set of communication protocols for
communication between two electronic devices over a distance of 4 cm.
Off-site: not located or occurring at the site of a particular activity.
Precedence: the condition of being considered more important than someone or something
else; priority in importance, order, or rank.
Python: Python is a powerful general-purpose programming language. It is used in web
development, data science, creating software prototypes, and so on.
ROM: ROM is an acronym for Read-Only Memory. It refers to computer memory chips
containing permanent or semi-permanent data.
Topology: Network topology is the arrangement of the elements (links, nodes, etc.) of a
communication network.
Troubleshoot: Analyse and solve serious problems for a company or other organization.
UEFI: The Unified Extensible Firmware Interface (UEFI) is a publicly available specification
that defines a software interface between an operating system and platform firmware.
Unary: In mathematics, a unary operation is an operation with only one operand, i.e. a single
input.
UNIX: UNIX is an operating system which was first developed in the 1960s, and has been
under constant development ever since.
180