Computer Science Notes
Computer Science Notes
AND
ENTREPRENEURSHIP
Contents
Unit Topic Page
1 Introduction to Systems 1
2 Number Systems 24
3 Digital Systems and Logic Design 49
4 System Troubleshooting 69
5 Software System 87
6 Introduction to Computer Networks 99
7 Computational Thinking 123
8 Web Development with HTML, CSS and JavaScript 151
9 Data Science and Data Gathering 179
10 Emerging Technologies in Computer Science 211
11 Ethical, Social, and Legal Concerns in Computer Usage 225
12 Entrepreneurship in Digital Age 243
Authors
Prof. Muhammad Atif Prof. Syed Waqar ul Qounain Jaffry
(PhD Computer Science) (Post Doc. Computer Science) Chairman Dept. of IT,
Professor of Computer Science, University of The Punjab, Allama Iqbal Campus (Old Campus
Lahore Garrison University. Shahrah-e-Quaid-e-Azam, Lahore.
External Review Committee
Arshad Ali Mudasser Naseer Prof. Asif Shahzad Nadeem Iqbal
(PhD Computer Science and Telecommunication) (PhD Computer Science) (PhD Computer Science) (PhD Computer Science)
Associate Professor, Department Associate Professor(CS), Chairman Department of Associate Professor(CS),
Head (Cyber Security), Department of CS & IT, Computer Science, Department of CS & IT,
Lahore Garrison University. University of Lahore Defense Road, Lahore University of Engineering and Technology, Lahore University of Lahore Defense Road, Lahore
2
Systems Theory:
A branch of a science that deals with complicated structures in living organisms,
that relate the human with society and the science is known as Systems Theory. It
gives a way of interpreting the existing world with different varied perspectives,
how the different systems and sub-systems operate, how they are integrated,
how they grow and how they change with time.
Systems can be observed at all levels of existence, starting with the levels of
nature, and going all the way up to levels of systems designed by humans. These
can be physical objects-such as a car; processes, such as the university's
admission process; or abstract objects such as a mathematical formula. Thinking
about how systems operate helps us better understand how they need to be
developed and nurtured across different discipline like computing, biology,
engineering, and social science. In this section, basic concepts will be introduced
to emphasize fundamental concepts and principles.
1.1.1 Basic Concepts of Systems
A system is described by its objectives components, communication among
components and environment in which it works. The components of a system
communicate with each other to achieve the system's objective in an
environment. Systems can be simple, like a thermostat, or complex, like the
human body or a computer network.
1.1.1.1 Objective
Every system has a purpose or goal that it wishes to fulfil. Analyzing a system's
operation requires understanding its aim. This insight improves the efficiency
and efficacy of the present system. A transport system aims to transfer people
and products securely and effectively between locations. A computer system's
principal goal is to process data and provide useful information to users.
Types of System Objectives
Systems can have different objectives depending on their nature and purpose.
Common objectives include:
1. Information processing: Collecting, storing, processing, and distributing
information, for example
o A computer system processes user data to produce meaningful outputs.
o The human brain processes information received by the human senses to
perceive the environment.
2. Supporting other systems: Providing a platform or infrastructure for other
systems to work, for example:
o A cell phone provides a platform to run different applications.
o The sun provides energy to all species on Earth to live.
3. Achieving specific goals: Completing tasks or processes, for example:
o A thermostat system maintains a set temperature in an environment.
o A car engine system aims to convert fuel into mechanical energy
efficiently.
3
Brain: Informa on processing Cell Phone: Suppor ng Thermostat: Achieving
other systems specific goals
Fig. 1.2 Types of System Objectives
1.1.1.2 Components
Components are the building blocks
of any system. Each component plays
a specific role and contributes to the
overall functionality of the system.
Understanding the role of each
component of the system is essential
to understand how the entire system
works. This helps in identifying
problems, improving performance,
and refining system design. Smooth
and proper working of these
components together ensures the
system meets its objectives.
4 Fig 1.3 Components of Computer Systems
Human Body and its DNA System
1. Consider your body as a very sophisticated and effective system. It is
a remarkable system comprising subsystems such as the circulatory
system, neurological system, and digestive system. The
cardiovascular system circulates blood. The respiratory system
supplies oxygen, and the cerebral system processes information.
Individually, each has a distinct function yet collaborates to ensure
our survival and well-being.
2. DNA is like a blueprint for life. It's a system that contains all the
instructions for an organism to grow, develop, and reproduce,
passed down from generation to generation. Each cell in our body
reads this blueprint to know what to do. When all the DNA in a single
human cell is extended, it measures about two meters in length. The
total long of the DNA in your body extends to the Sun and back more
than six hundred times.
1.1.1.3 Environment
The environment of a system includes everything external to the system that
interacts with it. It consists of all external factors that affect the system's
operation. Understanding the environment of a system is important as it
influences the system's performance and behavior by providing inputs and
receiving outputs. Intelligent systems adjust to changes in their environment to
continue their functionality. There are several properties of a system's
environment that affect system design and its functionality. Two of these
properties are described as follows:
Static vs. Dynamic:
• Static: The environment remains unchanged unless the system provides
an output. There are no changes occurring in the environment while the
system is working internally.
• Dynamic: The environment can change independently of the system's
output. The system must account for changes that occur over time in the
environment.
Deterministic vs. Non-deterministic:
• Deterministic: A deterministic system is characterized by its fully known
and certain impact of its output on the environment.
• Non-deterministic: The impact of the system's output on the
environment is characterized by inherent uncertainty, randomness, or
probability.
1.1.1.4 Communication
• Communication and interaction among system components is key to the
functioning of a system. It ensures that that components work together in an
organized and smooth manner to achieve the system's objectives. For
example, in a computing system the CPU communicates with memory to
fetch and store data, and in a biological system brain sends signals to muscles
to initiate movement. 5
System's Interaction with the Environment
Systems constantly interact with their environment through inputs and outputs.
For example, a weather monitoring system receives data from environment
sensors and provides the current status of the weather and future forecasts to
users. In a computing system, computers the interact and communicate with
peripheral devices like printers and scanners, and in a biological system animals
interact with plants and other animals, forming a food chain.
6
1.2 Types of Systems
Systems can be broadly categorized into two types, namely natural and artificial
systems. Understanding the differences and similarities between these types
helps us apply system theory across various fields. Natural systems are naturally
built and occur in nature without human intervention. While artificial systems are
created by humans to fulfill specific needs or purposes.
14
1.4.4 Environment
The computer system environment includes any external devices that interact
with the computer. For example:
• Power Supply: Provides electrical power to allow the computer to work.
• Network: Connects the computer to other systems and the Internet.
• Peripherals: Include printers, scanners, and external discs that expand the
computer's capabilities.
1.4.5 Interaction with the Environment
A computer interacts with its environment to perform its functions. For examples:
• User Input: A user types on the keyboard, and the computer processes the
input to display text on the screen.
• Network Communication: The computer sends and receives data over the
internet to browse websites or download files.
• Power Supply: The computer relies on a stable power supply to function
correctly.
15
1. Memory: Contains both input data and the instructions (program) required
for CPU processing. For instance, consider the RAM of your computer: when a
program starts it is loaded into RAM to enable faster execution compared to
when it runs from the hard disk.
2. Central Processing Unit (CPU): Performs addition and subtraction, and
executes commands provided by the memory. The system has two main
components: the Arithmetic Logic Unit (ALU) and the Control Unit (CU).
The Arithmetic Logic Unit (ALU) performs mathematical computations and
logical operations.
A Control Unit (CU) is a peripheral that governs the activities of the CPU by
instructing the ALU and memory to execute tasks according to the
program instructions. It ensures the proper and timely execution of duties
by all the other components.
When doing the calculation 2 + 2 on a calculator application, the
Arithmetic Logic Unit (ALU) handles the numerical values while the control
Unit (CU) supervises the whole procedure.
3. Input Devices: Enable users to input data and instructions into the
computer system.
Illustrative examples include keyboard, mouse, and microphone. Entering
text on the keyboard transmits data to the CPU for subsequent processing.
4. Output Devices: Present or communicate the outcomes of the tasks
executed by the computer.
Consider, for instance, a monitor and printer. Upon completion of data
processing, the CPU transmits the outcome to the monitor for visual
display.
A system bus is a communication mechanism that facilitates the
movement of data between components inside a computational system. It
comprises:
Data Bus: Transports data.
Address Bus: Maintains data destination information.
Control Bus: Transports control electrical signals.
Internet Systems
1. When you send an email or browse the internet, data travels through cables and airwaves
across the world in just seconds. It's like sending a letter that gets delivered instantly,
regardless of distance!
2. The internet is one of the largest man-made systems ever created. It's a vast network of
interconnected computers that communicate with each other to share information, much like
how our brain's neurons communicate. When you send a message, it travels through multiple
networks before reaching its destination, all within seconds.
3. Data on the internet travels at nearly the speed of light! When you send a message or
browse a website, your data can cross continents almost instantaneously.
4. There are over 1.5 billion websites on the internet today, and more than 4 billion people are
connected to the internet globally. That's more than half of the world's population!
20
Summary
· A system is a collection of parts that work together to achieve a common
goal.
· A system is described by its objective, components, communication
among components and environment in which it works.
· Components are the building blocks of any system. Each component
plays a specific role and contributes to the overall functionality of the
system.
· The environment of a system includes everything external to the system
that interacts with it. It consists of all external factors that affect system's
operation.
· Systems can be broadly categorized into two types, namely natural and
artificial systems.
· Natural systems are those that exist in nature and operate independently
of human involvement.
· Artificial systems are designed and constructed by humans.
· Social systems are organized structures created by humans to manage
social relationships, governance, and community activities.
· Computer science is the study of how computers work. It looks at what
computers can do and what limitations they have.
· A computer is a complex system designed to process data and perform
tasks according to a set of instructions.
· The Von Neumann architecture involves several key steps for a CPU to
execute instructions, including fetching, decoding, executing, and
storing.
· System software is the basic software that helps a computer run and
manage its hardware and software resources.
· Application software is the software designed to help users perform
specific tasks or activities.
21
Multiple Choice Questions
1. What is the primary function of a system?
a) To work independently b) To achieve a common goal
c) To create new systems d) To provide entertainment
2. What is one of the fundamental concepts of any system?
a) Its size b) Its objective c) Its age d) Its price
3. What is an example of a simple system?
a) A human body b) A computer network
c) A thermostat regulating temperature d) The Internet
4. What type of environment remains unchanged unless the system
provides an output?
a) Dynamic b) Static
c) Deterministic d) Non-deterministic
5. What are the basic components of a system?
a) Users, hardware, software
b) Objectives, components, environment, communication
c) Inputs, outputs, processes
d) Sensors, actuators, controllers
6. What concept does the theory of systems aim to understand?
a) Hardware design
b) System interactions and development over time
c) Software applications
d) Network security
7. What role does the Operating System (OS) play in a computer?
a) It performs calculations and executes instructions
b) It temporarily stores data and instructions for the CPU
c) It receives input from interface components and decides what to
do with it
d) It provides long-term storage of data and software
8. Which of the following describes the Von Neumann architecture's main
characteristic?
a) Separate memory for data and instructions
b) Parallel execution of instructions
c) Single memory store for both program instructions and data
d) Multiple CPUs for different tasks
9. What is a disadvantage of the Von Neumann architecture?
a) Complex design due to separate memory spaces
b) Difficult to modify programs stored in memory
c) Bottleneck due to single memory space for instructions and data
d) Lack of flexibility in executing instructions
22
10. Which of the following transports data inside a computer among different
components?
a) Control Unit b) System Bus
c) Memory d) Processor
Short Questions:
1. Define a system. What are its basic components?
2. Differentiate between natural and artificial systems.
3. Describe the main components of a computer system.
4. List and describe the types of computing systems.
5. What are the main components of the Von Neumann architecture?
6. What is the Von Neumann computer architecture? List its key components.
7. What are the four main steps in the Von Neumann architecture's instruction
cycle?
8. What is the Von Neumann bottleneck?
9. What is a key advantage of the Von Neumann architecture?
10. What are the three main requirements for a computing system to function?
Long Questions
1. Define and describe the concept of a system. Explain the fundamental
components, objectives, environment, and methods of communication
within a system.
2. Differentiate between natural and artificial systems. Discuss their
characteristics, functions, and purposes with relevant examples.
3. Examine the relationship between systems and different branches of science,
including natural science, design science, and computer science. How do
these branches utilize system theory to understand and improve their
respective fields? Provide specific examples to support your analysis.
4. Explore the different types of computing systems such as computers,
software systems, computer networks, and the internet.
5. Describe the main characteristics of a computer as a system, including its
objectives, components, and interactions among these components.
6. Explain the Von Neumann architecture of a computer. Include a discussion on
the main components, their functions, and the step-by-step process of how
the architecture operates.
7. Provide a detailed explanation of how a computer interacts with its
environment. Include examples of user input, network communication, and
power supply.
8. Describe the process of retrieving and displaying a file using a computer,
based on the interactions among different components. Provide a step-by-
step explanation of how input is processed, data is transferred, and results are
displayed on the screen.
23
UNIT
Number Systems
2
Student Learning Outcomes
Understand Number System:
• The different numbering systems, including decimal, binary, hexadecimal, and octal, and
their respective base values and digits.
• Why computers primarily use the binary number system for data representation.
• Machine-level representation of data, including how data is stored and processed within
the computer's architecture.
• The representation of whole and real numbers in a computer, including binary encoding
methods for both.
• How various arithmetic operations, such as addition, subtraction, multiplication, and
division, are performed on binary representations of numbers?
• The concept of common text encoding schemes, such as ASCII and Unicode, and How
they represent characters.
• How digital data representations work for various forms of multimedia, such as images,
audios, videos, and other multimedia resources.
• Different file formats and their variations for specific applications.
• The concept of file extensions and their significance in identifying file types and
applications.
• Key terms related to data representation, including ASCII, Unicode, binary, signed and
unsigned numbers, bits, bytes, hexadecimal number systems, negatives in binary, two's
complement, binary arithmetic, overflow, and underflow.
• The concept of Boolean functions, to represent logic operations and relationships
between binary variables.
• How to construct Boolean expressions using variables and Boolean operators.
• Common Boolean identities and simplification techniques.
• The concept of duality in Boolean algebra, where OR becomes AND, and 0 becomes 1.
• The fundamentals of digital logic, which involves using binary digits (0 and 1) to process
and store information.
• Difference between analog and digital signals and understanding their key differences.
• Various logic gates (AND, OR, NOT, NAND, XOR) and their functions in processing binary
data.
• The purpose and construction of truth tables for evaluating the output of logic
expressions based on input combinations.
• The concept of switches and their role in digital systems, often used to represent binary
input.
• Karnaugh maps as a visual tool for simplifying Boolean expressions.
• Truth table, Boolean expression, circuit diagram of Half-adder and Full-adder
• Half-adder and Full-adder as digital systems with specific objectives, components and
interaction among those components
24
Introduction
Understanding number systems is fundamental in computer science and digital
electronics. This chapter will delve into various numbering systems, their
applications, and how they are used in computers. We will cover the following
topics:
1. Different numbering systems: decimal, binary, hexadecimal, and octal.
2. Binary number system in computers.
3. Machine-level data representation.
4. Representation of whole and real numbers.
5. Binary arithmetic operations.
6. Common text encoding schemes: ASCII and Unicode.
7. File formats and extensions.
8. Key terms in data representation.
9. Binary data manipulation and conversion.
10. Encoding schemes.
11. Differences between file formats.
12. Storing images, audio, and video in computers.
2.1 Numbering Systems
Numbering systems are essential in computing because they form the basis for
representing, storing, and processing data. Different numbering systems help
computers perform tasks like calculations, data storage, and data transfer. These
systems allow computers to represent various kinds of information, such as text,
colors, and memory locations. Here is a description of a few numbering systems:
2.1.1 Decimal System
The decimal number system is a base-10 number system that consists of digit
from 0 to 9 and we use it in everyday life. That's why each digit of the number
represents a power of 10. In the decimal system the place values starting from
the rightmost digits are 100, 101, 102, and so on. For example, the decimal number
523 means:
5 x 102 + 2 x 101 + 3 x 100 = 500 + 20 + 3 = 523
2.1.2 Binary System
In binary, the place values are arranged from the right to left, starting with 2⁰, and
ending at 2ⁿ,where each position represents a power of 2. For example, the
binary number 1011 can be converted to decimal as follows:
3 2 1 0
1 x 2 + 0 x 2 + 1 x 2 + 1 x 2 = 8 + 0 + 2 + 1 = 11
Computers work in binary system especially because this method fits well with
electronics. Digital circuits have two states: They can be either on or off. These
states are easily represented by the binary digits: 1 represent ON, and 0
represnets OFF. When typing on the keyboard, the computer translates every
25
letter to a binary. Similarly, number, text, images, and sound are all, at their
lowest level, reduced to binary. We shall discuss this is details later in this chapter.
When you type a letter on your keyboard, the computer converts it into a binary
code. Similarly, all types of data, including numbers, text, images, and sounds,
are ultimately broken down into binary code. We will explore it further later in
this chapter.
2.1.2.1 Conversion from Decimal to Binary
The following algorithm translate a decimal number to binary.
1. To convert decimal number to binary form, divide the decimal number by 2.
2. Record the remainder.
3. Divide the number by 2 until the quotient which is left after division is 0.
4. Meaning it is represented by the remainders and it's read from the bottom to
the top of the binary number.
Example: Convert 83 to binary
83 / 2 = 41 remainder 1
41 / 2 = 20 remainder 1
20 / 2 = 10 remainder 0
10 / 2 = 5 remainder 0
5 / 2 = 2 remainder 1
2 / 2 = 1 remainder 0
1/ 2 = 0 remainder 1
The above steps are graphically shown in Figure 2.1. If the remainders are read
from bottom to top then it gives the required result in binary, which is 1010011.
2 83
2 41—1
2 20—1
2 10 — 0
2 5—0
2 2—1
2 1—0
0—1
Figure 2.1 Decimal to Binary conversion
26
Class activity
th
1. Marks Conversion: Each student will take his or her marks from 8
grade for each subject and convert them from decimal to binary. For
example, if a student score 85 in Math, he/she will convert 85 to binary
(which is 1010101).
2. Clock Time Conversion: Students will be given various times of the
day and asked to convert them into binary. For instance, 3:45 PM would
be converted as follows:
Hours (15) = 1111
Minutes (45) = 101101
3. Write your sleeping time in binary.
Class activity
1. Work in pairs to convert the following decimal numbers to octal: 45,
128, 64.
2. Convert these octal numbers to decimal: 57, 124, 301.
3. Share your answers with the class and discuss any differences.
28
The octal system was used in early computing systems like
PDP-8. It was used because it is easier to convert between
octal and binary than between decimal and binary.
29
Hexadecimal Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
Table 2.2: Correspondence between Hexadecimal and Binary Digits
1101 =D
0110 = 6
1011 = B
0010 = 2
2.1.4.1 Converting Decimal to Hexadecimal
The following algorithm converts a decimal number to hexadecimal:
1. Convert the decimal number to an absolute value by dividing it by 16.
2. Record the quotient and the remainder.
3. Continue dividing the quotient by 16 and write down the remainder until the
quotient is zero.
4. The hexadecimal number, as you might have guessed, is the remainder read
from bottom to top.
Example: Convert 2297 to hexadecimal
30
2297 / 16 = 143 remainder 9
143 / 16 = 8 remainder F 16
8 / 16 = 0 remainder 8 16
The above steps are graphically shown in Figure 2.3. Reading the remainders
from bottom to top gives the required result, i.e., 8F9 in hexadecimal.
Class activity
Find the following values and express them in hexadecimal. Discuss your
findings with your classmates:
• Minimum Age to Cast Vote
• Length of the Indus River
• Total Districts in Pakistan
• Height of K2 (the second-highest mountain in the world)
• Area of Pakistan
Understanding how integers are stored in memory helps you appreciate the
inner workings of computers and ensures you can effectively work with different
data types in programming.
2.3 Storing Real Values in Computer Memory
In computers, real values, also known as floating-point numbers, are used to
represent number with fractions and/or decimals.
2.3.1 Understanding Floating-Point Representation
Floating-point numbers (real values) are represented similarly to scientific
notation as given below:
A floating-point number = sign x mantissa x 2 exponent. According to the above
formula, 5.75 is represented as 1.4375 x 2. To convert the fractional part of a real
(floating-point) number from decimal (base-10) to binary (base-2), multiply the
fractional part by 2 and write down the integral part of the result. Repeat this
process with the new fractional part until the value of the fractional part becomes
zero or until the required precision is achieved.
Steps for Conversion:
1. Identify the Fractional Part: Get the fractional part of the decimal number. For
instance, in the number 4.625, the integral part is 4 and the fractional part is 0.
625.
2. Convert the Fractional Part to Binary: Multiply the fractional part by 2, and
write down the integer that is obtained. Repeat this process with the new
fractional part till it gets to 0 or until then required number of decimal places
is achieved.
Example: Converting 0.375 to Binary
1. Identify the Fractional Part: Fractional part: 0.375
2. Convert the Fractional Part 0.375 to Binary:
33
0.375 x 2 = 0.75 (Integer part: 0)
0.75 x 2 = 1.5 (Integer part: 1)
0.5 x 2 = 1.0 (Integer part: 1)
The integer parts recorded are 0, 1, 1.
3. Combine the Results: Combine the binary representations of the integer parts
from top to bottom:
0.37510= 0.0112
In computing, it is critical to express real numbers in a binary form since it
facilitates computing and storage. This process involves converting both the
integer (decimal) and the fractional parts of a given number into binary. Two
commonly use standards for this representation are “Single precision (32-bit)”
and “Double Precision (64-bit)”.
2.3.1.1 Single Precision (32-bit)
In this standard, 4 bytes (or 32 bits) are assigned where the 1st bit is the sign bit,
and the next 8 bits are for the exponent and the remaining 23 bits are for the
mantissa.
Here the exponent can be ranged between −126 and +127.
The approximate range of values from1.4 x 10-45 to 3.4 x 1038.
Explanation:
Table 2.3 illustrates how 32-bit floating point values are represented in binary
form. Each floating point value is broken down into three main components: the
sign bit, the exponent, and the mantissa.
1. Grouping: This row explains the bit allocation for the 32-bit floating point
format: 1 bit for the sign, 8 bits for the exponent, and 23 bits for the mantissa.
34
1. 5.75: Representation: 1.4375 x 22 - Sign Bit: 0 (positive) - Exponent: 2 +127 =
129, which is 100000012 - Mantissa: The binary representation of 0.4375 is
101110000000000000000002
2. -5.75: Representation: -1.4375 x 22 - Sign Bit: 1 (negative) - Exponent: 2 + 127
= 129, which is 100000012 - Mantissa: The binary representation of 0.4375 is
101110000000000000000002
3. 0.15625: Representation: 1.25 x 2-3 - Sign Bit: 0 (positive) - Exponent: -3 +127
= 124, which is 011111012 - Mantissa: The binary representation of 0.25 is
010000000000000000000002
4. -0.15625: Representation: -1.25 x 2-3 - Sign Bit: 1 (negative) - Exponent: -3
+127 = 124, which is 011111012 - Mantissa: The binary representation of 0.25
is 010000000000000000000002
This breakdown helps illustrate how floating point values are stored and
manipulated in computer systems
2.3.1.2 Double Precision (64-bit)
In double precision, the exponent is represented using 11 bits. The exponent is
stored in a biased form, with a bias of 1023. The range of the actual exponent
values can be determined as follows:
• Bias: 1023
• Exponent range: The actual exponent values range from -1022 to +1023.
Therefore, the smallest and largest possible exponent values in double-
precision are:
• Minimum exponent: -1022
• Maximum exponent: +1023
We can perform the same steps given for the single-precision, except the
difference of the abovementioned values.
When performing computation with floating point values one should also
consider possible round off errors. In scientific computing, it is necessary to
monitor these errors to maintain the accuracy.
35
Class activity
1. Write down the binary representation of the following decimal
numbers: 2. 5,7. 25, and 10.5.
2. Then, convert these binary representations to the format single
precision format.
3. After completing this operation, discuss with classmates and yourself
how the degree of accuracy of the representation differs based on the
size of the number?
The information about how real values is stored in computer memory help us
understand the precision and limitations of digital computation. With this
understanding of floating-point representation, it becomes possible to control
and manipulate these numbers in different ways.
2.4 Binary Arithmetic Operations
Arithmetic operations include addition, subtraction, multiplication and division,
and are performed on two numbers at a time. Binary arithmetic operations are
similar to decimal operations but follow binary rules. Here's a brief overview of
the basic operations:
2.4.1 Addition
Binary addition uses only two digits: 0 and 1. Here, we will learn how to add binary
numbers and how to handle the addition of negative binary numbers.
11000
In this example:
• 1 + 1 = 0 (carry 1)
• 0 + 1 + 1 (carry) = 0 (carry 1)
• 1 + 0 + 1 (carry) = 0 (carry 1)
• 1 + 1 + 1 (carry) = 1 (carry 1)
36
2.4.2 Subtraction
In binary arithmetic, subtraction can also be carried out by adding the two's
complement or the value of the subtrahend to the minuend.
Example: Subtract 6 from 9 in Binary
Minuend = 910 = 10012
Subtrahend = 610 = 01102
Step 1: Find the Two's Complement of the Subtrahend
• Invert the bits of 01102:
Inversion: 10012
• Add 1 to the inverted number:
10012 + 12 = 10102=-610
Step 2: Add the Minuend and the Two's Complement of the
Subtrahend
10012+10102= 100112
Step 3: Discard the Carry Bit
100112 Discard carry 00112= 310
So, 9 - 6 = 3.
2.4.3 Multiplication
Binary numbers are base-2 numbers, consisting of only 0s and 1s. Multiplying
binary numbers follows similar principles to multiplying decimal numbers, but
with simpler rules. Here, we will learn how to multiply binary numbers with
example.
Steps to Multiply Binary Numbers
1. Write down the binary numbers, aligning them by the least significant bit
(rightmost bit).
2. Multiply each bit of the second number by each bit of the first number, similar
to the long multiplication method in decimal.
3. Shift the partial results one place to the left for each new row, starting from
the second row.
4. Add all the partial results to get the final product.
Example
Let's multiply two binary numbers: 1012 and 112.
101
X 11
101 (This is 1012 X 12)
101X 0 (This is 1012 X 12, shifted left)
1111
So,1012X112=11112.
37
The Central Processing Unit (CPU) of a computer performs
millions of binary multiplications every second to execute
complex instructions and run programs!
2.4.3 Division
Binary division is similar to decimal division but only involves two digits: 0 and 1.
It follows steps like comparing, subtracting, and shifting, akin to long division in
the decimal system.
Steps of Binary Division
1. Compare: Compare the divisor with the current portion of the devidend.
2. Subtract: Subtract the divisor from the dividend portion if the divisor is less
than or equal to the dividend.
3. Shift: Shift the next binary digit from the dividend down to the remainder.
4. Repeat: Repeat the process until all digits of the dividend have been used.
Example
Divide 11002by 102
10 1100
(Step 1: Compare 10 with first two 11, subtract 10 from 11)
-10
(Step 2: Bring down the next digit 0)
10
-10 (Step 3: Compare 10 with 10, subtract 10 from 10)
0 (Step 4: Bring down the next digit 0, no more digits left)
Class activity
Practicing Binary Division
Objective: To practice and understand binary division through hands-on
examples. Instructions:
1. Form groups of three to four students.
2. Each group will solve the following binary division problems:
(a) 10101₂ 10₂
(b) 11100₂ 11₂
100110₂ 101₂
3. Write down each step of your division process clearly.
4. Present your solutions to the class, explaining each step and the
reasoning behind it.
38
2.5 Common Text Encoding Schemes
Text encoding schemes are essential for representing characters from various
languages and symbols in a format that computers can understand and process.
Here are some of the most common text encoding schemes used in computers:
2.5.1 ASCII
ASCII is an acronym that stands for American Standard Code for Information
Interchange. It is a character encoding standard adopted for representing in
devices such as computers and similar systems that use text. Each alphabet,
number or symbol is given a code number between 0 and 127 as shown in Table
2.4.
ASCII enables different computers and devices to exchange text information
reliably. Let's encode the name of our country using ASCII.
Class activity
1. Write down your name.
2. Find the ASCII code for each letter in your name. You can use
the ASCII tableto for your help.
3. Convert each ASCII code to binary.
4. Write down your name in binary!
39
Character ASCII Code Character ASCII Code
SP (space) 32 ! 33
" 34 # 35
$ 36 % 37
& 38 ’ 39
( 40 ) 41
* 42 + 43
, 44 - 45
. 46 / 47
0 48 1 49
2 50 3 51
4 52 5 53
6 54 7 55
8 56 9 57
58 ; 59
< 60 = 61
> 62 ? 63
@ 64 A 65
B 66 C 67
D 68 E 69
F 70 G 71
H 72 I 73
J 74 K 75
L 76 M 77
N 78 O 79
40
P 80 Q 81
R 82 S 83
T 84 U 85
V 86 W 87
X 88 Y 89
Z 90 [ 91
\ 92 ] 93
94 - 95
ˆ? 96 a 97
b 98 c 99
d 100 e 101
f 102 g 103
h 104 i 105
j 106 k 107
l 108 m 109
n 110 o 111
p 112 q 113
r 114 s 115
t 116 u 117
v 118 w 119
x 120 y 121
z 122 { 123
| 124 } 125
126 DEL 127
Table:2.4
41
2.5.1 Extended ASCII
While the standard ASCII Table includes 128 characters, there is an extended
version that includes 256 characters. This extended ASCII uses 8 bits and includes
additional symbols, accented letters, and other characters. However, the original
128 characters are the most commonly used and serves as the basis for text
representation in computers.
2.5.2 Unicode
Unicode is an attempt at mapping all graphic characters used in any of the
world's writing system. Unlike ASCII, which is limited to 7bits and can represent
only 128 characters, Unicode can represent over a million characters through
different forms of encodings such as, UTF-8, UTF-16, and UTF-32. UTF is an
acronym that stands for Unicode Transformation Format.
2.5.2.1 UTF-8
It is a variable-length encoding scheme, meaning it can use a different numbers
of bytes (from 1 to 4) to represent a character. UTF-8 is backward compatible
with ASCII. It means it can understand and use the older ASCII encoding scheme
without any problems. Therefore, if we have a text file written in ASCII, it will work
perfectly fine with UTF-8, allowing it to read both old and new texts.
Example: The letter ‘A’ is Unicode, represented as, U+0041, is 01000001 in the
binary format and occupies 8 bits or 1 byte.
Let's look at how Urdu letters are represented in UTF-8:
Example: The Urdu letter ' 'بis represented in Unicode as U+0628; its binary
format is 11011000 10101000, means it takes 2 bytes.
2.5.2.2 UTF-16
UTF-16 is another variable character encoding mechanism, although it uses
either 2 bytes or 4 bytes per character at most. Unlike UTF-8, it is not compatible
with ASCII, meaning it cannot translate ASCII code.
Example: The letter A in UTF-16 is equal to 00000000 01000001 in binary or 65 in
decimal (2 bytes).
For Urdu:
Example: The right Urdu letter ' 'بin UTF-16 is represented as is 00000110
00101000 in binary, which occupies 2 bytes of memory.
2.5.2.3 UTF-32
UTF-32 is a method of encoding that uses a fixed length, with all characters
stored in 4 bytes per character. This makes it very simple but at the same time it
may look a little complicated when it comes to space usage.
Example: Alphabet letter ‘A’ in UTF-32 is represented in binary as 00000000
00000000 00000000 01000001 which is 4 bytes.
42
2.6 Storing Images, Audio, and Video in Computers
Have you ever wondered how your favorite photos, songs, and movies are stored
on your computer or phone? Let's dive into the fascinating world of digital
storage to understand how computers manage these different types of files.
Class activity
Create a Pixel Art
1. Use graph paper to draw a simple image, such as a smiley face.
2. Color each square (pixel) and write down the RGB values for each
color used.
3. Share your pixel art and RGB values with the class.
43
2.6.2 Storing Audio
Audio files are stored by capturing sound waves and converting them into digital
data. This process involves sampling and quantization.
Sampling and Quantization:
• Sampling: Recording the sound wave at regular intervals. The number of
samples per second is called the sampling rate. Higher sampling rates result
in better quality.
• Quantization: Converting each sample into a number. More bits per sample
provide more accurate sound representation.
Audio File Formats:
• Mp3: A common format that compresses audio to save space but may lose
some quality.
• WAV (Wave Audio File Format): Uncompressed format that maintains high
quality.
• AAC (Advanced Audio Coding): Used by many streaming services for high-
quality audio with efficient compression.
Listening to music chnaged dramaticallly with the introduction
of the MP3 format. It revolutionized the music industry by
allowing songs to be easily shared over the internet due to its
smaller file size.
To explain how these units are used, consider the following examples:
• An image file might have a size of 500 KB (Kilobytes).
• A music file might be around 5 MB (Megabytes).
• A full-length HD movie could be approximately 2 GB (Gigabytes).
• A large external hard drive could have a capacity of 1 TB (Terabytes).
2.6.3 Storing Video
Videos are made up of many images shown rapidly in sequence, along with
audio. Each image in a video is called a frame.
Frames and Frame Rate:
• Frame Rate: The number of frames shown per second, measured in Frames
Per Second (FPS). Common frame rates are 24 fps (used in movies) and 30 fps
(used in TV). Higher frame rates result in smoother motion in videos.
Video File Formats:
• MP4: A widely used format that efficiently compresses video while
maintaining quality.
• AVI: An older format that may result in larger file sizes.
• MKV: Supports high-quality video and multiple audio tracks or subtitles.
When watching videos online, the quality can change based
on your internet speed. Streaming services adjust the video
quality to avoid buffering.
44
2.6.4 How Computers Store These Files
All these files (images, audio, and video)are stored as binary data, which means
they are represented by sequences of 0s and 1s.
Storage Devices:
• Hard Disk Drive (HDD): Use spinning disks to read/write data. They offer
large storage capacities.
• Solid State Drive (SSD): Use flash memory for faster access times and better
performance.
• Cloud Storage: Stores files on remote servers accessible via the internet,
providing flexibility and backup options.
IBM created the first hard drive in 1956 which weighed over a ton
and could only store 5,000,000 bytes which is much less than the
storage required for even one high-quality song today.
48
UNIT Digital Systems and
3 Logic Design
Student Learning Outcomes
By the end of this chapter, you will be able to:
• Understand Boolean functions and operations it, such as Boolean AND,
and OR.
• Construct Boolean expressions using variables and Boolean operators.
• Relate common Boolean identities and Boolean simplification
procedures.
• Understand the concept of duality in Boolean algebra.
• Subtopics such analog and digital signals
• Introduce several types of gates and their functions.
• Build truth tables for the operations of logical expressions.
• Employ the K-Maps in minimizing Boolean expressions.
• Introduce logic diagrams of digital system.
• Analyze and design half-adder and full-adder circuits.
49
Introduction
In this chapter, we will discuss the Boolean functions, logic, digital logic, and
difference between analog and digital signals. We will also discuss several types
of gates, their truth tables, and digital devices including half and full adders. At
the completion of this chapter, you should be construct Boolean expressions,
simplify them, create truth table, and understand the basics of digital logic.
3.1 Basics of Digital Systems
Digital systems are the backbone of today's electronics and computing. They
manipulate digital information in the form of binary digits, which are either 0 or 1
and are used in calculation devices such as calculators and computers, among
others.
3.1.1 What is an Analog Signal
Analog signals are signals that changes with time smoothly and continuously
over time. They can have any value within given range. Examples include voice
signal (speaking), body's temperature and radio-wave signals. Digital signals are
the signals which have only two values that are in the form of '0' and '1'. These are
utilized in digital electronics and computing systems. Analog to digital converter
(ADC) and digital to analog converters (DAC) are important operations in today's
technological developments, enabling the transmission and control of signals.
Continuous Discrete
Infinite possible values Finite (0 or 1)
Example: Sound waves Example: Binary data in
computers
50
ADC DAC
Figure 3.1: Analog to Digital and Vice Versa
51
3.1.2 Fundamentals of Digital Logic
Digital logic is the basis of digital systems. It involves the use of binary numbers
that is 0 and 1, to represent and manipulate information. Digital logic circuits use
of these binary values to perform various operations, and they are essential to
the functioning in operation of computers and many other electronic devices.
In digital circuits, the two states, 0 and 1, are represented by different voltage
levels. Conventionally, a higher voltage, such as, 5 volts refer to a binary ‘1’ , while
a low voltage, for instance, 0 volts refer to a binary ‘0’. These voltage levels are
termed as the logic levels. Logic levels are needed to switch on and switch off the
devices and to define ways through which digital circuits execute operations and
process information.
3.2 Boolean Algebra and Logic Gates
Boolean algebra is a branch of mathematics relate to logic and symbolic
computation, using two values namely True and False. It is an essential branch of
digital circuits since it is the basis for the analysis and design of circuits. Here in
this section we will cover of Boolean functions and expressions, the working, and
functions of logic gates, Building and evaluating Truth Tables and Logic
Diagrams.
3.2.1 Boolean Functions and Expressions
Binary values are used to describe the relationship between variables in the
Boolean function and Boolean expressions. The expressions are built using AND,
OR, and other logic operations and can in several ways be reduced to optimize
digital circuits.
3.2.1.1 Binary Variables and Logic Operations
Binary variables that can have only have two values, 0 and 1. Logic operations are
basic operations implemented in Boolean algebra for processing of these binary
variables. The primary logic operations are AND, OR and NOT.
AND Operation:
AND is the basic logical operator which is used in Boolean algebra. It requires two
binary inputs which will give a single binary output. The symbol '.' is used for the
AND operation. The output of the AND operation is “1” only when both inputs
are “1”. Otherwise, the result is “0”.
Example:
Consider two binary variables:
A = 1(True)
B = 0 (False)
The AND operation for these variables can be written mathematically as:
P=A·B
In this example:
A=1 B = 0
Therefore, then, the result P of the AND operation is 0 (false).
52
Truth Table:
A truth table is useful in demonstrating the functionality of the AND operation
with all possibilities of the input variables. Below is the truth table for the AND
operation.
A B A AND B (P)
0 0 0
0 1 0
1 0 0
1 1 1
Table 3.1: Truth Table for AND Operation
Explanation:
If both A and B are off, that is equal to zero then the desired output P is off
(0).
if A is 0 and B is 1 the output P is 0.
When A is 1 and B is 0 P is resulting 0.
When A is 1 and B is 1, the output P also becomes 1.
OR Operation:
The OR operation is an other basic logical operator in Boolean algebra. To be
specific this is also a function tables two binary variables as input produces a
single binary output. According to Table 3.2, the OR operation yields true (1)
output when at least of ‘1’ of the inputs is true (1). The output is 0 only when both
inputs are ‘0’.
Example:
Consider two binary variables:
A = 1 (true)
B = 0 (false)
The OR operation for these variables can be written mathematically as:
P = A+B
In this example:
A = 1 B= 0
Therefore, result P of the OR gate will be 1.
Truth Table:
A truth table is useful for better understanding of how the OR operation is
organized and what the result of the OR's application is for all variants of the
input variables. Below is the truth table for the OR operation.
53
Explanation:
If A is equal to 0 and B is equal to 0 the output P is equal to 0. When A is zero and B
is one, the output P is also one. When A is equal to 1 and B is equals to 0 the
values of P equal to 1. When both A and B are 1 then the output P equal to one.
A B A OR B (P)
0 0 0
0 1 1
1 0 1
1 1 1
Table 3.2: Truth Table for OR Operation
NOT Operation:
The NOT operation is one of the basic Boolean algebra operations which takes a
single binary variable and simply negates its value. If the input is one, the output
is zero and if the input is zero, the output is one.
Example:
Consider a binary variable:
A = 1 (true)
The NOT operation for this variable can be written mathematically as:
P = A or P= A
In this example:
P=0
This signifies that if you have A = 1 (true), the result of NOT operation is going to
be 0 (false).
Truth Table:
The following table will illustrate the working of NOT operation for all possible
inputs of the variable. Below is the truth table for the NOT operation.
A NOT A (P)
0 1
1 0
Table 3.3: Truth Table for NOT Operation
54
Explanation:
When the input A is 0, the output P is 1. When A is 1 the output value P is 0. A NOT
operation performs the negative of the input variable i. e., it gives the opposite
value. This operation is important in digital logic design to generate more
complex logic functions and verify the functionality of digital circuits.
3.2.1.2 Construction of Boolean Functions
Boolean functions are algebraic statements that describe the relationship
between binary variables and logical operations. These functions are particularly
important for digital logic design and are employed in formation of various
digital circuits, which are the basis of current computers, mobile phones and
even simple calculator.
Understanding Boolean Functions:
A Boolean function is a function which has a one or more binary inputs and
produces a single binary output. The inputs and outputs can only have two
values: False (represented by 0) and True (represented by 1). The construction of
Boolean functions is done by employing the basic logical operations such as
AND, OR and NOT, which connect the inputs to generate the correct output.
Example 1: Simple Boolean Function
Consider a Boolean function with two inputs, A and B. We can construct a
function F that represents the AND operation:
F ( A, B ) = A . B
Output
Input
The diagram shown above demonstrates a basic digital circuit, which is an AND
gate. The box symbolizes the AND function F (A, B) = A . B. This box has two inputs
A and B. If both A and B are 1, the output will be 1. In any other case, the output
will be 0. The input are shown at the entrance to the box, while the output is
depicted at the exit of the block. The truth table for this function is as follows:
55
A B F(A, B)
0 0 0
0 1 0
1 0 0
1 1 1
Table 3.4: Truth Table for F(A,B) = A.B
Example 2: Now, let us construct a more complex Boolean function with three
inputs, A, B, and C:
F (A, B, C) = A . B + A . C
This function uses AND, OR and NOT at the same time. The truth table for this
function is as follows:
Explanation:
• The parameters A, B, and C are included in the following example as the input
columns.
• The results of AND operation between two variable A and B are presented in
the column A · B.
• The column A standing for the NOT operation of A.
• Every value in the column A · C displays the result of AND operation between
the values in the Fifth column and the third column.
• The final column F (A, B, C) shows the output of the Boolean function
(A . B) + (A . C)
A B C A·B A A· C F(A, B, C)
0 0 0 0 1 0 0
0 0 1 0 1 1 1
0 1 0 0 1 0 0
0 1 1 0 1 1 1
1 0 0 0 0 0 0
1 0 1 0 0 0 0
1 1 0 1 0 0 1
1 1 1 1 0 0 1
Table 3.5: Detailed Truth Table for F (A, B, C) = (A . B) + (A . C)
Usage in Computers:
There are many uses of Boolean functions in the computers for various
operations. Here are some examples of their usage:
• Arithmetic Operations: Boolean functions are used in Arithmetical Logic
Units (ALUs) of CPUs to perform operations like addition, subtraction,
multiplication, and even division.
56
• Data Processing: Boolean functions are used to process binary data in
memory and storage devices, ensuring efficient data manipulation and
retrieval.
• Control Logic: Boolean functions are applied in computers to control various
parts of the system's operation to function in co-ordinated manner.
Class activity
Consider what do you do with your cell phone or calculator on daily basis.
Can you distinguish activities that require logical choices, like entering a
password to unlock your smart phone or solving a math problem? Ask your
group members how Boolean functions may be utilized in the background.
Imagine a simple electronic circuit with an AND gate. If you press two switches
(both must be ON), a light bulb will turn on.
• Switch 1: ON (True)
• Switch 2: ON (True)
• Light bulb: ON (True) because both switches are ON.
If either switch is OFF, the light bulb will be OFF.
OR Gate: Implements the OR function. It outputs true when at least one input
is true.
NOT Gate: Implements the NOT function. It outputs the opposite of the input.
See Figure 3.4
XOR Gate:
The XOR (Exclusive OR) gate outputs true only when exactly one of the inputs is
true. It differs from the OR gate in that it does not output true when both inputs
are true. It is shown in Figure 3.7.
Class activities
Let's make learning these logical functions fun with an activity!
1. AND Adventure: Form pairs and give each pair two conditions they
need to meet to win a prize (like both wearing a specific color shirt).
2. OR Options: Make a list of fun activities. If at least one activity is
possible, the class gets extra playtime.
3. NOT Negatives: Ask true/false questions and have students shout
the opposite answer. For example, "Is the sky green?" Students
should shout "No!" (NOT True).
4. Construct a basic circuit using a breadboard, a battery, and LED
lights to represent an AND gate. Connect two switches which will
serve as, inputs A and B. In this experiment the LED will light up only
when both switches are pressed.
59
3.3 Simplification of Boolean Functions
Simplification of Boolean functions is a particularly important process in
designing an efficient digital circuit. Such simplified functions require fewer
gates making them compact in size, energy efficient and faster than the
complicated ones. Simplification means applying of some Boolean algebra rules
to make the functions less complicated.
Basic Boolean Algebra Rules:
Here are some fundamental Boolean algebra rules used for simplification:
1. Identity Laws
A+0=A
A.1=A
2. Null Laws
A+1=1
A.0=0
3. Idempotent Laws
A+A=A
A.A=A
4. Complement Laws
A+A=1
A.A=0
5. Commutative Laws
A + B = B+A
A.B=B.A
6. Associative Laws
(A + B)+ C = A + (B + C)
(A . B) . C = A . (B . C)
7. Distributive Laws
A . (B + C) = (A . B) + (A . C)
A + (B . C) = ( A + B) . (A + C)
8. Absorption Laws
A + (A . B) = A
A . (A + B) = A
9. De Morgan's Theorems
A+B=A.B
A.B=A+B
10. Double Negation Law
A=A
60
Simplification Examples
Example 1
Simplify the expression A + A • B.
Solution:
A + A • B = (A + A) • (A + B) (Distributive Law)
= 1 • (A + B) (Complement Law)
=A+B (Identity Law)
Example 2
Simplify the expression A • B + A • B.
Solution:
Example 3
Simplify the expression (A + B) • (A + B)
Solution:
Example 4
Simplify the expression A + B • (A + B)
Solution:
61
3.4. Creating Logic Diagrams
The logic diagrams depict the working of a digital circuit through symbols that
represent to its individual logic gates. To create a logic diagram:
• Find out the logic gates needed for the Boolean function.
• Arrange the gates to perform the operations as defined by the function of the
• circuit.
• Connect the inputs and the output of the gates correctly.
To summarize, knowledge of Boolean algebra and logic gates is crucial when it
comes to the creation and study of digital circuits. If students understand those
concepts, they can build efficient and effective digital systems.
3.5. Application of Digital Logic
Digital logic is an essential aspect for the functioning of several modern
electronic systems, such as computers, smart phones, and other digital gadgets.
Digital logic optimize in many ways in order to create and enhance circuits meant
to perform various tasks. Two important applications of digital logic are the
design of adder circuits and the use of Karnaugh maps for function simplification.
3.5.1 Half-adder and Full-adder Circuits
Adder circuits are widely used in the digital circuits to perform arithmetic
calculations. There are two general forms of adder circuits known as half-adders
and full adders.
3.5.1.1 Half-adder Circuits
A half adder is a basic circuitry unit that performs addition of two single-bit
binary digits. It has two inputs, usually denoted as A and B, and two outputs: the
sum (S) and the carry (C).
Truth Table for Half-adder:
A B Sum (S) Carry (C)
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Table 3.6: Truth Table for Half-adder
Boolean Expressions for Half-adder:
S=A ⊕ B
C=A.B
In this case the symbol + represents the XOR operation. The sum output is high
when only one of the inputs is high, while the carry output is high when both
inputs are high. 62
Boolean Expressions:
Sum = A ⊕ B
1 1 1 1 1
Boolean Expressions:
Sum = A⊕B⊕Cin
Carry= (A.B) + (Cin . (A⊕B))
1. Expression: A . B + A . B + A . B
B=0 B=1
A=0 0 1
A=1 1 1
B=0 B=1
A=0 0 1
A=1 1 1
65
From the K-map, we can form the groups:
1. Group of two 1s in the second column : A . B+ A . B
A . B+A . B = (A + A) . B = 1 . B = B
2. Group of two 1s in the second row: A . B + A . B
A . B+A . B = (B + B) . A = 1 . A = A
Final Simplified Expression
F (A, B) = B + A
Practical Usage:
Karnaugh maps are extensively used in digital circuit design to minimize the
number of gates needed for a given function. This leads to circuits that are faster,
cheaper, and consume less power.
Class Activity
Activity: Construct a digital circuit that includes both half-adders and
full-adders to add two 4-bit binary numbers. Create the truth tables,
Boolean expressions, and circuit diagrams for each step.
Summary
• Digital systems are the basis of the present-day electronics and
computing. They process digital data in form of '0' and '1'.
• Analog signals are continuous time varying signal.
• ADC (Analog to Digital Converter) is the process of converting the
continuous signals into discrete signals that can be processed by digital
devices for example computers and smart phones.
• DAC (Digital to Analog Converter) converts the digital signal back to the
analog signal.
• Digital logic is the basis of all digital systems. This is the technique we use
to process digital information in the form of binary numbers.
• Boolean algebra is a sub-discipline of mathematics based on operations
involving binary variables.
• In the case of AND operation the output is 1 only when both input values
are 1. Otherwise, the output is 0.
• In an OR gate, the result is 0 only when both the input values are 0.
Otherwise, the output is 1.
• The NOT operation the simplest logical operation in Boolean algebra,
which accept a single binary inputs and gives its opposite as the outputs.
• Boolean functions are mathematical expressions that represent logical
operations involving binary variables.
• A crucial element of digital circuit design is the logic diagram, which
represents the structure of the circuit by showing connections between
66
logic gates.
• Adder circuits are widely used in the digital electronic systems with the
principal application in arithmetic operations.
• A half-adder is a digital circuit used to compute the addition of two
single-bit binary numbers.
• A full-adder is a more complex circuit that adds three single-bit numbers:
two main bits and a carry bit from a previous addition.
• A Karnaugh map (K-map) is a graphic aid that is employed in simplification
of Boolean expressions and minimizing logic functions without the used
for complex algebraic operations.
• A minterm in Boolean algebra is a specific product (AND) form of a Boolean
expression that includes all of the function's variables, either in their
normal or complemented form.
68
UNIT System
4 Troubleshooting
Student Learning Outcomes
By the end of this chapter, you will be able to:
1. Explain the importance of troubleshooting in maintaining and operating
computer systems effectively.
2. Describe how systematic troubleshooting helps prevent and resolve
computer issues.
3. Demonstrate the ability to systematically troubleshoot computer issues
4. Apply basic troubleshooting techniques, including Restarting a
computer, Identifying and addressing basic software hardware issues.
5. Identify and resolve common computer issues, such as Application
freezing, unresponsive peripherals, Software conflicts and operating
system crashes.
6. Implement strategies for maintaining a safe and organized computer
workspace.
7. Understand the importance of data backups and apply methods for
effective data protection
8. Diagnose and address hardware issues, including hardware failures like
RAM or hard drive issues. Performing component replacements and
upgrades.
9. Recognizing and addressing security threats such as malware infections.
10. Apply best practices for maintaining system security by updating
operating systems, creating and managing strong passwords,
recognizing and addressing malware threats.
11. Use built-in help features and internet resources effectively to
troubleshoot complex issues.
12. Communicate solutions and troubleshooting steps clearly to assist peers
and staff with computer-related problems.
13. Transfer troubleshooting knowledge to help others and collaborate
effectively in solving computer issues.
69
Introduction
System troubleshooting is a vital skill for keeping computers, machines, and
other equipment running smoothly. When things go wrong, troubleshooting
helps identify the problem and find a quick solution, preventing issues like
downtime, reduced productivity, and potential damage. For instance, if your
computer suddenly stops working, knowing how to troubleshoot can help you fix
it without needing costly professional help. This chapter will guide you through a
systematic process of troubleshooting, covering essential steps such as
identifying problems, testing theories, implementing solutions, and ensuring the
system is fully functional again. By mastering these techniques, you'll be able to
maintain the reliability and efficiency of any system you work with.
4.1 System Troubleshooting
Troubleshooting is essential for maintaining the smooth operation of systems,
whether they are computers, machines, or other types of equipment. When
something goes wrong, troubleshooting helps identify the problem and find a
solution quickly. For example, if your computer suddenly stops working, knowing
how to troubleshoot can help you get it running again without needing to call for
expensive professional help.
4.1.1 Systematic Process of Troubleshooting
The troubleshooting process involves several steps that help you systematically
identify and fix problems. These steps ensure that you don't overlook any
potential issues and that you solve the problem efficiently.
A systematic approach to troubleshooting involves the following steps:
1. Identify Problem
2. Establish a Theory of Probable Cause
3. Test the Theory to Determine the Cause
4. Establish a Plan of Action to Resolve the Problem
5. Implement the Solution
6. Verify Full System Functionality
7. Document Findings, Actions, and Outcomes
70
4.1.1.1 Identify Problem
The first step in troubleshooting is to identify the problem. This means
recognizing that something is not working as it should. For example, if you press
power button and your laptop does not turn on, the problem is clear that it won't
start.
4.1.1.2 Establish a Theory of Probable Cause
Once you have identified the problem, the next step is to come up with a theory
about what might be causing it. This involves thinking about what could have
gone wrong. For example, if your laptop does not turn on, possible causes might
be a dead battery, a faulty power cord, or an internal hardware issue.
4.1.1.3 Test the Theory to Determine the Cause
After establishing a theory, you need to test it to see if it is correct. This involves
checking if the suspected cause is actually the reason for the problem. For
example, if you think the laptop's battery is dead, you can test this theory by
plugging in the power cord and seeing if the computer turns on.
4.1.1.4 Establish a Plan of Action to Resolve the Problem
If your test confirms the cause of the problem, the next step is to come up with a
plan to fix it. This means deciding what steps you need to take to resolve the
issue. For example, if the problem is a dead battery, your plan of action might be
to replace the battery or keep the laptop plugged in until you can get a new one.
4.1.1.5 Implement the Solution
Once you have a plan, you need to put it into action. This means doing whatever
is necessary to fix the problem. For example, if your plan is to replace the battery,
you would buy a new battery and install it in your laptop.
4.1.1.6 Verify Full System Functionality
After implementing the solution, you need to check to make sure that the
problem is fully resolved and the system is working properly again. For example,
once you replace the battery, you should check to see if the laptop turns on and
operates as expected without plugging in the power cord.
71
4.1.1.7 Document Findings, Actions, and Outcomes
The final step is to document everything you did during the troubleshooting
process. This includes what the problem was, what you thought was causing it,
what you did to fix it, and the outcome. This documentation is important for
future reference and can help you or others troubleshoot similar problems more
efficiently in the future. For example, you would write down that the laptop
wouldn't turn on due to a dead battery, that you replaced the battery, and that
the laptop is now working properly.
By following the above steps, you can troubleshoot problems systematically and
effectively, ensuring that systems continue to operate smoothly and efficiently.
4.1.2 Importance of Troubleshooting in Computing Systems
Troubleshooting is very important in computing systems because it helps keep
our computers, software, and networks running smoothly. When something
goes wrong with a computer system, it can disrupt our work, cause data loss, or
even lead to security issues. By knowing how to troubleshoot computing
systems, we can quickly find and fix problems, ensuring that everything works as
it should.
4.1.2.1 Preventing Downtime
Downtime occurs when a computer system is not operational. This can be very
costly, especially in businesses that rely on their systems to operate efficiently.
When a system is down, employees may not be able to work, leading to lost
productivity and revenue. With the help of troubleshooting, we identify and
resolve the system problems in very short time which facilitate to reduce the
possibilities of system downtime.
4.1.2.2 Ensuring Data Integrity
Data integrity means ensuring that data is accurate and reliable. Problems like
software bugs or hardware failures can corrupt data, leading to incorrect
information being stored or processed. Troubleshooting helps identify the
source of data corruption and prevent it from happening again, ensuring that
data remains accurate and reliable.
4.1.2.3 Improving Security
Computer systems are often targets for cyber-attacks. Troubleshooting can help
identify vulnerabilities and security breaches, allowing for quick action to protect
the system. This is important for maintaining the confidentiality, integrity, and
availability of data.
4.1.2.4 Enhancing Performance
Sometimes, computer systems do not perform as efficiently as they should.
Troubleshooting can identify the reasons for slow performance, such as
insufficient memory, software conflicts, or hardware malfunctions. By resolving
these issues, you can improve the overall performance of the system.
72
4.1.2.5 Extending Equipment Life
Regular troubleshooting and maintenance can help extend the life of computer
equipment. By identifying and fixing small issues before they become big
problems, you can prevent unnecessary wear and tear on the system.
4.1.2.6 Saving Costs
Real-World Impact: Effective troubleshooting in businesses helps prevent costly
downtime and maintains productivity, showing how important these skills are in
the real world. Effective troubleshooting can save money by reducing the need
for expensive repairs or replacements. By identifying and resolving issues early,
you can avoid costly downtime and prolong the life of your
equipment.
Real-World Impact: Effective troubleshooting in businesses
helps prevent costly downtime and maintains productivity,
showing how important these skills are in the real world.
Example: If a printer is not working properly, troubleshooting might reveal a
simple paper jam that can be fixed easily, rather than needing to replace the
entire printer.
4.1.1.7 Enhancing User Experience
When computer systems work well, users have a better experience. They can
complete their tasks efficiently without encountering frustrating issues.
Troubleshooting helps ensure that systems are reliable and user-friendly.
Example: If an application keeps crashing, troubleshooting can identify if the
problem is due to software bugs or compatibility issues. Fixing the issue can
improve the user experience, making the application more stable and enjoyable
to use.
Troubleshooting is an essential skill in computing systems. It helps prevent
downtime, ensure data integrity, improve security, enhance performance, extend
equipment life, save costs, and provide a better user experience. By
understanding and applying troubleshooting techniques, we can keep our
computing systems running smoothly and efficiently.
Class activity
Activity Task Details:
1. Introduction: Briefly explain the importance of troubleshooting in
computer systems.
2. Discussion: Divide students into small groups and provide each
group with a printed troubleshooting flowchart.
3. Task: Have each group discuss a scenario where a computer is not
turning on. Using the flowchart, they should identify potential
problems and suggest solutions. For example, checking if the power
cable is plugged in and if the power button is functioning.
4. Presentation: Each group presents their findings and solutions to
the class.
73
4.2 Troubleshooting Strategies
Understanding basic troubleshooting strategies for software and hardware
issues can help keep your computing systems running smoothly. By identifying
common problems and knowing simple solutions, you can resolve issues quickly
and efficiently, ensuring minimal disruption to your work or activities.
4.2.1 Basic Software-Related Issues
4.2.1.1 Common Software Issues and Solutions
Issue: Application Freezing - An application freezing means that a program
stops responding and you cannot use it. This is a common problem and can
usually be fixed with a few simple steps:
Solution: Try pressing Ctrl + Alt + Delete to open the Task Manager. Find the
unresponsive application, select it, and click "End Task." This will force the
application to close. If the problem persists, consider reinstalling the application
or checking for updates.
Issue: Unresponsive Peripherals - Peripherals are external devices like
keyboards, mice, and printers. Sometimes, these devices can stop responding
due to software issues.
Solution: First, check the connections to make sure they are secure. If the device
is still unresponsive, try unplugging it and then plugging it back in. Updating the
drivers for the device can also help.
4.2.1.2 Restarting and Shutting Down
Issue: Importance of Restarting a Computer - Restarting a computer can fix
many software issues. It clears the memory, stops background processes, and
gives the system a fresh start.
Issue: Using the Power Button Effectively - The power button can be used to
shut down or restart a computer when it is not responding to normal commands.
Solution: Press and hold the power button for a few seconds to force the
computer to shut down. This should only be used as a last resort because it can
cause data loss if programs are not properly closed.
Cool Tools: Modern troubleshooting involves using special tools like memory
diagnostic apps (e.g., MemTest86) and hard drive health checkers (e.g.,
CrystalDiskInfo). These tools are like having superpowers that can see inside
your computer's brain! problems by following clues and gathering evidence!
75
Issue: Proper Ventilation - Proper ventilation is crucial to prevent overheating
and ensure the computer runs efficiently.
Solution: Place the computer in a well-ventilated area, away from walls and
other obstructions. Regularly clean the vents and fans to remove dust buildup.
Example: Keeping a desktop computer on a desk with good airflow around it can
help prevent overheating and keep it running smoothly.
Class activity
Workspace Management
Objective: Learn how to maintain a safe and organized computer
workspace.
Required Material: Computers, cable ties, labels, ventilated computer
stands.
Activity Type: Individual
Activity Task Details:
1. Introduction: Discuss the importance of a well-organized
workspace for preventing hardware issues.
2. Task: Each student will organize their workspace by managing
cables with ties and labels, and ensuring their computer is properly
ventilated using stands. For example, tying together cables to
prevent them from tangling and ensuring the computer is not
placed in a confined space to prevent overheating.
4.2.3 Hardware Diagnosis and Maintenance
4.2.3.1 Recognizing Hardware Failures
Recognizing hardware failures is necessary for maintaining a computer system's
functionality. Here are some common symptoms and diagnostic techniques of
RAM or Hard Drive Failures:
Issue: RAM Failures - Common signs of RAM issues include frequent system
crashes, Blue Screens Of Death (BSOD), and poor performance. The computer
may also fail to boot or restart randomly.
Solution: RAM Diagnostic Tools - Use built-in tools like Windows Memory
Diagnostic or third-party applications like MemTest86 to check for RAM issues.
76
Issue: Hard Drive Failures - Symptoms of hard drive failures include strange
noises (like clicking), slow performance, frequent crashes, and corrupted files.
The computer may also fail to boot or display error messages about the disk.
Solution: Hard Drive Diagnostic Tools - Use tools like SMART (Self-Monitoring,
Analysis, and Reporting Technology) status checks, or software like
CrystalDiskInfo, to monitor hard drive health.
4.2.3.2 Component Replacements and Upgrades
Upgrading or replacing hardware components can significantly improve your
computer's performance and extend its lifespan.
Upgrading RAM: To upgrade RAM, first determine the type and maximum
capacity your motherboard supports. Purchase compatible RAM sticks, power
off your computer, open the case, and insert the new RAM into the empty slots.
Example: If your computer is slow while multitasking (running multiple
applications at a time), adding more RAM can help improve its performance.
Replacing a Hard Drive: To replace a hard drive, back up your data, purchase a
compatible drive (that can work in your computer), power off your computer,
open the case, disconnect the old drive, and connect the new one. After installing
the new drive, you will need to reinstall the operating system and restore your
data from the backup.
Example: If your hard drive is failing, replacing it with a new one can prevent data
loss and restore your computer's functionality
77
Class activity
Activity : Common Computer Issues
Objective: Recognize and resolve common computer issues.
Required Material: Computers, list of common issues, troubleshooting
guides.
Activity Type: Individual
Activity Task Details:
1. Introduction: Briefly explain common computer issues like
application freezing and unresponsive peripherals.
2. Task: Provide students with a list of common issues and
troubleshooting guides.
Hands-on Practice: Each student will troubleshoot the issues on their
computer and document the steps they took to resolve them. For
example, if the mouse is unresponsive, check the USB connection or
replace the batteries.
Class activity
Activity : Security Practices
Objective: Learn and apply basic security practices.
Required Material: Computers, internet access, security software (e.g.,
antivirus).
Activity Type: Individual
Activity Task Details:
1. Introduction: Discuss common security threats and the
importance of strong passwords and software updates.
2. Task: Each student will create a strong password for their
computer, run a security scan using antivirus software, and update
their operating system. For example, creating a password with a
mix of letters, numbers, and symbols, and using antivirus software
to scan for malware.
Documentation: Students will document the steps they took and the
outcomes.
4.2.4.1 Maintaining Software
Keeping software up to date and resolving a conflict is essential for security and
performance.
Installing Updates and Software Patches: Regularly installing updates and
patches ensures that your software is protected against vulnerabilities and
performs optimally. 78
Example: Updating your operating system and applications can protect your
computer from security threats and fix bugs that cause crashes.
Resolving Software Conflicts: Identify and uninstall conflicting software,
reinstall or update the affected applications, and check for compatibility issues.
Example: If two applications are causing system instability, removing one or
updating both to the latest versions can resolve the conflict.
79
4.2.5 Data Management and Backups
Effective data management and regular backups help in free up resources,
improve efficiency, and ensure data security. Here's how these practices can be
beneficial:
Data Management and Backups mean storing, and organizing data so it is easy
to find and use. It helps make sure the data is available, accurate, and ready when
needed. Regular backups involve making copies of data regularly to ensure it can
be recovered if it is lost, damaged, or during a disaster. These strategies are
necessary for keeping data safe and ensuring it can always be restored.
4.2.5.1 Managing Storage Space
Management of storage space is one of the key requirements for data
management. It is important to keep your computer running smoothly and
efficiently. Here is how you perform it:
Deleting Unnecessary Files: Regularly review your files and delete those you no
longer need. This can include old documents, downloaded files, and temporary
files.
Example: If your computer is running out of space, go through your download
folder and delete files you no longer need. This can free up a significant amount
of space.
Moving Files to Free Up Disk Space: Transfer large files, such as videos and
photos, to an external storage device or cloud storage to free up space on your
computer's internal drive.
Example: Moving a collection of vacation photos to an external hard drive can
free up gigabytes of space on your main drive, improving your computer's
performance.
4.2.5.2 Data Backup Methods
Backing up data is essential to prevent data loss in case of hardware failure or
other issues. Here are some common methods:
Using External Storage Devices: Use external hard drives or USB flash drives to
back up important files. This provides a physical copy of your data that you can
easily access and store safely.
Example: Copying your important documents and photos to an external hard
drive ensures that you have a backup in case your computer's hard drive fails.
Utilizing Cloud Solutions: Use cloud storage services like Google Drive,
80
Dropbox, or OneDrive to back up your data online. This allows you to access your
files from anywhere with an internet connection.
Example: Saving your school projects to Google Drive means you can access
them from any computer, even if your personal device is unavailable or
damaged.
4.2.6 Using Resources for Troubleshooting
When you encounter issues, there are many resources available to help you
troubleshoot effectively.
83
· Assisting Others
o Communication and Collaboration: Clearly explain issues and
collaborate with others for solutions.
o Sharing Troubleshooting Knowledge: Create guides and share
solutions to assist peers.
86
UNIT
Software System
5
Student Learning Outcomes
By the end of this chapter, you will be able to:
1. Identify and explain the significance of system software and application
software.
2. Understand the role and main functions of system software.
3. Explain how operating systems manage hardware resources, provide user
interfaces, and run applications.
4. Describe how utility software enhances system performance, security, and
maintenance.
5. Understand how device drivers facilitate communication between hardware
devices and the operating system.
6. Recognize the main functions of commonly used application software, such
as word processing, spreadsheet, presentation, and graphic design
applications.
7. Discuss the uses and significance of various application software in different
domains (e.g., business, education, graphics design, etc.).
8. Differentiate between system software (e.g., operating systems, utility
software, device drivers) and application software in terms of their roles and
functions.
9. Proficiently use prominent system software including operating systems,
utility software, and device drivers.
10. Navigate the user interface, manage files, and perform system tasks using
operating systems.
11. Utilize utility software and tools for optimizing system performance and
maintaining security. Install, update, and troubleshoot device drivers for
various hardware components
12. Use commonly used application software to perform specific tasks or create
content (e.g., word processing, spreadsheets, presentations).
13. Identify appropriate software tools for specific tasks, taking into account their
functions and capabilities.
14. Use application software for productivity, creativity, and communication
purposes.
15. Demonstrate and differentiate between system software and application
software, understanding their roles within a computer system.
87
Introduction
Software is an integral part of any computing system, acting as the intermediary
between the user and the hardware. In this chapter, we will explore the
significance of system software and application software, understanding their
roles, functions, and applications in various domains. By the end of this chapter,
students will be proficient in identifying, using, and differentiating between
different types of software.
5.1 Software
Software is a collection of programs and instructions that tell a computer what to
do and how to do. Without software, computers would be useless machines.
Class activity
Make a list of all the software you use on your computer or tablet. Categorize
them into system software and application software. Discuss with your
classmates which software you nd most useful and why.
To keep your operating system running smoothly, regularly update it to the latest
version and perform routine maintenance tasks such as disk cleanup and virus scans.
Class activity
Explore the task manager (Windows) or activity monitor (Mac) on your
computer. Identify the different running applications and observe how much
CPU and memory each application is using. Discuss why the operating
system's role in managing these resources is crucial for the computer’s
performance.
91
5.2.2 Utility Programs
Utility programs are essential components of system software that enhance the
functionality of a computer system. They perform various tasks to ensure smooth
operation and efficient management of hardware, software, and data. Here are
some common utility programs along with their functionalities in real-life
scenarios.
98
UNIT Introduction to
6 Computer Networks
Student Learning Outcomes
By the end of this chapter, you will be able to:
• Understand and explain computer networks as systems, their objectives,
components, and data communication among these components.
• Understand fundamental concepts in data communication, including sender,
receiver, protocol, message, and communication medium.
• Understand key concepts related to computer networks, including
networking devices, network topologies, and transmission modes.
• Understand the 5-layer OSI networking model and its related protocols.
• Understand the benefits of using computer networks, such as resource
sharing and data communication.
• Understand how data is transmitted across computer networks, including
packet and circuit switching, and secure communication through
encapsulation.
• Understand how protocols, data, packets, and network services like DNS and
DHCP function in a networked environment.
• Understand different methods of network security, their advantages, and
disadvantages.
• Understand real-world applications of computer networks, including various
network-based services and how they are used.
• Know standard protocols involved in TCP/IP communications.
• Know key networking terms like the 5-layer OSI networking model, packet
switching, circuit switching, router, TCP/IP, IP, UDP, DNS, DHCP, host,
browsers, layering, encapsulation, and various protocols involved in TCP/IP
communications.
• Differentiate between components of data communication.
• Differentiate networking devices and network topologies.
• Differentiate transmission modes.
• Identify and describe different types of networks using the 7-layer OSI
networking model.
• Explain how data is transmitted across networks and describe the standard
protocols involved.
• Define and explain the uses of protocols, data, packets, and network services
like DNS and DHCP.
• Describe different methods of network security and their advantages and
disadvantages.
99
Introduction
In today's interconnected world, computer networks play a vital role in the
functioning of societies and businesses. This chapter aims to provide a
comprehensive understanding of computer networks as systems, including their
components, objectives, and real-world applications.
6.1 Network as a System
A computer network is a system of linked devices and computers that may
exchange data and operate together. Networks can range from small, Local Area
Network (LANs, Local Area Networks) to large area network, WANs, including the
Internet. Networks are arranged of various elements that work together to
facilitate communication depicted in Figure 6.1.
102
Figure 6.3: A network switch connecting multiple devices.
First time, switch forwards or broadcast data to all connected devices. Once it
has learned address of devices, it starts sending data to exact destination.
Did you know that your home router often includes a switch
and a wireless access point? This allows you to connect
multiple devices both wired and wirelessly!
6.3.2 Router
A router is a networking device that interconnects
networks or allows devices to connect to it. It directs
data packets between different networks. Think of it as
a traffic director on the internet, making sure that data
gets from one place to another efficiently. Figure 6.2
illustrates how a mobile internet connection (via SIM
card) integrates with a home network. Alternatively,
an Ethernet cable can be used to obtain internet
access and distribute it among home devices. In
enterprise environments, different types of routers
are employed, as depicted in Figure 6.2. Mobile Wi-Fi Router
Figure 6.2: A typical home router
103
SIM stands for Subscriber Identity Module.
A SIM card is a small card inserted into a mobile device that
contains unique information to identify and authenticate the
subscriber on a mobile network. It allows the device to connect
to the network, make calls, send messages, and access Internet.
Class activity
Human Network Activity: Create a simple network using the students
in the class. Assign roles like computer, router, and data packet. Use
strings to represent Ethernet cables and have students pass a ball
(representing data) along the strings to simulate how a router directs
data.
Class activity
Create a human network with students. Assign roles such as Access Point,
Router, and Devices. Use ropes to represent connections. Show how data
moves from the Access Point to the Router and then to another network.
Bus topology is easy to set up but if the main cable fails, the
whole network goes down!
Class activity
Create a star topology model using strings and paper cups to simulate
the connections between a central switch and peripheral nodes.
106
6.4.3 Ring Topology
In a Ring topology, each device is connected in a
circular pathway with other devices. Data travels
in one direction, passing through each
device.
Example: Consider a relay race where each
runner passes the baton to the next runner in
a circle until it reaches the starting point again.
Ring topology can handle high trafc, but if one connection fails, the whole
network is affected. Then 2-way ring can solve this issue to some extent.
Example: Imagine a city where every house is directly connected to every other
house by roads. If one road is blocked, there are multiple alternative routes.
Class activity
Draw your own network diagram using one of the topologies and
explain how data travels from one device to another.
107
6.5 Transmission Modes
Network communication modes describe how data is transmitted between
devices. There are three primary modes: Simplex, Half-Duplex, and Full-Duplex
as shown in Figure 6.13. Let's explore each mode with examples and real-life
analogies!
6.5.1 Simplex Communication
In Simplex communication, data transmission is unidirectional, meaning it flows
in only one direction. A advice can either send or review data in this
communication.
108
Class activity
Use walkie-talkies or toy telephones to demonstrate Half-Duplex
communication. Let students take turns speaking and listening.
Class activity
Draw a diagram of each communication mode and label the direction of
data flow. Explain your diagrams to the class.
The first message sent over the ARPANET, the precursor to the
internet, was "LO." It was meant to be "LOGIN," but the system
crashed after the first two letters.
109
6.6 The OSI Networking Model
The Open Systems Interconnection (OSI) Model is a framework used to
understand how different networking protocols interact. It has 7 layers, each with
a specific function. Let's explore these layers with examples and relate them to
daily life.
110
Class activity
Draw a simple network with devices and label the physical
connections and data link layer responsibilities.
112
IPv4 addresses are written in four sets of decimal
numbers, each ranging from 0 to 255 (e.g., 192.168.1.1).
114
Encryption
Encryption transforms data into a secure format that can only be read or
understood by authorized parties with the correct decryption key.
Decryption is the process of converting the encrypted data back to its original
form.
Example:
Plain Text: Hello, World!
Encrypted Text (using a simple shift cipher): Khoor, Zruog! where each letter in
the plaintext is replaced by the letter that is 3 positions down the alphabet.
Decryption: Converting "Khoor, Zruog!" back to "Hello, World!" using the same
shift cipher in reverse.
Ciphertext Exchanged Between Countries
Countries often exchange sensitive information securely using encryption. The
encrypted data, known as ciphertext, can only be read by the intended recipient
who has the decryption key. This ensures national security and protects classified
information from being intercepted and read by unauthorized parties.
Class activity
Encrypt a simple message using a shift cipher with a key of 3 (each
letter is shifted by 3 places in the alphabet). Then, exchange messages
with a classmate and decrypt each other's messages.
\
During World War II, the Allies used the Enigma machine to encrypt
their communications. The ability to decrypt German Enigma-
encrypted messages significantly contributed to their victory.
Summary
• A computer network is a system of interconnected computers and devices
that communicate and share resources.
• The primary objectives of computer networks are to enable resource sharing,
data communication, and connectivity between devices.
• Data communication involves the exchange of data between a sender and a
receiver through a communication medium.
• Protocols are sets of rules that govern data communication. Common
protocols include TCP/IP, HTTP, FTP and SMTP.
• A router is a device that connects different networks together and directs
data packets between them.
• When you send data over the internet, it gets broken down into smaller
pieces called packets.
119
• A switch is a network device that connects multiple devices (like computers,
printers, and servers) within a Local Area Network (LAN).
• An Access Point (AP) is a network device that allows wireless devices to
connect to a wired network.
• Network topologies refer to the arrangement of different elements (links,
nodes, etc.) in a computer network.
• In a Bus topology, all devices share a single communication line called a bus.
Each device is connected to this central cable.
• In a Star topology, all devices are connected to a central hub or switch. The
hub acts as a repeater for data flow.
• In a Ring topology, each device is connected to two other devices, forming a
circular data path. Data travels in one direction, passing through each device.
• In a Mesh topology, each device is connected to every other device. This
provides high redundancy and reliability.
• In Simplex communication, data transmission is unidirectional, meaning it
flows in only one direction.
• In Half-Duplex communication, data transmission can occur in both
directions, but not simultaneously.
• In Full-Duplex communication, data transmission can occur in both
directions simultaneously.
• The Open Systems Interconnection (OSI) Model is a framework used to
understand how different networking protocols interact.
• Internet Protocol (IP) addresses are unique identifiers assigned to devices
connected to the Internet. There are two primary versions: IPv4 and IPv6.
• DNS translates domain names to IP addresses, making it easier for users to
access websites.
• DHCP automatically assigns IP addresses to devices on a network, simplifying
network management.
• Network security involves measures to protect data and prevent
unauthorized access to computer networks.
• Encryption transforms data into a secure format that can only be read or
understood by authorized parties with the correct decryption key.
• A PAN is a small network used for communication between personal devices,
such as smartphones, tablets, and laptops, within a short range.
• A LAN is a network that connects computers and devices within a limited
area, such as a home, school, or office building.
• A MAN is a network that spans a city or a large campus, connecting multiple
LANs together.
• A WAN covers a large geographical area, connecting multiple LANs and
MANs. The internet is the largest example of a WAN.
• A CAN is a network that connects multiple LANs within a limited
geographical area, such as a university campus or a business
120
Multiple Choice Questions (MCQs)
1. What is the primary objective of computer networks?
(a) Increase computational power
(b) Enable resource sharing and data communication
(c) Enhance graphic capabilities
(d) Improve software development
2. Which device is used to connect multiple networks and direct data packets
between them?
(a) Switch (b) Hub (c) Router (d) Modem
3. Which layer of the OSI model is responsible for node-to-node data transfer
and error detection?
(a) Physical Layer (b) Data Link Layer
(c) Network Layer (d) Transport Layer
4. What is the function of the Domain Name System (DNS)?
(a) Assign IP addresses dynamically
(b) Translate domain names to IP addresses
(c) Secure data communication
(d) Monitor network traffic
5. Which method of data transmission uses a dedicated communication path?
(a) Packet Switching (b) Circuit Switching
(c) Full-Duplex (d) Half-Duplex
6. What is encapsulation in the context of network communication?
(a) Converting data into a secure format
(b) Wrapping data with protocol information
(c) Monitoring network traffic
(d) Translating domain names to IP addresses
7. Which protocol is used for reliable data transfer in the TCP/IP model?
(a) HTTP (b) FTP (c) TCP (d) UDP
8. What is the main purpose of a firewall in network security?
(a) Convert data into a secure format
(b) Monitor and control network traffic
(c) Assign IP addresses
(d) Translate domain names
9. Which network topology connects all devices to a central hub?
(a) Ring (b) Mesh (c) Bus (d) Star
10. What is a key benefit of using computer networks in businesses?
(a) Increase computational power
121
(b)Enable resource sharing and efficient communication
(c)Enhance graphic capabilities
(d)Improve software development
Short Questions
1. Define data communication and list its key components.
2. Explain the role of routers in a computer network.
3. What are the main functions of the Network Layer in the OSI model?
4. Describe the difference between packet switching and circuit switching.
5. What is the purpose of the Dynamic Host Configuration Protocol (DHCP )?
6. How does encapsulation ensure secure communication in a network?
7. Differentiate between TCP and UDP in terms of data transfer reliability.
8. Explain the importance of encryption in network security.
9. What are the advantages of using a star topology in a network?
10. How do firewalls contribute to network security?
Long Questions
1. Discuss the objectives of computer networks and provide examples of how
they facilitate resource sharing and data communication.
2. In a Simplex communication system, assume data is transmitted at a rate of
500 bits per second (bps). Compute the time to transmit a message if:
(a) it is of 10 kilobits. (b) it is of 10 kilobytes.
3. Describe how data is transmitted across computer networks using packet
switching and circuit switching.
4. Discuss the role and importance of protocols in data communication. Explain
the functions of key protocols such as TCP/IP, HTTP, DNS, and DHCP.
5. Evaluate different methods of network security, including firewalls,
encryption, and antivirus software.
6. Describe real-world applications of computer networks in business,
education, and healthcare.
7. Compare and contrast the different types of network topologies (star, ring,
bus, and mesh).
8. Consider a shift cipher with a shift amount of 4.
(a) Encrypt the message "SECURITY".
(b) Decrypt the message "WMXYVMI".
9. An IPv4 address is a 32-bit number. Calculate the total number of unique IPv4
addresses possible.
(a) Show the calculation for the total number of IPv4 addresses.
(b) How many addresses are left if 10% of the total addresses are
reserved for special purposes?
122
UNIT Computational
7 Thinking
Student Learning Outcomes
By the end of this chapter, you will be able to:
123
Introduction
Introduction Computational thinking is an essential skill that enables individuals
to solve complex problems using methods that align with processes involved in
computer science. This chapter begins by defining computational thinking and
breaking it down into its fundamental components: decomposition, pattern
recognition, abstraction, and algorithms. These components are essential for
simplifying complicated problems, identifying patterns that can lead to
solutions, focusing on relevant details while ignoring unnecessary ones, and
creating step-by-step procedures for solving problems. Understanding these
concepts is not only beneficial for computer scientists but also for anyone
looking to improve their problem-solving skills across various fields.
In addition to defining computational thinking, this chapter explores the
principles that guide it, such as understanding the problem at hand, simplifying it
to make it more manageable, and selecting the best solution design. The chapter
introduces different methods for designing algorithms, including the use of
flowcharts and pseudocode, and explains how to distinguish between these two
approaches. Furthermore, it emphasizes the importance of practicing algorithm
design and evaluation through hands-on activities like LARP (Logic of
Algorithms for Resolution of Problems). Lastly, the chapter covers essential
aspects of error identification and debugging, providing techniques for
recognizing and fixing common errors encountered during the implementation
of algorithms. By mastering these skills, students will be well-equipped to tackle
a wide range of computational problems efficiently and effectively.
7.1 Definition of Computational Thinking
Computational Thinking (CT) is a problem-solving process that involves a set of
skills and techniques to solve complex problems in a way that a can be executed
by a computer. This approach can be used in various fields beyond computer
science, such as biology, mathematics, and even daily life
124
7.1.1 Decomposition
Decomposition is the method of breaking down a complicated problem into
smaller, more convenient components.
Decomposition is an important step in computational thinking. It involves
dividing a complex problem into smaller, manageable tasks. Let's take the
example of building a birdhouse. This task might look tough at first, but if we
break it down, we can handle each part one at a time.
Here's how we can decompose the task of building a birdhouse. Figure 7.1 shows
the decomposed tasks for building a birdhouse.
• Design the Birdhouse: Decide on the size, shape, and design. Sketch a plan
and gather all necessary measurements.
• Gather Materials: List all the materials needed such as wood, nails, paint, and
tools like a hammer and saw.
• Cut the Wood: Measure and cut the wood into the required pieces according
to the design.
• Assemble the Pieces: Follow the plan to assemble the pieces of wood
together to form the structure of the birdhouse.
• Paint and Decorate: Paint the birdhouse and add any decorations to make it
attractive for birds.
• Install the Birdhouse: Find a suitable location and securely install the
birdhouse where birds can easily access it.
7.1.3 Abstraction
Abstraction is a fundamental concept in problem solving, especially in computer
science. It involves simplifying complex problems by breaking them down into
smaller, more manageable parts, and focusing only on the essential details while
ignoring the unnecessary ones. This helps in understanding, designing, and
solving problems more efficiently.
• Definition: Abstraction is the process of hiding the complex details while
exposing only the necessary parts. It helps reduce complexity by allowing us
to focus on the high-level overview without getting lost in the details.
• Example: Making a Cup of Tea - High-level Steps: 1. Boil water. 2. Add tea
leaves or a tea bag. 3. Steep for a few minutes. 4. Pour into a cup and add
milk/sugar if desired.
When solving complex problems, try to break them down into smaller parts
and focus on the main steps. This will helps you understand the problem
better and find a solution more easily. By using abstraction, we can tackle
complex problems by dealing with them at a higher level.
7.1.3 Algorithms
An algorithm is a step-by-step
collection of instructions to solve a
problem or complete a task similar to
following a recipe to bake a cake..
An algorithm is a precise sequence of
instructions that can be followed to
achieve a specific goal, like a recipe or a
set of directions that tells you exactly
what to do and in what order.
Did you know that algorithms are not just used in computers?
They are everywhere! When you follow directions to your
friend's house or play a board game with rules, you are using
algorithms. Algorithms help us solve problems logically.
Class activity
• Outline an algorithm for applying to the Board of Intermediate and
Secondary Education (BISE) for 9th Grade Examination.
Algorithm Challenge
• Work in pairs to create an algorithm for a common task, such as making
a sandwich or getting ready for school. Write down each step clearly,
then exchange algorithms with another pair. Follow their algorithm
exactly as written and see if you can complete the task.
128
7.2 Principles of Computational Thinking
Computational thinking involves several key principles that guide the process of
problem-solving in a structured manner.
7.2.1 Problem Understanding
Understanding a problem involves identifying the core issue, defining the
requirements, and setting the objectives. Understanding the problem is the first
and most important step in problem-solving, especially in computational
thinking. This involves thoroughly analyzing the problem to identify its key
components and requirements before attempting to find a solution.
“If I had an hour to solve a problem I'd spend 55 minutes thinking about the
problem and 5 minutes thinking about solutions”. — Albert Einstein
Importance of Problem Understanding:
• Clarity and Focus: By fully understanding the problem, you gain clarity on
what needs to be solved. This helps you focus on the right aspects without
getting distracted by irrelevant details.
• Defining Goals: Proper understanding of the problem allows you to define
clear and achievable goals. You can determine what the final outcome should
look like and set specific objectives to reach that outcome.
• Efficient Solutions: When you comprehend the problem well, you can
devise more efficient and effective solutions. You can choose the best
methods and tools to address the problem, saving time and resources.
• Avoiding Mistakes: By thoroughly understanding the problem, you can
avoid common pitfalls and mistakes. Misunderstanding the problem can lead
to incorrect solutions and wasted effort.
Example: Building a School Website
Imagine you are asked to build a website for your school. Before jumping into
coding, you need to understand the problem:
1. Identify Requirements: What features does the website need? For example,
pages for news, events, class schedules, and contact information.
2. User Needs: Who will use the website? Students, teachers, parents?
Understanding your audience helps in designing user-friendly interfaces.
3. Technical Constraints: What resources and tools are available? Do you have
access to a web server and the necessary software?
By understanding these aspects, you can plan and build a website that meets the
needs of your school community.
129
Always take time to thoroughly understand a problem before starting to
solve it. Ask questions, gather information, and clarify any doubts. This
foundational step will lead to better and more effective solutions.
Class activity
Create a flowchart for a daily routine activity, such as getting ready for
school. Include decision points like choosing what to wear based on
the weather.
Example: A Shop Near Your House: Suppose a shop takes orders via cell phone
messages. The flowchart in Figure 7.4 outlines the order processing steps. The
input is the order, and the outputs are item delivery or a notification to the
customer if the item is unavailable.
132
Decisions are made regarding item availability and customer payment. If the
customer does not accept the item or make the payment, the item is returned to
the shop, and the customer rating is decreased by 1. The customer's rating
increases by 1 if they pay for the item. If the item is unavailable, the shop notifies
the customer; otherwise, the shop picks, packs, and ships the item.
Enhancing Flowchart by Using Customer Rating
Note that while the customer rating is included in the flowchart shown in Figure
7.4, it is not utilized. Let's revise the flowchart to ensure only customers with a
rating greater than 0 are attended to. The updated flowchart is shown in Figure
7.5.
133
Class activity
Modify Figure 7.5 to ensure that customer ratings are within the valid
range of 0 to 5, inclusive. Ratings cannot be negative or exceed 5
Class activity
Draw a flowchart for selecting the school cricket team. The team can have
a maximum of 11 players, and each player must have parental permission.
7.3.2 Pseudocode
Pseudocode is a method of representing an algorithm using simple and informal
language that is easy to understand. It combines the structure of programming
134
clearity with the readability of plain English, making it a useful tool for planning
and explaining algorithms.
What is Pseudocode?
Pseudocode is not actual code that can be run on a computer, but rather a way to
describe the steps of an algorithm in a manner that is easy to follow. It helps
programmers and students focus on the logic of the algorithm without worrying
about the syntax of a specific programming language.
Example-1
Determining whether a number is even or odd is a fundamental task in
programming and computer science. An even number is divisible by 2 without
any remainder, whereas an odd number has a remainder of 1 when divided by 2.
Below is the pseudocode for this process, followed by an explanation.
Algorithm 1 Pseudocode for determining if a number is even or odd.
1: Procedure CheckEvenOdd(number)
2: Input: number {The number to be checked}
3: Output: "Even" if number is even, "Odd" if number is odd
4: Begin
5: if (number % 2 == 0) then
6: print "Even"
7: else
8: print "Odd"
9: End if
10: End
Explanation
1. Procedure Declaration: The pseudocode begins with the declaration of the
procedure 'CheckEvenOdd' which takes a single input, 'number'.
2. Input: The procedure accepts a variable 'number' which is the integer to be
checked.
3. Output: The procedure outputs "Even" if the number is even, and "Odd" if the
number is odd.
4. Begin: Mark the start of the procedure.
5. Condition Check: The condition 'if (number % 2 == 0)' checks if the
remainder of the number when divided by 2 is zero. The modulo operator '%'
is used for this purpose.
6. Even Case: If the condition is true, the procedure prints "Even".
7. Odd Case: If the condition is false, the procedure prints "Odd".
8. End: Marks the end of the procedure.
135
Example-2
Determining whether a number is prime is a fundamental task in number theory
and computer science. A prime number is a natural number greater than 1 that
has no positive divisors other than 1 and itself. Below is the pseudocode for this
process, followed by an explanation.
Algorithm 2 Pseudocode for determining if a number is prime.
1: Procedure Is Prime(number)
2: Input: number {The number to be checked}
3: Output: True if number is prime, False otherwise
4: Begin
5: if (number <= 1) then
6: return False
7: end if
8: for i from 2 to sqrt(number) do
9: if (number % i == 0) then
10: return False
11: end if
12: end for
13: return True
14: End
Explanation
1. Procedure Declaration: The pseudocode begins with the declaration of the
procedure 'IsPrime' which takes a single input, 'number'.
2. Input: The procedure accepts a variable 'number', the integer to be checked.
3. Output: The procedure will output 'True' if the number is prime, and 'False'
otherwise.
4. Begin: Mark the start of the procedure.
5. Initial Check: The condition 'if (number <= 1)' checks if the number is less
than or equal to 1. If true, the procedure returns 'False' because numbers less
than or equal to 1 are not prime.
6. Loop Through Possible Divisors: The 'for' loop iterates from 2 to the square
root of the integer. This is because a greater factor of the number is a multiple
of a previously tested smaller factor.
7. Divisibility Check: Inside the loop, the condition 'if (number % i == 0)'
136
checks if the number is divisible by 'i' without a remainder. If true, the
procedure returns 'False' because the number has a divisor other than 1 and
itself.
8. Prime Confirmation: If no divisors are found in the loop, the procedure
returns 'True', confirming the number is prime.
9. End: Marks the end of the procedure.
Class activity
Create Your Own Pseudocode: Divide the students into small groups and
assign each group a different simple problem, such as finding the
maximum number in a list or calculating the factorial of a number. Ask
them to write the pseudocode for their assigned problem and then
present it to the class.
137
Pseudocode Flowcharts
· Pseudocode uses plain language · Flowcharts use graphical symbols
and structured format to describe and arrows to represent the flow
the steps of an algorithm. of an algorithm.
· It is read like a story, with each · It is like watching a movie, where
step is written out sequentially. each symbol (such as rectangles,
· Pseudocode communicates the diamonds, and ovals) represents
steps in a detailed, narrative -like a different type of action or
format. decision, and arrows indicate the
· It is particularly useful for connection and direction of the flow.
documenting algorithms in a way · Flowchart c ommunicates the
that can be easily converted into process in a visual format, which
actual code in any programming can be more intuitive for
language. understanding the overall flow
and structure.
· They are useful for identifying the
steps and decisions in an
algorithm at a glance.
Example-3
Algorithm 3 presents the pseudocode for checking a valid username and
password.
1. Procedure CheckCredentials(username, password)
2. Input: username, password
3. Output: Validity message
4. Begin
5. validUsername = "user123" {Replace with the actual valid username}
6. validPassword = "pass123" {Replace with the actual valid password}
7. if (username == validUsername) then
138
8: if (password == validPassword) then
9: print "Login successful"
10: else
11: print "Invalid password"
12: end if
13: else
14: print "Invalid username"
15: end if
16: End
139
Class activity
Think of a simple task, like finding the largest number in a list. Write
down the steps you would take to complete this task. Now, imagine the
list has 10 numbers, then 100 numbers. How do the steps change?
Some algorithms can perform the same task much faster than
others. For example, sorting a list of 100 items might take one
algorithm 1 second and another algorithm 10 seconds!
output Max
End
Figure 7.8: Flowchart for finding
maximum of two numbers
141
• Dry running your code or algorithm helps catching errors
early in the development process, saving time and effort.
• Many professional programmers and computer scientists
use dry running as a debugging technique to ensure their
algorithms work correctly!
7.5.3 Simulation
Simulation is we use of computer programs to create a model of a real-world
process or system. This helps us understand how things work by testing different
ideas or algorithms without needing to try them out in real life.
Why Use Simulation?
1. Testing Algorithms: We can use simulation to see how well an algorithm
works with different types of data. For example, if we want to test a new way
to sort numbers, we can simulate it with different sets of numbers to see how
fast it is.
2. Exploring Scenarios: Simulation allows us to create many different
situations to see what happens. For example, in a science experiment about
plant growth, we can simulate different amounts of water or sunlight to find
out which conditions help plants grow best.
Benefits of Simulation
• Cost-Effective: It is often cheaper and faster to run simulations than to
conduct real experiments.
• Safe: We can test dangerous situations, like a fire in a building, without
putting anyone at risk.
• Repeatable: We can run the same simulation multiple times with different
settings to observe how things change.
Examples of Simulation
1. Weather Forecasting: Meteorologists use simulations to predict the
weather. They input data about temperature, humidity, and wind speed into a
computer model to see how the weather might change over the next few
days.
2. Traffic Flow: City planners can simulate traffic to see how changes to roads or
traffic lights might affect the flow of cars. This helps them design better roads
and reduce traffic jams.
142
7.6 Introduction to LARP (Logic of Algorithms for Resolution of
Problems)
LARP stands for Logic of Algorithms for resolution of Problems. It is a fun and
interactive way to learn how algorithms work by actually running them and
seeing the results. Think of it as a playground where you can experiment with
different algorithms and understand how they process data.
143
Figure 7.9: LARP Software
START
WRITE "Enter a number"
READ number
IF number % 2 == 0 THEN
WRITE "The number is even"
ELSE
WRITE "The number is odd"
ENDIF
END
7.6.3 Drawing Flowcharts in LARP
Drawing flowcharts in LARP involves visually representing the algorithm's steps
using standard flowchart symbols such as rectangles for processes, diamonds for
decisions, and parallelograms for input/output operations. Once the flowchart is
created, it can be executed in LARP by translating the flowchart into LARP syntax,
which uses straightforward commands like START, WRITE, READ, IF...THEN...ELSE,
and END. This process allows students to visualize the logic of their algorithm
144
and see its step-by-step execution. For example, Figure 7.9 shows a flowchart for
determining whether a student's grade is above 'A' or not. We can execute the
flowchart to verify its correctness. This hands-on approach reinforces
understanding of how a flowchart works.
7.7 Error Identification and Debugging
When we write algorithms or create flowcharts in LARP, we sometimes make
mistakes called errors or bugs. These mistakes can prevent our algorithms from
functioning correctly. Error handling and debugging are processes that help us
find and fix these errors.
Syntax errors are the easiest to find because the LARP tool
usually points them out. However, logical errors are the
hardest to find because the algorithm still runs but does not
procedure correct answers.
Always read error messages carefully. They often tell you exactly where
the problem is.
146
Class activity
Create a simple flowchart in LARP that calculates the average of three
numbers. Introduce a syntax error, a runtime error, and a logical error in
your flowchart. Then, try to fix them using the debugging techniques we
discussed.
Summary
· Computational thinking is important skill that enables individuals to solve
complex problems using methods that mirror the processes involved in
computer science.
· Decomposition is the process of breaking down a complex problem into
smaller, more manageable parts.
· Pattern recognition involves looking for similarities or patterns among
and within problems.
· Abstraction involves simplifying complex problems by breaking them
down into smaller, more manageable part, and focusing only on the
essential details while ignoring the unnecessary ones.
· An algorithm is a step-by-step set of instructions to solve a problem or
complete a task.
· Understanding the problem is the first and most important step in
problem-solving, especially in computational thinking.
· Simplifying a problem involves breaking it down into smaller, more
manageable sub-problems.
· Choosing the best solution involves evaluating different approaches and
selecting the most efficient one.
· Flowcharts are visual representations of the steps in a process or system,
depicted using different symbols connected by arrows.
· Pseudocode is a way of representing an algorithm using simple and
informal language that is easy to understand. It combines the structure of
programming languages with the readability of plain English, making it a
useful tool for planning and explaining algorithms.
· Time Complexity is a way to measure how fast or slow an algorithm
performs. It tells us how the running time of an algorithm changes as the
147
size of the input increases.
· Space complexity measures the amount of memory an algorithm uses in
relation to the input size. It is important to consider both the memory
needed for the input and any additional memory used by the algorithm.
· A dry run involves manually going through the algorithm with sample
data to identify any errors.
· Simulation is when we use computer programs to create a model of a real-
world process or system.
· LARP stands for logic of Algorithm for Resolution of Problems. It is a fun
and interactive way to learn how algorithms work by actually running
them and seeing the results.
· Debugging is the process of finding and fixing errors in an algorithm or
flowchart.
150
UNIT Web Development with
8 HTML, CSS, and JavaScript
Student Learning Outcomes
By the end of this chapter, you will be able to:
• Understand JavaScript syntax and data types.
• Work with variables, operators, and functions in JavaScript.
• Handle events and user input with JavaScript.
• Create simple programs using JavaScript.
• Create HTML forms and style them.
• Use JavaScript to handle events with operators, variables, and
functions.
• Develop static web pages.
• Apply HTML tags appropriately to create web pages.
• Create a basic HTML page.
• Add text, images, and links to a page.
• Create lists and tables.
• Apply styles to HTML elements.
• Work with fonts, colors, and backgrounds.
• Create web pages to display data in the paragraphs and lists.
• Familiarize students with CSS syntax.
• Create layouts with CSS.
• Add animations and transitions with CSS.
• Develop, test, and debug static web pages.
• Organize images and text effectively.
• Use JavaScript along with HTML to handle events using operators,
variables, and functions.
151
Introduction
In this chapter, the fundamentals of web development, Hyper Text Markup
Language (HTML), JavaScript and Cascading Style Sheet (CSS) will be explained.
By the end of this chapter, you will be able to understand JavaScript syntax and
data types, work with variables, operators, and functions, handle events and user
inputs, create simple programs, and develop static web pages using HTML and
CSS.
8.1 Web Development
Process of creating websites and web applications is called Web development. It
means using various programming languages and tools to design, build, and
maintain websites.
8.1.1 Why Learn Web Development?
Web development is a valuable skill for several reasons:
• Digital Literacy: When you learn web development, you find out how
websites are made. You learn about HTML, which is like the skeleton of a web
page, CSS, which makes the web page look nice, and JavaScript, which makes
the web page interactive. This helps you understand how the internet works.
• Career Opportunities: Opens up a wide range of job prospects in the
growing IT industry. Web developers can get many different kinds of jobs.
You can become a web developer, web designer, and more. Many companies
need web developers to create and maintain their websites. This means you
can find good jobs in many places.
• Problem-Solving: When you build a website, you solve many problems. For
example, if a website is slow, you figure out why and fix it. This helps you think
logically and solve problems better.
• Creativity: Allows you to create visually appealing and interactive websites.
Web development lets you be creative. You can design websites with cool
layouts, colors, and interactive features. For example, you can create a
personal blog or a portfolio to show your artwork, making your own unique
website.
• Entrepreneurship: With web development skills, you can start your own
online business. For example, if you make crafts, you can build a website to
sell them. Or, you can create a new web service, like a fun app, and share it
with the world.
154
Figure 8.3: LEGO Pieces
8.3.1 History of HTML
HTML was created by Tim Berners-Lee in 1991. It was designed to make sharing
of information on the internet easy. Over the years, HTML has gone through
many changes and improvements to make it more powerful and easier to use.
• HTML 1.0 (1991): The very first version of HTML. It was simple and had basic
features to create text and links.
• HTML 2.0 (1995): Introduced more tags and features, allowing for creating
more complex web pages.
• HTML 3.2 (1997): Added new tags for creating tables, scripts, and applets.
• HTML 4.0 (1997): Brought major improvements, including support for
multimedia elements like images and videos.
• HTML 4.01 (1999): Minor improvements in version 4.0
• HTML5 (2014): The latest version of HTML. It includes new elements for
better multimedia support, graphics, and more interactive web pages.
8.3.2 Setting up a Development Environment
To start creating websites, you need a few basic tools and environments:
• Text Editor: This is where you write your HTML code. Popular text editors
include Notepad++, Sublime Text, and Visual Studio Code.
• Web Browser: You will use this to view and test your HTML files. Common
web browsers are Google Chrome, Mozilla Firefox, and Microsoft Edge.
Start with a simple text editor and a web browser. Once you are comfortable with
HTML, you can explore more advanced tools.
Start with a simple text editor and a web browser. Once you are
comfortable with HTML, you can explore more advanced tools.
155
Figure 8.4: Fundamentals of website development environment
156
8.3.3.2 Viewing the HTML File
1. Open Your Web browser (Google Chrome, Mozilla Firefox, and others).
2. Double-click on your file named My_first_website.html.
3. You should see the text welcome to my website displayed on the web page as
shown in Figure 8.5.
When saving your HTML files, always remember to add the .html extension at
the end of your file name. This helps your computer recognize it as a web
page. If you are using Notepad, make sure to select "All Files" in the "Save as
type" dropdown, then type your file name followed by .html (e.g.,
hello_world.html).
If you make any changes to the HTML file, refresh the web
page in your browser to see the updated content.
157
8.4 HTML Basic Structure
A structured HTML document is easier to read and understand. Properly nested
and well-organized elements help developers and browsers interpret the
content correctly. This organization ensures that the web page displays as
intended.
Every HTML document has a basic structure where:
• <!DOCTYPE html>: This line tells the browser that this is an HTML5
document.
• <html>: This is the root element of an HTML page.
• <head>: This section contains meta-information about the HTML document,
like the title.
• <title>: This sets the title of the web page, which appears in the browser tab.
• <body>: This section contains the content of the web page that you see in the
browser.
• <h1>: This defines a large heading.
• <p>: This defines a paragraph.
8.4.1 HTML Tags
Elements that make up an HTML document are called tags. A web page's
structure and content are defined by them. On the basis of structure, HTML Tags
are categorized into two types:
1. Paired tags: Comes in pairs an opening Tag and closing Tag i.e <p> .....</p>.
2. Unpaired Tags: Do not need closing Tags. They are also known as self-closing
Tags i.e., <img>, <br>.
8.5 Creating Content with HTML
Content in HTML is the main information on a web page that users read and
interact with. It includes text, images, videos, links, and other elements that
convey the purpose and message of the page. This makes it easier for people to
find your site.
8.5.1 Headings
Headings in HTML, ranging from <h1> to <h6>, are used to define the structure
and hierarchy of content on a web page. Here's why they are important:
Importance of Headings
1. Organizing Content Headings helps organize the content into sections
and subsections, making it easier for users to read and understand. <h1> is
typically used for the main title of the page, while <h2> to <h6> are used for
subheadings in decreasing order of importance.
158
2. Search Engine Optimization (SEO): Search engines use headings to
understand the structure and main topics of a web page. Proper use of headings
can improve the page's SEO, helping it rank higher in search results.
3. Consistent Formatting: Using standard heading tags ensures consistent
formatting across different browsers and devices.
8.5.1.1 Example
Here is an example of how different heading levels can be used to organize
content in a hierarchical structure:
<!DOCTYPE html>
<html>
<head>
<title>Importance of Headings in HTML</title>
</head>
<body>
<h1>Main Title (h1)</h1>
<p>This is the main title of the page.</p>
<h2>Subheading 1 (h2)</h2>
<p>This is a subheading under the main title.</p>
<h3>Subheading 2 (h3)</h3>
<p>This is a subheading under Subheading 1.</p>
</body>
</html> Output
159
8.5.2 Paragraphs
Paragraphs in HTML are used to organize and separate text into readable
sections. Each paragraph creates a block of text with space above and below it,
making the content easier to read. Paragraphs starts with the <p> tag and it
ends with <\p>
8.5.3 Links
Links in HTML are used to connect one web page to another. They allow you to
click on words or images to go to different parts of the same web page or to other
web pages on the internet.
Links are created using the <a> tag.
<a href= " http s : / /www. example .com" > V i s i t Example.com< / a>
<a href=" mailto : example @ example .com">Send Email</ a>
Sometimes, links in HTML can also let you click to send an email. These special
links start with mailto: and when you click them, they open your email program
so you can send a message to the email address in the link.
8.5.4 Images
Images are important in HTML because they make web pages more attractive
and engaging. Additionally, using images helps with branding, as logos and
specific visuals make it easier for users to recognize a brand. Lastly, including
alternate text for images ensures that visually impaired users can understand
what the images represent.
Images are added using the <img> tag.
<img src=" image . jpg " alt="A description II of the I___Iimage ">”
8.5.5 Lists
Lists improve readability by breaking complex ideas into simpler parts, allowing
users to scan for details easily. Overall, lists make the content more organized
and accessible for everyone. You can create ordered (numbered) and unordered
(bulleted) lists.
8.5.5.1 Unordered List
</ ul>
160
8.5.5.2 Ordered List
<ol>
<li >First item</ li> Result
<l i >Second item</ li>
<l >3rd item</ li>
</ ol>
8.5.6 Creating Tables in HTML
Tables in HTML are used to display data in a structured format, allowing for easy
comparison and organization of information. A table is created using the
<table> tag, which contains rows defined by <tr> (table row) tags, and each row
consists of cells represented by <td> (table data) tags. Additionally, headings for
the table can be added using <th> (table header) tags to provide context for the
data.
Example:
<table> Output
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Alice</td>
<td>14</td>
</tr>
<tr>
<td>Bob</td>
<td>15</td>
</tr>
</table>
8.5.7 HTML Comments
In HTML, comments can be extremely useful for:
• Explaining the purpose of a specific section of code
• Leaving reminders for future edits
• Temporarily disabling code for testing purposes
Syntax of HTML Comments
HTML comments begin with <!-- and end with -->. Any text placed within these
markers will be treated as a comment and will not be rendered by the browser.
<!-- This is a comment --> 161
8.6 Styling with CSS
Styling with Cascading Style Sheets (CSS) is very important for improving the
visual appearance of webpages and improving user experience. CSS allows web
developers to control the colors, fonts, layout, and overall design of HTML
elements, separating the content from the presentation. CSS offers various
properties and selectors to apply styles to specific elements, enabling responsive
design that automatically adjusts to different screen sizes and devices.
8.6.1 Basic Structure of CSS
The basic structure of CSS is essential for applying styles to HTML elements
effectively. CSS is composed of rules that consist of selectors and declarations.
Selectors specify which HTML elements the styles will apply to, while declarations
define the specific styles to be applied, including properties and their
corresponding values. A typical CSS rule follows this format:
selector { property: value;
}
For example, a simple CSS rule can changes
the color and size of all headings on a web
page:
h1 {
color: red;
font-size: 24px;
}
In this example, the CSS rule targets all
'<h1>' elements, setting their text color to red and font size to 24 pixels.
8.6.2 Integrating CSS in HTML
Integrating CSS with HTML is essential for
styling web pages and it can be done in
three primary ways: inline, internal, and
external styles.
1. Inline Styles: This method involves
adding CSS directly to individual HTML
elements using the style attribute. For
example, <h1 style="color: blue;">Hello World</h1> changes the color of
the heading to blue. While easy for quick changes, inline styles can make the
code cluttered and less maintainable.
2. Internal Styles: CSS can also be included in the <head> section of an HTML
document using the <style> tag. This method allows you to define styles for
the entire page without affecting others.
162
For instance:
<style> h1 {
color: yellow;
}
</style>
3. External Styles: The most efficient method for larger projects is to use an
external CSS file, which is linked to the HTML document with the <link> tag in the
<head> section. This keeps the HTML clean and allows for easy updates across
multiple pages.
For example:
<link rel="stylesheet" href="styles.css">
By integrating CSS in these ways, developers can create visually appealing and
well-organized web pages that enhance user experience.
8.6.4 Styling HTML Elements with Fonts, Colors, Backgrounds Styling Fonts
You can change the appearance of text on a web page using CSS. This includes
changing the font family, size, weight, and style.
You can use different fonts by specifying their names in CSS. For
example, you can set the font to Arial or Times New Roman.
Example of Styling Fonts
Here is how you can style the font of a paragraph:
P{
font-family: Arial, sans-serif;
font-size: 16px;
font-weight: bold;
font-style: italic;
}
In this example:
• font-family: Arial, sans-serif; sets the font to Arial. If Arial is not available, it
will use a generic sans-serif font.
• font-size: 16px; sets the font size to 16 pixels.
• font-weight: bold; makes the text bold.
• font-style: italic; makes the text italic.
8.6.3.1 Styling Backgrounds
CSS is a language used to style web pages. One of the fun that you can do with
CSS is to change the background of a web page or elements on it. Here are a few
163
ways you can style backgrounds of a web page with CSS:
• Background Color: You can change the background color of a web page or
any HTML element using the background-color property. For example, if you
want a blue background, you can write:
body { background-color: blue;
}
• Background Image: You can set an image as the background of a web page
using the background-image property. For example, font family issue as the
background, you can write:
body {
background-image: url(“your-image.jpg”);
}
• Background Repeat: Sometimes, the background image is small, and you
want it to repeat across the page. You can use the background-repeat
property to do this. For example:
body {
background-image: url(“your-image.jpg”); background-repeat: repeat;
}
• Background Position: You can position the background image exactly
where you want it using the background-position property. For example, to
center the image, you can write:
body {
background-image: url(“your-image.jpg”); background-position: center;
}
• Background Size: You can control the size of the background image using
the background-size property. For example, to cover the entire page with the
background image, you can write:
body {
background-image: url(“your-image.jpg”); background-size: cover;
}
Using these properties, you can create colorful and appealing backgrounds for
web pages.
8.6.4 Creating Layouts and Organizing Content
Creating layouts and organizing content on a web page is an important part of
web design. CSS helps you arrange different parts of your web page in an
organized way. Here are some basic methods to create layouts and organize
content:
• Divs and Sections: HTML elements like <div> and <section> are used to
group content together. You can then use CSS to style and position them.
164
For example:
<div class="container">
<section class="header">This is the header</section>
<section class="content">This is the main content</section>
<section class="footer">This is the footer</section>
</div>
• CSS Grid: The CSS Grid Layout is a powerful tool for creating complex layouts. It
allows you to arrange items into rows and columns. For example:
.container {
display: grid;
grid-template-columns: auto auto;
grid-gap: 10px;
}
.item
{ padding: 20px;
background-color: lightgrey;
}
• CSS Flexbox: Flexbox is another layout tool that helps in arranging items in a
flexible and responsive way. It is useful for aligning items in a row or column.
For example:
.container
{ display: flex;
justify-content: space-between;
}
.item
{ padding: 20px;
background-color: lightgrey;
}
• Positioning: CSS positioning properties like position, top, left, right, and
bottom allow you to place elements exactly where you want them on the
webpage. For example:
.box
{ position: absolute;
top: 50px;
left: 100px;
width: 200px;
height: 100px;
background-color: lightblue;
}
• Margins and Padding: Margins and padding are used to create space around
165
and inside elements. Margins create space outside the element, while padding
creates space inside the element.
For example:
.box
{ margin: 20px;
padding: 10px;
background-color: lightgrey;
}
Always test your web page in different browsers to ensure that it looks and
works the same way everywhere. This helps you catch any browser-specific
issues early.
Class activity
In this activity, you will practice creating a basic web page layout
using HTML and CSS. Follow these steps:
1. Create a new HTML file and name it “index.html”.
2. Add the basic structure of an HTML document.
3. Inside the <body> tag, create a <div> with the class name
"container".
4. Inside the <div>, add three sections with class names
"header", "content", and "footer".
5. Link the CSS file to your HTML file using the <link> tag in the
<head> section.
6. Use CSS to style the .container class with a grid layout, and
apply background colors to the .header, .content, and .footer
sections.
7. Test your web page in a browser to see your layout
166
8.6.5 Adding Animations and Transitions Using CSS
CSS animations and transitions can make your web pages more engaging by
adding movement and effects. Let us learn how to use them!
8.6.5.1 Adding Animations
CSS allows you to add animations to your web page to make it more interactive.
Animations can change the way elements look or move over a period of time.
Here are some basic steps to create animations with CSS:
• Define Keyframes: Keyframes are used to specify the start and end points of
an animation, as well as any intermediate steps. For example:
@keyframes example {
from {background-color: red;} to {background-color: yellow;}
}
This keyframe animation changes the background color from red to yellow.
• Apply the Animation: To apply the animation to an element, use the animation
property.
For example:
.animated-box
{ width: 100px;
height: 100px;
background-color: red;
animation-name: example;
animation-duration: 4s;
}
This will change the background color of the box change from red to yellow for
four seconds.
• Loop and Timing: You can also set how many times the animation should
repeat and its timing function. For example:
.animated-box {
animation-iteration-count: infinite; /* Animation will repeat forever */-animation-
timing-function: linear; * /Animation will progress at a constant speed */
}
8.6.5.2 Adding Transitions
CSS allows you to add transitions to a web page to make changes between styles
smooth and visually appealing. Transitions can change properties like color, size,
or position gradually, instead of instantly. Here are some basic steps to create
transitions with CSS:
• Set the Initial Style: First, define the initial style for the element you want to
animate. For example:
.box {
167
width: 100px;
height: 100px;
background-color: red;
transition: background-color 2s, width 2s;
}
This sets the initial size and color of the box, and specifies that changes to the
background color and width should transition over 2 seconds.
• Define the Hover State: Next, define the styles for the element when it is
hovered over. For example:
.box:hover {
background-color: yellow; width: 200px;
}
This will change the background color to yellow and double the width of the box
when the mouse hovers over it.
168
JavaScript was created in just 10 days by Brendan Eich in 1995. It
was initially called Mocha, then LiveScript, and finally JavaScript.
Class activity
Activity: Displaying an Alert
1. Open a text editor (e.g., Notepad).
2. Write the HTML and JavaScript code as shown above.
3. Save the file as “index.html”.
4. Open the file in a web browser to see the alert message.
169
8.7.1 Variables and Data Types
In JavaScript, you can store data using variables. A variable is like a container that
holds information which can be used and manipulated in your code.
8.7.1.1 Declaring Variables
To declare a variable in JavaScript, you use the var, let, or const keyword. Here's
an example using var:
<script>
var name = "Athar";
var age = 15;
alert("Name: " + name +," Age: " + age);
</script>
8.7.1.2 Dry Run Example
Let's dry-run the above script to understand how it works step-by-step:
1. Declare variables: name = "Athar"; and age = 15;
2. Display alert: alert("Name: " + name + ", Age: "+ age);
This will result in an alert box showing: Name: Athar, Age: 15.
8.7.1.3 Data Types
Variables can store different types of data. Here are some common data types in
JavaScript:
String:
A sequence of characters used for text.
var name = "Athar"; // String
Number:
Represents both integer and floating-point numbers.
var age = 15; // Number
Boolean:
Represents true or false values.
var isStudent = true; // Boolean
Array:
A collection of values stored in a single variable. var scores = [90, 85, 88]; // Array
Always use quotes for strings and no quotes for numbers and booleans.
170
Class activity
Create your own variables with different data types. For example, create a
variable for your favorite color, your current grade, or whether you like
coding.
Use descriptive names for your functions to make your code easier to
understand.
8.7.4 Creating Interactive Elements
In this section, we will learn how to make web pages interactive by developing
simple programs and forms. We will also learn how to integrate JavaScript with
HTML to add interactive functionality.
8.7.4.1 Developing Simple Programs and Forms
Forms allow users to input data, which can be processed using JavaScript. Here is
an example of a simple form that takes a user's name and displays a greeting
message.
Example: Simple Form
Create an “index.html” file with the following content:
<!DOCTYPE html>
<html>
<head>
<title>Interactive Form</title>
<script>
function greetUser() {
173
var name = document.getElementById('name').value;
alert("Hello, " + name + "!");
}
</script>
</head>
<body>
<h1>Welcome!</h1>
<form>
<label for="name">Enter
your name:</label>
<input type="text"
id="name" name="name">
<button type="button" onclick="greetUser()">Submit</button>
</form>
</body>
</html>
In this example:
• The form element contains an input field for the user to enter their name and
a button to submit the form.
• The onclick attribute of the button calls the greetuser () function when the
button is clicked.
• The greetuser () function gets the value of the input field and displays an alert
with a greeting message.
8.7.4.2 Integrating JavaScript with HTML for Interactive Functionality
JavaScript can be used to add interactive functionality to HTML elements. Let's
create a simple program that changes the background color of the page when a
button is clicked.
Example: Changing Background Color
Add the following content to your index.html file:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Change Background Color</title>
174
<script src="script.js"></script>
</head>
<body>
<h1>Welcome to the Color Changer!</h1>
<button onclick="changeColor()">Change Background Color</button>
</body>
</html>
Add the following content to your script.js file:
function changeColor() {
document.body.style.backgroundColor = “lightblue”;
}
You can use JavaScript to change any CSS property of an
HTML element, such as color, font-size, or visibility.
Class activity
Create a button that hides an element on the page when clicked.
Experiment with different JavaScript functions and HTML elements.
By combining JavaScript with HTML, you can create interactive and dynamic web
pages that respond to user input and actions. Keep practicing to discover more
ways to make your web pages engaging and interactive.
8.8 Developing and Debugging
Testing and debugging are important steps in web development. They help you
find and fix errors in your code to ensure your web pages work correctly.
8.8.1 Debugging Techniques
Debugging is the process of finding and fixing issues in your code. Here are some
common debugging techniques:
1. Using Browser Developer Tools
Most web browsers have built-in developer tools that help you debug your code.
For example, you can use the console to see error messages and set break points
to pause your code and examine its behavior.
<script>
console.log(“This is a debug message”);
var x = 10;
console.log(“The value of x is: “ + x);
175
</script>
2. Reading Error Messages
When something goes wrong, your browser will usually display an error
message. Reading these messages carefully can help you understand what went
wrong and how to fix it.
3. Checking Your Code
Go through your code line by line to check for common issues like missing
semicolons, unmatched braces, or incorrect variable names.
8.8.2 Identifying and Fixing Common Issues
Here are some common issues in web development and how to fix them:
1. Broken Links
Make sure all your links point to the correct URLs. Double-check the paths to
your files.
2. Incorrect HTML Structure
Ensure your HTML tags are properly nested and closed.
3. CSS Issues
Verify that your CSS selectors are correct and that there are no typos in your
styles.
8.8.3 Deploying and Testing
After developing your web page, it's important to test it across different browsers
and devices to make sure it works for all users.
8.8.3.1 Strategies for Testing Web Pages
1. Cross-Browser Testing
Web pages can look different in different browsers. Test your web page in
multiple browsers like Chrome, Firefox, and Edge to ensure consistency.
2. Responsive Design Testing
Make sure your web page looks good on all devices, including desktops, tablets,
and smartphones. Use tools like the browser's responsive design mode to test
how your page looks on different screen sizes.
3. User Testing
Ask your friends or family members to use your web page and provide feedback.
They may find issues that you missed.
You can use the browser's inspector tool to see how your CSS is
applied to elements.
176
Summary
• Web development is the process of creating websites and web applications. It
involves using various programming languages and tools to design, build,
and maintain websites.
• Front-end Development focuses on what users see and interact with on a
website.
• Back-end Development manages the behind-the-scenes part of a website,
like servers, databases, and application logic.
• HTML stands for HyperText Markup Language. It's the standard language
used to create web pages. Think of HTML as the building blocks of a website.
• Content in HTML is the main information on a web page that users read and
interact with.
• Headings in HTML, ranging from <h1> to <h6>, are used to define the
structure and hierarchy of content on a web page.
• Paragraphs in HTML are used to organize and separate text into readable
sections.
• Links in HTML are used to connect one web page to another. They allow you
click on words or images to go to different parts of the same page or to other
pages on the internet.
• In HTML, comments are used to insert notes or explanations within the code.
• Styling with CSS (Cascading Style Sheets) is essential for enhancing the visual
appearance of web pages and improving user experience.
• JavaScript is a programming language that is used to make websites
interactive and engaging.
Debugging is the process of finding and fixing issues in your code.
178
UNIT Data Science
9
Student Learning Outcomes
and Data Gathering
By the end of this chapter, you will be able to:
• Understand Data Types: Identify and differentiate between qualitative and
quantitative data, and explain their importance in data analysis.
• Organise and Analyse Data: Organise data effectively and apply basic data
analysis techniques to draw meaningful conclusions from both structured and
unstructured data.
• Utilize Data Collection Methods: Gain knowledge of various data collection
methods and tools, including surveys, questionnaires, and online sources, and
understand how to use these methods to gather relevant data.
• Describe Data Storage Techniques: Describe different data storage techniques
such as spreadsheets, databases, data warehouses, and NoSQL, and
understand their applications in managing data.
• Apply Data Visualization Techniques: Organize the importance of data
visualization and be able to use various tools to create visual representations of
data, such as charts and graphs, to effectively communicate information.
• Pre-process and Analyse Data: Learn data pre-processing techniques and apply
quantitative and qualitative analysis methods to interpret data and generate
insights.
• Utilize Collaborative Tools and Cloud Computing: Understand the role of cloud
storage and collaborative tools in data management, and apply best practices
for data protection and remote access.
• Address Ethical Data Considerations: Be aware of ethical practices related to
data privacy, confidentiality, and legal frameworks, and understand the
importance of secure data handling.
• Explore Data Science Fundamentals: Gain an introduction to data science,
including its definition, scope, and fundamental principles, and understand the
impact of data science on various applications.
• Understand Big Data and Its Applications: Explain the concept of big data, its
characteristics, and its practical applications in domains, such as retail,
healthcare, finance, and transportation.
• Recognize Data Science Tools and Techniques: Learn about various data
science tools and techniques, including predictive modelling and graph
analytics, and understand their applications in solving real-world problems.
• Recognize Future Trends in Data Handling: Identify emerging trends in data
analytics, artificial intelligence, and machine learning, and make informed
predictions about future developments in digital data management and
analysis.
179
Introduction
This chapter explores various aspects of data management and its impact on our
understanding of information. We begin by examining different types of data
and effective ways to collect and store it. You will learn methods for organising
and analysing data, using both quantitative and qualitative techniques. We'll also
look into data visualisation, which helps us understand complex information
through charts and graphs. Next, we will discuss collaborative tools and cloud
computing, along with ethical issues involved in working with data. Finally, we
introduce data science, big data, and future trends in digital data handling,
showing how technology is advancing data analysis to make it more powerful
and insightful.
9.1 Data
Data consists of raw facts collected about things around us that we can process
to generate useful information. It can take many forms, such as numbers, words,
measurements, observations, or even images and sounds, and may originate
from various sources.
Examples:
1. Weather Data: Information on temperature, humidity, and wind speed
collected from weather stations.
2. Sales Data: Records of product sales, quantities, and prices at a store.
For example, selling 50 units of a product at 100 Rupees each in a day.
3. Survey Responses: Answers from a survey about customer satisfaction.
For example, 80% of customers rating their experience as "satisfactory"
or better.
4. Website Data: Information on website visitors, such as number of visitors
per day and the pages they visit. For example, 500 visitors viewing the
homepage on a Monday.
5. Social Media Data: Likes, comments, and shares on social media posts.
For example, a post receiving 200 likes and 50 comments.
Understanding data is essential in today's world, as it allows us to comprehend
situations, make informed decisions, solve problems, and drive innovation.
180
9.2 Data Types
Data can be divided into two broad categories namely qualitative and
quantitative.
9.2.1 Qualitative Data
Qualitative data refer to categories or labels used to describe the qualities or
characteristics of something rather than its quantity. This type of data offer a way
to categorize and provide insights into opinions, behaviours, and experiences
through descriptions rather than numbers. Key characteristics of qualitative
data include non-numeric, descriptive, and categorical attributes.
• Non-Numeric: Qualitative data is represented by words, labels, or symbols
instead of numbers. It describes attributes rather than quantities. Examples
include the names of students in a class (e.g., Ali, Badar, Qasim) and the
colours of cars in a parking lot (e.g., red, blue, green), where “name” and
“colour“are attributes.
• Categorical: Qualitative data can be into categories or classes based on their
characteristics. Examples include types of fruit (e.g., apple, banana, orange),
job titles (e.g., manager, engineer, accountant), and book genres (e.g., fiction,
non-fiction, mystery).
Types of Qualitative data
Qualitative data is further classified into two types namely Nominal and Ordinal
data.
• Nominal Data: Nominal data is used to label or categorize items without
implying any order. Each item is unique and separate. Examples include
gender (male, female), types of fruits (apple, banana, orange), and colours
(red, blue, green). Nominal data is helpful for grouping and categorizing
information. For instance, a survey asking about favourite colours might list
responses such as 'red', 'blue', or 'green', which help indicate preferences
without ranking them. On nominal data, you can check for equality, group
items into categories (e.g., all red fruits together), count items in each
category, and find the most frequent category (mode).
• Ordinal Data: Ordinal data represents categories with a meaningful order,
though the differences between categories are not uniform. Examples
include customer satisfaction ratings (satisfied, neutral, unsatisfied),
education levels (high school, bachelor's, master's), and shirt sizes (small,
medium, large, extra-large). Ordinal data helps in ranking items
meaningfully.
In addition to the operations applicable to nominal data, ordinal data allow for
181
comparisons (e.g., bachelor's level is higher than light school), ranking items
(e.g., from least to most satisfied), finding the median value (e.g., median
satisfaction level), and analysing frequency distribution (e.g., the number of
people at each education level).
Did you know that every day, people generate over 2.5
quintillion bytes of data? That's a 2 followed by 18 zeros! This
data comes from various sources like social media, online
shopping, and sensors in smart devices.
Social Media Data Trends: Social media platforms collect vast amounts of
data about user interactions. For example, Facebook uses this data to
recommend friends and tailor ads based on users’ likes and interests.
183
Aspect Nominal Data Ordinal Data Discrete Data Continuous Data
Labels or categories Categories with a Distinct, separate Values that can take
Definition without a specific meaningful order, but values that are any number within a
order. uneven differences. countable. range.
Categorizes items Measures the extent
Ranks items in a Counts specific items
Purpose without implying or duration of
meaningful order. or occurrences.
rank. something.
Numbers, including
Words, labels, Words, labels, Numbers, whole or
Representation fractions and
symbols. symbols with order. discrete values.
decimals.
Ordered, but
Measurable, can
Non-numeric, differences between Countable, often
Characteristics include fractions or
categorical. categories are not whole numbers.
decimals.
uniform.
Satisfaction ratings
Gender (male, Number of
(satisfied, neutral, Height of students
female); students in a class
unsatisfied); (150.5 cm, 160.2 cm);
Types of fruits (30);
Education levels Weight of fruits
Examples (apple, banana, Number of cars in a
(high school, (1.5 kg, 2.2 kg);
orange); parking lot (15);
bachelor's, master's); Temperature
Colours (red, blue, Number of books
Shirt sizes (small, (22.5°C, 23.7°C).
green). on a shelf (50).
medium, large).
Equality, grouping, Equality, grouping,
Equality, comparison,
Equality, grouping, counting, arithmetic arithmetic
Operations ranking, median,
counting, mode. operations without operations
frequency distribution.
division including division
Mean, median, Mean, median,
Statistical Mode, frequency Median, mode,
range, standard range, standard
Analysis counts. frequency distribution.
deviation. deviation.
Categorizing,
Understanding order Measuring precise
understanding Counting specific
Usage or levels of a amounts, durations,
preferences or occurrences or items.
characteristic. or extents.
attributes.
184
Digital Data Explosion: The amount of digital data created
and consumed globally is so vast that it's predicted to reach
175 Zettabytes by 2025. That's a 1 followed by 21 zeros!
Class activity
Exploring Data Types
Activity Type: Group
Task Details:
Group Formation: Divide the class into small groups. Assign each group a
type of data (Qualitative, Quantitative, Nominal, Ordinal, Discrete,
Continuous).
Research and Design: Each group researches their assigned data type and
creates a poster or presentation. They should include:
1. Definition: Clear explanation of the data type.
2. Characteristics: Key features of the data type.
3. Examples: Real-life examples or scenarios where this data type is used.
4. Operations: Possible operations or analyses that can be performed with
this data type.
Presentation: Each group presents their poster to the class explaining their
data type and answering any questions from classmates.
Class Discussion: Facilitate a class discussion on how different data types
are used in various real-life situations and data analysis.
For more activities, you can visit, https://mentossacademia.com
Tables like this help present data clearly, making it easy to compare and
analyse the scores of different students across various subjects.
• A free tool from Google that helps you create surveys and collect
responses online. Link for Google Forms is h ps://forms.google.com/
• Microsoft Office tools allows you to create surveys and quizzes Link for
Microso Forms is h ps://forms.office.com/
• SurveyMonkey is also a popular tool for creating detailed surveys. Link for
SurveyMonkey is https://www.surveymonkey.com/
187
· Questionnaires: Questionnaires are similar to surveys but are often
written forms that people fill out. They usually have a set of questions that
need to be answered. For instance, if your school wants to know which
activities students enjoy most, they might give out a questionnaire with
questions like, "Which school activity do you enjoy the most? (e.g., sports,
art, music)", where students choose their answers from the options
provided.
· Interviews: Talking to individuals one-on-one to gather detailed
information. Example: Interviewing a school teacher to understand their
experience and challenges.
· Observations: Watching and noting what happens in a particular
situation. Example: Observing how students behave during a group
project to understand how they work in a team.
· Online Data Sources: These include websites, databases, and digital
tools where you can find and collect information. For example, if you're
researching the most popular pets, you might use the internet to find
statistics or articles about pet ownership.
9.3.1.1 Gathering Data from Online Sources
In today's world, we can find lots of information online to help with school
projects. We can gather, extract and integrate this information to answer almost
any question. For example, if you want to know how social media affects
teenagers, you would collect information from different sources, extract useful
data from it and integrate it into a coherent and comprehensible report. Here's
how you can do it:
Data Gathering: Data gathering means collecting information from various
places to help with your research or school projects.
1. Online Databases: These are special websites where you can find a lot of
information, such as articles and reports. For example, you can use Google
Scholar or IEEE Xplore databases. Search for keywords like “how social media
affects teenagers” to find useful articles and studies.
2. Online Resources: These include educational websites, government portals,
and news outlets. For example, Wikipedia, the National Institute of Health
(USA), and BBC.com. Use Google search engine to search for articles and
check if the information is accurate by looking at who wrote it and where it's
from.
Data Extraction: Data extraction is about finding and saving the most relevant
information from a larger set of data.
1. Identify Relevant Data: Look for specific details about how social media
impacts teenagers. Search for keywords like “teenage social media usage
statistics” and find sections in articles with important statistics or quotes.
2. Copy and Save: Highlight the key information you find. For example, if an
article says “70% of teenagers feel stressed because of social media,” copy
188
this information and paste it into a document. Keep your data organised by
topic or source.
3. Use Tools: Some websites have tools to help you gather and organise data.
Look for options like “Export” or “Download” to get articles in formats like
PDFs.
Data Integration: Data integration involves combining information from
different sources to get a complete perspective.
1. Organise Data: Put all your saved information into one place, such as a
document or spreadsheet. For example, create a Google Sheets file titled
“Social Media Impact Research” where you list all key statistics and quotes.
2. Compare and Merge: Review data from different sources and find common
themes. For instance, if many sources say that social media increases anxiety
among teenagers, note this. Combine similar findings into one summary.
3. Create Summaries: Write a brief overview of what you found. Highlight the
main points, such as how many teenagers report feeling anxious due to social
media. Make charts or graphs to show trends, such as bar graph of anxiety
levels among teens.
Class activity
Data Collection and Organization
Activity Type: Individual
Activity Task Details:
· Create Survey:
1. Design a short survey with clear, specific questions on a topic of
choice (e.g., favourite school subject).
2. Ensure questions are designed to gather meaningful data.
· Collect Responses:
1. Share the survey link with classmates or a small group to gather
responses.
2. Collect data over a specified period.
· Organise Data:
1. Enter the collected data into a spreadsheet.
2. Organise the data into tables and use basic spreadsheet functions to
clean and prepare it.
· Create Visuals:
1. Use spreadsheet tools to create at least one chart or graph (e.g., bar
chart, pie chart).
2. Label charts clearly and ensure they represent the data accurately.
· Share Findings:
1. Present the findings to the class.
2. Explain the visuals and what they reveal about the data.
189
9.4 Data Types
With respect to storage and processing, data has two types: structured and
unstructured data.
9.4.1 Structured Data
Structured data is organised and formatted to be easily searchable and
analysable. Examples include data in spread sheets and traditional databases.
Think of a spread sheet with rows and columns where each row is a record (such
as student) and each column is an attribute (such as Student ID, Student Name,
Class, Date of Birth, Fee Status, and Height) as shown in table 9.3.
Human Brain and Visualization: Did you know that the human
brain processes visuals 60,000 times faster than text? This is why
charts and graphs can make complex information easier to
understand quickly!
Visualizing Ancient Data: The earliest known example of data
visualization dates back to 1786 when William Playfair created the first line
graph. He used it to show trade and economic data!
For example, for the dataset [2, 4, 6], the mean is 4. The variance is calculated
as [(2-4)² + (4-4)² + (6-4)²] / 2 = (4 + 0 + 4) / 2 = 8 / 2= 4.
• Standard Deviation: This measures the amount of variation or spread in a set
of data. A low standard deviation means that the data points are close to the
mean, while a high standard deviation means that the data points are spread
out over a wide range. Formula for standard deviation is:
Standard deviation is the square root of the variance. It provides a measure of the
average distance of each data point from the mean. For example, for data set
[2,4,6], the variance is 4, So the standard deviation is 4 = 2.
Class activity
Design Your Own Survey
Objective: Learn how to design and analyse a survey for data collection.
Required Material: Paper and pencils, Access to survey creation tools
(optional: Google Forms or similar tools)
206
Summary
· Data refers to raw facts we gather about things around us, which can then
process to extract useful information.
· Qualitative data refers to categories or labels that describe qualities or
characteristics rather than quantities.
· Nominal data is used to label or categorize items without implying any
order.
· Ordinal data represents categories with a meaningful order, though the
differences between categories are not uniform.
· Quantitative data are numbers used to measure the quantity or amount of
something.
· Continuous data consists of values that can take any number within a
given range, including fractions or decimals.
· Structured Data is organized and formatted for easy searching and
analysis: examples include data in spread-sheets and traditional
databases.
· Unstructured Data is more free-form and doesn't fit into a specific format.
· Spreadsheets organise data in rows and columns, much like a simpler
version of a database.
· Databases are like digital filing cabinets where information is stored in an
organised way.
· Data Warehouses are specialized databases designed for storing and
analysing large amounts of data collected from various sources.
· NoSQL stands for "Not Only SQL" and refers to a variety of database
technologies designed to handle different types of data that may not fit
well into traditional databases.
· Data visualization turns numbers and information into visual
representations, making data easier to understand.
· Data pre-processing is the initial and important step in working with data.
It involves cleaning and organizing it for analysis.
· Data Cleaning involves error removing, handling missing data and
dealing with outliers.
· Data analysis involves examining data to discover useful information,
draw conclusions, and support decision-making.
· Qualitative analysis deals with non-numeric data such as text, images, and
sounds. It helps us understand meanings, concepts, and experiences.
· Remote access refers to the ability to connect to and use a computer or
network from a distant location.
· A backup is a copy of important data or files stored separately from the
original, used to protect against data loss.
207
· Collaborative authoring is the process where multiple people work
together to create, edit, and improve a document or project.
· Data science is like being a detective, solving problems using data instead
of solving crimes.
· Data science involves gathering, analysing, and interpreting large
amounts of data to find patterns and useful information.
· Data Analytics is a branch of data science focussed on analysing data to
understand it better and support decisions making.
· Big Data is a term used to describe extremely large data sets that are so
complex they can't be managed with traditional tools.
210
UNIT Emerging Technologies
10 in Computer Science
Student Learning Outcomes
By the end of this chapter, you will be able to:
• Define Artificial Intelligence (AI) and understand its historical context and
evolution.
• Identify various applications of AI in different domains such as
healthcare, education, and gaming.
• Explain the subfields of AI, including machine learning, natural language
processing, computer vision, and robotics.
• Distinguish between different types of AI algorithms, including
explainable (whitebox) and unexplainable (blackbox) models.
• Understand the role of AI techniques in advancing machine learning
models and other capabilities.
• Define the Internet of Things (loT) and understand its significance in
connecting devices and systems.
• Describe the components of loT systems, including sensors, devices,
networks, and data analysis.
• Explore various applications of loT in domains such as smart homes,
healthcare, and transportation.
• Discuss security and privacy considerations in loT deployments.
• Analyze the potential risks and challenges associated with AI and loT,
including data privacy and algorithmic bias.
• Examine policy and regulatory frameworks addressing the challenges of
AI and loT Evaluate the societal impact of AI and loT on daily life, work
environments, and society at large.
• Develop strategies for addressing ethical concerns and maximizing the
societal benefits of AI and loT.
211
Introduction
Artificial Intelligence (AI) is a rapidly growing field that is changing various
aspects of our lives. These technologies are not only reshaping industries but
also redefining the way we live, work, and interact with our environment. This
chapter provides an introduction to AI and loT, explores their applications,
discusses the algorithms and techniques that power them, and examines the
broader implications and future prospects of these transformative technologies.
10.1 Introduction to Artificial Intelligence (Al)
Artificial Intelligence is a rapidly growing field that is transforming various
aspects of our lives. From healthcare to gaming, AI technologies are being
applied to solve complex problems and improve our daily experiences. For
example, Al-driven systems monitor crop health and predict yields by getting
data from sensors and drones to optimize farming practices.
10.1.1 Understanding Al
Artificial Intelligence denotes the simulation of human thinking ability in
computer systems to think and learn in a manner like humans. To fully realize the
effect of AI, it is essential to understand its definition and historical context, as
well as the evolution of AI technologies over time.
10.1.2 Historical Context of Artificial Intelligence:
The term AI was first invented by John McCarthy in 1956 during the Dartmouth
Conference, regarded as the origin of artificial intelligence as a discipline of
research. The journey of AI has seen several key milestones:
• 1950s-1960s: Early AI research focused on problem-solving and symbolic
methods.
• 1970s-1980s: The development of expert systems that mimicked human
decision-making.
• 1990s: The rise of machine learning, where computers began to learn from
data.
• 2000s-: Advances in deep learning, natural language processing, and
robotics have significantly expanded Al's capabilities.
• 2011s: Voice assistant was used for voice command and voice recognition
• 2023s-Present: ChatGPT was introduced that is an AI-based model which is
designed to understand human-like text-based input.
212
Figure 10.1: Key Milestones in the History of AI
• Subfields of AI:
AI encompasses several subfields, each focusing on different aspects of
intelligence and technology:
• Machine Learning: Machine learning is a type of artificial intelligence
where computers learn from experience and improve over time without
being explicitly programmed. It's like teaching a computer by showing it lots
of examples, and it figures out how to do things on its own.
• Deep Learning: Deep learning is a special kind of machine learning. It uses
complex structures called neural networks, which are inspired by how our
brains work. These networks help computers learn from lots of data and
make decisions or recognize patterns even better.
214
• Natural Language Processing (NLP): Natural Language Processing, or NLP,
is a technology that helps computers understand and talk to us in our
language. It's like teaching a computer to read, write, and even chat with us.
Example: When you ask Siri or Alexa a question, they use NLP to understand
what you're saying and give you a helpful answer. Another example is when you
type a message and your phone suggests words to complete your sentence.
That's NLP at work!
• Computer Vision: Computer vision is a field of artificial intelligence that
enables computers to see and understand the visual world. It helps
computers interpret images and videos.
• Robotics: Robotics is the science of building and programming robots.
Robots are machines that can do tasks for us, like cleaning the floor or
building cars. Some robots can even think and make decisions.
Class activity
Research and present a real-world application of AI in one of the domains
already mentioned. Explain how AI is used and what benefits it brings.
Class activity
Think about your own home. What everyday devices could be connected
to the internet to make your home smarter? Discuss with your classmates
and draw a simple diagram showing how these devices could be
connected in an loT system.
218
Did you know? Smart home devices can help save energy by
automatically turning off lights and adjusting heating or
cooling when you're not home.
10.3.2 loT Applications
The Internet of Things (loT) is transforming
many aspects of our lives by connecting
devices and systems in various domains.
Let's explore some of the exciting
applications of loT and understand the
importance of security and privacy in
these deployments.
Healthcare:
loT is revolutionising healthcare by providing
better patient monitoring and care. loT
devices can track vital signs, remind patients
to take medication, and alert healthcare Figure 10.5: Example of
providers in case of emergencies. loT in Healthcare
Class activity
Think about how loT can
improve your school. Can you
come up with ideas for smart
classrooms, smart libraries, or
even smart buses? Discuss
with your classmates and
draw a diagram showing your
Figure 10.6: Example of
loT-enabled school.
loT in Transportation
219
10.3.3 Security and Privacy Considerations in loT Deployments:
While loT offers many benefits, it also raises security and privacy concerns. As
more devices are connected to the internet, the risk of cyber-attacks increases.
It's important to ensure that loT systems are secure to protect personal data and
privacy.
Examples of Security Measures:
• Strong Passwords: Use strong, unique passwords for all loT devices to
prevent unauthorized access.
• Regular Updates: Keep the software and firmware of your loT devices up to
date to protect against known vulnerabilities.
• Encryption: Ensure that data transmitted between devices is encrypted to
protect it from being intercepted by hackers.
224
UNIT Ethical, Social, and Legal
11 Concerns in Computer Usage
Student Learning Outcomes
By the end of this chapter, you will be able to:
• Describe the importance of using computers safely and responsibly in daily
activities.
• Explain how to protect personal information while using computers and online
platforms.
• Identify the factors to consider when selecting computer hardware and software
for safety, efficiency, and compatibility.
• Explain how choosing the right hardware and software affects the overall
computer experience.
• Demonstrate how to create strong, unique passwords and explain their
importance.
• Describe the need for regular software updates and the role they play in
maintaining device security.
• Identify potential risks associated with clicking on unknown links and
downloading files from untrusted sources.
• Explain the concept and benefits of Two-Factor Authentication (2FA).
• Describe the risks of using public Wi-Fi for sensitive transactions and the
importance of secure networks.
• Identify and avoid common online scams and phishing attempts.
• Explain the importance of regularly backing up important data and describe
methods for doing so.
• Describe responsible behavior on social media, email, cloud services, and online
applications.
• Explain the significance of privacy settings and data security measures in
protecting personal information online.
• Identify ethical and legal responsibilities related to intellectual property rights,
including copyright, trademarks, and patents.
• Discuss the importance of respecting intellectual property and the implications of
software piracy.
• Describe privacy laws and their purpose in protecting personal information online.
• Explain the legal consequences of unauthorized access to personal data and the
responsibilities of companies to safeguard user information.
• Explain the principles of data ethics, including transparency, respect for privacy,
and accountability.
• Describe ethical guidelines for data collection, storage, and sharing, including the
importance of informed consent and data security.
• Analyze real-life case studies of data breaches to understand the impact of poor
data security and the importance of following legal and ethical guidelines.
225
• Define and explain the significance of copyrights, trademarks, and patents in
protecting digital content and inventions.
• Discuss the ethical and legal responsibilities related to intellectual property
rights and the consequences of infringing on these rights.
• Demonstrate techniques for safe online research, including using reliable
sources, checking authorship, and cross-checking information.
• Explain strategies for protecting privacy during online research, such as using
private browsing and avoiding suspicious links.
• Recognize signs of internet addiction and suggest strategies for promoting
balanced internet usage and engaging in offline activities.
• ethical concerns and maximizing the societal benefits of AI and loT.
Introduction
Computers and digital devices are now a big part of our daily lives, helping us
with schoolwork, staying in touch with friends, and even playing games. But with
all these great tools comes the need to use them safely and responsibly. In this
chapter, we'll learn how to use computers and digital platforms wisely. We'll
explore how to keep our personal information safe, make smart choices about
the hardware and software we use, and behave respectfully online. By
understanding these important aspects, we can enjoy technology while avoiding
problems and protecting ourselves and others. Let's understand the world of
secure and conscientious computer usage to make sure we get the most out of
our digital experiences!
Secure and Conscientious Computer Usage
Computers have become a crucial part of our everyday lives. Whether we are
using them for schoolwork, chatting with friends, or playing games, it's
important to use computers safely and responsibly. Safe and responsible
computer usage means knowing how to protect our personal information,
making wise choices about the hardware and software we use, and ensuring that
our online behavior is respectful and ethical. In this chapter, we will explore the
key aspects of using computers wisely and securely, so we can enjoy the benefits
of technology while avoiding potential risks.
Online Etiquette: The "Golden Rule" applies online too, treat others as
you want to be treated. This helps maintain respectful and positive
interactions.
226
11.1 Responsible Computer Usage
Being responsible with technology means making thoughtful decisions when
using computers. This includes selecting the right hardware and software,
safeguarding our data, and using the internet in a way that respects others. Let's
take a closer look at why it's important to use technology responsibly.
When we talk about computers, hardware refers to the physical parts like the
monitor, keyboard, and CPU, while software includes the programs and
applications we use, such as word processors or games. Choosing the right
hardware and software is important because it can affect the safety, efficiency,
and overall experience of using a computer.
• Safety: Just as you wouldn't use a broken or unsafe tool, using outdated or
insecure hardware or software can put you at risk. For example, using a
computer without updated antivirus software can make it easier for viruses or
hackers to steal your information.
• Efficiency: The right hardware and software help you complete tasks quickly
and easily. Imagine trying to play a new video game on an old computer, the
game might be slow or not work at all, making it frustrating to use.
• Compatibility: This means that the hardware and software should work well
together. You should always check the system requirements on software
packages and match them with your computer's specifications to ensure
compatibility.
Cyber Hygiene: Just like washing your hands to prevent germs, updating
your antivirus software regularly is essential to prevent digital viruses.
Two-Factor Authentication (2FA): The concept of 2FA was first used in the
1980s, but it became widespread with the rise of online accounts in the 2000s.
Software Updates: Microsoft releases major updates for Windows every six
months, showing how frequently technology needs to be refreshed for
security.
228
11.2.2 Secure Use of Digital Platforms
Using digital platforms securely means taking extra steps to protect your
information and ensuring that your online activities do not put you or others at
risk. Here are some tips:
1. Two-Factor Authentication (2FA): Two-Factor Authentication adds an
extra layer of security to your accounts. After entering your password, you
will be asked to provide another piece of information, like a code sent to
your phone. This makes it much harder for someone to hack into your
account.
2. Avoiding Public Wi-Fi for Sensitive Transactions: Public Wi-Fi
networks, like those in cafes or libraries, are often less secure. It's best to
avoid accessing sensitive information, such as online banking, while
connected to these networks. Instead, wait until you're on a secure,
private network at home.
3. Being Aware of Scams: Online scams are designed to trick you into
giving away your personal information. These can include phishing emails
that pretend to be from legitimate companies asking for your login
details. Always be skeptical of unsolicited requests for personal
information, and verify the source before responding.
4. Regularly Reviewing Your Account Activity: Periodically check your
online accounts for any unusual activity. This includes looking at your
recent logins, messages, and transactions. If you notice anything
suspicious, such as logins from unfamiliar locations, change your
password immediately and report the activity to the platform.
5. Backing Up Important Data: Regularly backing up your data ensures
that you won't lose important information if something goes wrong with
your device. You can back up your data to an external hard drive or a cloud
storage service like Google Drive or Dropbox.
11.3 Best Practices in Online Behavior
11.3.1 Responsible Use of Social Media, Email, Cloud Services, and Online
Applications
In today's digital world, we use social media, email, cloud services, and online
applications every day. While these tools make our lives easier and more
connected, it's important to use them responsibly.
Using digital platforms like social media, email, cloud services, and online
Data Collection: The ethical principle of "informed consent" means you have
the right to know how your data is being used. This principle was emphasized
in the 2004 Bioethics Commission report.
229
applications has become a part of our daily lives. However, it's important to use
these tools responsibly to ensure our safety and the safety of others.
· Social Media: Social media platforms like Facebook, Instagram, and
Twitter allow us to connect with friends and share information. But it's
important to think before you post. Always avoid sharing personal
information, like your home address or phone number, publicly.
· Email: Email is a useful tool for communication, especially for school and
work. However, it's important to be careful when opening emails from
unknown senders. These could contain harmful links or attachments.
· Cloud Services: Cloud services like Google Drive or Dropbox allow you to
store and share files online. While these services are convenient, it's
important to use them wisely. Always use strong passwords to protect
your accounts and avoid sharing sensitive information, like passwords or
financial details, through cloud storage.
· Online Applications: Online applications, such as games, learning apps,
or shopping platforms, are fun and useful but can also pose risks. Make
sure to download apps only from trusted sources like Google Play Store or
Apple App Store to avoid downloading harmful software.
11.3.2Importance of Privacy Settings and Data Security Measures
Privacy settings and data security measures are essential tools that help protect
your personal information while using digital platforms.
· Privacy Settings: Most online platforms, including social media and
email services, allow you to adjust privacy settings to control who can see
your information. For instance, on Facebook, you can choose who can see
your posts—public, friends, or just you. It's important to regularly review
and update your privacy settings to make sure your personal information
is protected.
· Data Security Measures: Data security measures help protect your
information from unauthorized access. Using strong, unique passwords
for each of your online accounts is one of the simplest and most effective
ways to secure your data. For example, instead of using "password123,"
create a password that combines letters, numbers, and symbols, like
"S3cur3!Passw0rd."
11.4 Legal and Ethical Frameworks
In this era, we rely heavily on technology for communication, learning, and
entertainment. While these tools bring many benefits, they also raise important
questions about how our personal information is handled and protected.
11.4.1 Legal Frameworks for Privacy
11.4.1.1 Understanding Privacy Laws and Their Implications
Search Engine Milestones: Google processes over 3.5 billion searches per day,
making it the most popular search engine for finding credible information.
230
Privacy laws are rules set by the government to protect our personal information.
These laws ensure that companies and organizations handle our data
responsibly. When we use the internet, we often share personal details like our
names, addresses, or even what we like to buy. Privacy laws help make sure that
this information is kept safe and not misused.
Understanding these laws is important because they give you the power to
control your personal information. If a company misuses your data. Such as by
sharing it without your permission, you have the right to take legal action.
11.4.1.2 Laws Protecting User Privacy and Consequences of Unauthorized
Access
There are specific laws designed to protect your privacy online. These laws make
it illegal for someone to access your personal information without permission.
For instance, if someone hacks your email or social media account, they are
breaking the law.
Unauthorized access to your information can lead to serious problems, such as
identity theft or fraud. To prevent this, privacy laws require companies to
implement strong security measures, like encryption, to protect your data. If a
company fails to protect your information, they could be held responsible and
face legal penalties.
11.4.2 Data Ethics and Responsible Use
11.4.2.1 Introduction to Data Ethics and Principles Governing Data
Handling
Data ethics is about doing the right thing when it comes to collecting, storing,
and using information. Just because we can gather a lot of data doesn't mean we
should use it in any way we want. Data ethics helps guide us to use information
fairly and responsibly.
The principles of data ethics include transparency, respect for privacy, and
accountability. This means being clear about how data is used, protecting
people's personal information, and taking responsibility if something goes
wrong.
11.4.2.2 Ethical Considerations in Data Collection, Storage, and Sharing
When data is collected, stored, or shared, there are important ethical
considerations to keep in mind. Collecting data should always be done with the
person's consent. This means that before gathering information, the person
must agree to it.
• Storing data also requires responsibility. Data must be kept secure so that
unauthorized people can't access it. For example, storing medical records
requires strong security because this information is private and sensitive.
• Sharing data should be done carefully and only when necessary. For
instance, a school might share your grades with your parents, but it shouldn't
share them with other students without your permission. Being ethical means
thinking about how sharing information might affect others and acting in a
way that respects their rights.
231
Class activity
Data Ethics Role-Play
Activity Task Details:
1. Introduction (10 minutes): Discuss the principles of data ethics,
including transparency, consent, and accountability.
2. Task (30 minutes): Divide students into small groups and give each group
a role-play card with a scenario involving data collection or usage (e.g., a
company asking for user data, a school collecting survey responses). Each
group acts out their scenario and discusses the ethical considerations
involved.
3. Discussion (10 minutes): Groups present their role-plays and discuss the
ethical issues and solutions.
Details: Through role-playing, students will gain insight into the ethical
implications of data handling and the importance of responsible data
practices.
11.4.2.3 Ethical Guidelines for Data Usage and Management
Ethical guidelines for data usage involve ensuring that data is used for the
purpose it was intended and that it benefits the person who provided it.
Misusing data. Such as selling it to third parties without consent, is unethical and
can lead to a loss of trust. These guidelines include:
· Informed Consent: Always ask for permission before collecting
someone's data. For example, a website should ask if it's okay to track
your activity before doing so.
· Data Minimization: Only collect the data you need. If you're conducting
a survey, don't ask for unnecessary personal details.
· Data Security: Protect the data you collect. Use strong passwords and
encryption to keep information safe.
· Accountability: If something goes wrong, take responsibility. If there's a
data breach, inform the affected individuals and take steps to fix the
problem.
Data Breaches: In 2013, the largest data breach affected Yahoo, exposing the
data of 3 billion accounts, including names, email addresses, and passwords.
Tech Evolution: The first computer mouse, invented in 1964, was a wooden
box with a single button. Today's mice come with multiple buttons and
advanced features!
11.6.2 Preventing Internet Addiction
11.6.2.1 Understanding Internet Addiction and Promoting Balanced Usage
Internet addiction happens when a person spends so much time online that it
starts to interfere with their daily life. It's important to recognize the signs of
internet addiction and take steps to prevent it.
234
· Recognizing the Signs: If you find it hard to stop using the internet, even
when it's time to sleep, study, or spend time with family and friends, you
might be developing an unhealthy habit. For example, if you spend hours
scrolling through social media every day and neglect your homework, it
could be a sign of internet addiction.
· Set Time Limits: One way to prevent internet addiction is by setting time
limits on your internet use. For example, you can decide to spend no more
than one hour on social media each day and stick to it.
· Find Offline Activities: Balance your online time with offline activities like
sports, reading, or spending time with friends in person. This helps you
maintain a healthy lifestyle.
11.6.2.2 Strategies for Digital Well-being and Fostering Healthy Online
Habits
Maintaining digital well-being means using the internet in a way that is healthy
and balanced. Here are some strategies:
· Take Regular Breaks: When using the internet for long periods, take
breaks to rest your eyes and clear your mind. For example, if you're
studying online, take a 5-minute break every hour to stretch and relax.
· Use Technology Wisely: Make use of apps or features that help you
manage your time online. Some apps can track your screen time and send
you reminders to take a break.
· Be Mindful of Your Mental Health: If being online makes you feel
stressed, anxious, or unhappy, it might be time to cut back. For instance, if
you feel overwhelmed by constant notifications, consider turning them
off for a while.
11.6.3 Social Networking Safety and Online Interactions
11.6.3.1 Privacy Settings, Responsible Sharing, and Online Etiquette
Social networking platforms allow us to connect with friends and share our lives,
but it's important to do so safely and respectfully.
· Adjust Your Privacy Settings: Make sure your social media accounts are
set to private, so only people you trust can see your posts. For example, on
Instagram, you can set your account to "private" so only approved
followers can view your content
· Practice Good Online Etiquette: Be respectful in your online
interactions. This means using polite language, avoiding arguments, and
not spreading rumors or false information. For example, if you disagree
with someone's post, express your opinion respectfully without insulting
them.
11.6.3.2 Addressing Cyberbullying, Harassment, and Respectful Online
Interactions
Cyberbullying and online harassment are serious issues that can hurt people
emotionally and mentally. Here's how to deal with them:
· Recognize Cyberbullying: Cyberbullying involves using the Internet to
235
harm or harass others. This can include sending mean messages,
spreading rumors, or posting embarrassing photos of someone without
their permission.
· Report and Block: If you experience or witness cyberbullying, report it to
the platform and block the person responsible. Most social media
platforms have tools to help you do this. For instance, on Facebook, you
can block someone to stop them from contacting you or viewing your
profile.
· Support Others: If you see someone being bullied online, offer your
support. You can stand up for them by reporting the bullying or simply
offering kind words. This can make a big difference in how they feel.
· Practice Respectful Interactions: Always treat others with respect
online, just as you would in person. Avoid making negative comments,
and think about how your words might affect someone else. For example,
if you see a post you don't like, it's better to scroll past it than to leave a
hurtful comment.
Class activity
Understanding Privacy Settings
Activity Task Details:
1. Introduction (10 minutes): Discuss the importance of privacy
settings and how they can protect personal information.
2. Task (30 minutes): Divide students into groups. Assign each group
a different digital platform. Ask them to find and document where
and how to adjust privacy settings on their assigned platform.
3. Presentation (10 minutes): Groups share their findings with the
class, explaining how to set up privacy settings to protect personal
information.
Details: This activity enables students to practice adjusting privacy
settings and understand their role in protecting personal data.
Summary
· Safe and responsible computer usage means knowing how to protect our
personal information, making wise choices about the hardware and
software we use, and ensuring that our online behavior is respectful and
ethical.
· Responsible computer usage means protecting ourselves and others
when using computers.
· Safe operation of digital platforms and devices, mean using them in a way
that protects you from harm and avoids any unwanted issues.
· Using digital platforms securely means taking extra steps to protect your
information and ensuring that your online activities do not put you or
others at risk.
· Privacy settings and data security measures are essential tools that help
protect your personal information while using digital platforms.
· Privacy laws are rules set by the government to protect our personal
information. These laws ensure that companies and organizations handle
our data responsibly.
· Ethical guidelines for data usage involve ensuring that data is used for the
purpose it was intended and that it benefits the person who provided it.
· Intellectual property rights are important because they protect the
creations and ideas of individuals and organizations.
· Copyright is a legal right that gives creators control over their original
works, such as music, books, movies, and software.
· Trademarks are symbols, names, or slogans used by companies to
distinguish their products or services from others.
· Patents protect new inventions or processes, giving the inventor exclusive
rights to make, use, or sell the invention for a certain period.
· Software piracy is the illegal copying, distribution, or use of software.
238
Multiple Choice Questions (MCQs)
1. Why is it important to use computers safely and responsibly?
a) To ensure we can use them more frequently
b) To protect our personal information and make wise choices about
hardware and software
c) To make the computer run faster
d) To avoid paying for software
2. What does "responsible computer usage" include?
a) Choosing the most expensive hardware
b) Sharing your passwords with friends
c) Being cautious about what you share online and protecting yourself
and others
d) Ignoring software updates
3. What should you check to ensure hardware and software compatibility?
a) The color of the hardware
b) The system requirements on software packages and match them
with your computer's specifications
c) The price of the hardware
d) The brand of the hardware
4. Why is it important to use strong, unique passwords?
a) To make your accounts easy to hack
b) To help others guess your password
c) To make it harder for someone to guess your password and access
your accounts
d) To avoid installing software updates
5. What is one reason to avoid clicking on unknown links or downloading files
from untrusted sources?
a) They might contain helpful software
b) They might contain malware that can harm your device or steal your
information
c) They are usually cheaper
d) They help your device run faster
6. What does Two-Factor Authentication (2FA) do?
a) It makes your password easier to guess
b) It adds an extra layer of security by requiring a second form of
verification
c) It removes the need for a password
d) It reduces the need for software updates
7. Why should you be cautious when using public Wi-Fi for sensitive
transactions?
239
a) Public Wi-Fi is usually faster
b) Public Wi-Fi networks are often less secure
c) Public Wi-Fi is free
d) Public Wi-Fi always provides encryption
8. What is an important aspect of responsible use of social media?
a) Sharing personal information like your home address
b) Posting photos without considering privacy settings
c) Being respectful and avoiding sharing sensitive information publicly
d) Ignoring privacy settings
9. What should you do if you receive an email from an unknown sender asking
for personal information?
a) Provide the information requested
b) Forward the email to your friends
c) Ignore or delete the email
d) Open the email and click on any links
10. Why is it important to regularly review your account activity?
a) To update your contact information
b) To look for unusual activity and ensure your accounts are secure
c) To check the number of friends you have
d) To download new applications
11. What is the purpose of privacy settings on digital platforms?
a) To make your posts public
b) To control who can see your information and interact with you online
c) To increase the number of followers
d) To automatically share your information
12. What should you do to ensure data security?
a) Use the same password for all accounts
b) Share your passwords with friends
c) Use strong, unique passwords and enable two-factor authentication
d) Avoid using any security measures
13. What is a key aspect of data ethics?
a) Using data in any way you like
b) Transparency, respect for privacy, and accountability in data usage
c) Collecting as much data as possible
d) Ignoring data security
14. What is software piracy?
a) Sharing software legally with friends
b) The illegal copying, distribution, or use of software
c) Buying software from an official source
d) Updating software regularly
15. How can you verify the credibility of information found online?
a) By checking the number of ads on the website
b) By using multiple reputable sources and checking the author's
240
credentials
c) By looking at the website's design
d) By the website's popularity
Short Questions
1. What is the importance of using computers safely and responsibly?
2. How does choosing the right hardware and software affect your computer
usage?
3. Why is it important to use antivirus software on your computer?
4. What are some examples of good practices when selecting hardware and
software?
5. How can choosing compatible hardware and software enhance your
computer experience?
6. Why should you create strong, unique passwords for your accounts?
7. What is the purpose of regular software updates?
8. How can you protect yourself from harmful links and downloads?
9. What is Two-Factor Authentication (2FA), and why is it useful?
10. Why is it a good idea to avoid using public Wi-Fi for sensitive transactions?
11. How can you verify if an email or message is a scam?
12. Why is it important to be careful about what you share on social media?
13. What should you do if you receive an email from an unknown sender asking
for personal information?
14. What is the purpose of privacy laws regarding your personal information?
15. How do privacy laws protect you from unauthorized access to your data?
16. What is the difference between copyright, trademarks, and patents?
17. Why is it important to respect intellectual property rights?
18. What is software piracy, and why is it harmful?
19. How can you identify reliable sources when researching online?
20. What is one way to protect your privacy during online research?
21. What are some signs that you might be developing an internet addiction?
Long Questions
1. 1. Discuss the importance of responsible computer usage in today's digital
world. Explain how selecting the right hardware and software can affect
safety, efficiency, and compatibility in computer use.
2. Describe the steps you should take to ensure the safe operation of digital
platforms and devices.
3. Explain the concept of data ethics and its importance in handling personal
and sensitive information. Discuss the principles of transparency, respect for
privacy, and accountability.
4. Analyze the impact of privacy laws on protecting personal information in the
digital age. How do laws like the Personal Data Protection Bill in Pakistan help
safeguard user data?
5. Discuss the different types of intellectual property rights, including copyright,
trademarks, and patents.
241
6. Describe the ethical and legal responsibilities related to intellectual property
rights. What are the consequences of violating these rights, such as through
software piracy or unauthorized use of copyrighted material?
7. Outline effective techniques for conducting safe and credible online research.
How can users evaluate the reliability of sources and avoid privacy risks
during their research?
8. Discuss the concept of internet addiction and its potential impact on
individuals. How can recognizing the signs of addiction, setting time limits,
and finding offline activities help promote balanced internet usage?
242
UNIT Entrepreneurship
12 in Digital Age
Student Learning Outcomes
By the end of this chapter, you will be able to:
• Define entrepreneurship and understand its significance in the digital age.
• Differentiate between various types of entrepreneurs, including startup
founders, social entrepreneurs, and intrapreneurs.
• Identify key characteristics of successful entrepreneurs, such as innovation
and risk-taking.
• Analyze the impact of digital technologies on entrepreneurship, including
digital marketing and e-commerce strategies.
• Utilize digital tools and platforms for market research, online marketing, and
managing e-commerce operations.
• Apply data analysis techniques to make informed business decisions.
• Generate and develop innovative business ideas through problem
identification and creative problem-solving techniques.
• Create comprehensive business plans that include market analysis, revenue
models, and digital marketing strategies.
• Understand the principles of ethical and sustainable entrepreneurship and
their importance in business operations. Poor data security and the
importance of following legal and ethical guidelines.
243
Introduction
Entrepreneurship is the process of designing, launching, and running a new
business, often initially a small business, offering a product, process, or service
for sale or hire. It involves the willingness to take risks and innovate in order to
create value. This chapter explores various aspects of entrepreneurship,
including its definition, significance, types of entrepreneurs, and the impact of
digital technologies. We will also delve into the key characteristics of successful
entrepreneurs, the importance of ethical and sustainable practices, and the tools
and strategies necessary for navigating the digital landscape.
12.1 Entrepreneurship
Entrepreneurship is the process of starting a new business or organization. It
involves identifying a need in the market, coming up with an idea to meet that
need, and taking the risk to bring that idea to life. Entrepreneurs are people who
create and run these businesses. They are innovators, risk-takers, and problem-
solvers.
Pakistan is home to one of the largest freelancing communities
in the world. The country ranks among the top five for freelance
growth, with many entrepreneurs offering their skills in areas
like software development, graphic design, and digital
marketing. This entrepreneurial spirit is helping to drive
economic growth and innovation in Pakistan!
12.1.1 Examples of Entrepreneurship
12.1.1.1 Tech Startups
Tech startups like Facebook, Google, and Apple began as small companies
founded by entrepreneurs who had innovative ideas for new technology. These
companies have grown to become some of the largest and most influential in the
world.
244
12.1.1.1 Local Businesses
Local businesses, such as your neighborhood bakery or a small clothing
boutique, are also examples of entrepreneurship. These businesses provide
products or services to their communities and are often started by individuals
with a passion for what they do.
12.1.1.1 Innovation
Innovation means creating something new or improving something that already
exists. Entrepreneurs are always looking for new ways to solve problems or make
things better.
12.1.1.2 Risk-Taking
Starting a new business involves risk. Entrepreneurs must be willing to take
chances, knowing that they might fail. However, they also know that taking risks
can lead to great rewards.
Class activity
Think of a problem you face in your daily life. In groups, come up with a
business idea that could solve that problem. Present your idea to the class!
Did you know that Walt Disney, the creator of Mickey Mouse,
started his company in his uncle's garage? Today, Disney is one
of the largest entertainment companies in the world!
245
12.1.2 Why is Entrepreneurship Important?
Entrepreneurship is important because it drives economic growth, creates jobs,
and fosters innovation. New businesses bring fresh ideas and competition, which
can lead to better products and services for everyone.
12.1.2.1 Economic Growth
When entrepreneurs start new businesses, they contribute to the economy by
creating new jobs and providing new products and services. Economic growth
means that a country is producing more goods and services, which makes
people's lives better. Entrepreneurship plays a big role in this.
12.1.3.2 Innovation and Progress
Entrepreneurs often come up with groundbreaking ideas that change the way we
live and work. For example, the invention of the smartphone has revolutionized
communication and access to information
247
Figure 12.5: Mobile apps offer convenience and enhance user experience,
making them a valuable tool for digital entrepreneurs.
Class activity
Create an online store for a hypothetical business using an e-commerce
platform like Shopify. Design the store, add products, and present your
store to the class!
Class activity
Exploring Market Research Tools
1. Divide the class into small groups.
2. Assign each group a market research tool to explore.
3. Ask each group to present how their assigned tool can help a
business understand its customers better.
251
12.3.3 Online Marketing Tools
Online marketing tools assist businesses in promoting their products and
services through digital channels. These tools are essential for social media
marketing, search engine optimization (SEO), and content creation.
253
Pakistani startup Careem started as a ride-hailing service
and expanded to offer delivery and payment solutions
based on market needs.
254
12.5.1 Creating Comprehensive Business
Plans
A business plan is a detailed document that
outlines your business goals and the
strategies you will use to achieve them. It
serves as a blueprint for your business,
helping you to stay organized and focused.
12.5.2 Components of a Business Plan
A comprehensive business plan typically
includes several key components:
Market Analysis: Market analysis involves
researching your target market to
Figure 12.15: Business Plan Structure
understand the needs and preferences of
your potential customers. This includes studying market trends, analyzing
competitors, and identifying your target audience.
255
Revenue Models: A revenue model outlines how your business will generate
income. This includes pricing strategies, sales forecasts, and potential revenue
streams.
Class activity
Research a local business and analyze how it aligns with one or more of
the SDGs. Present your findings, focusing on the business's impact on
social, environmental, and economic sustainability.
258
Summary
• Entrepreneurship: The process of starting and running a business.
• Entrepreneur Characteristics: Key qualities for entrepreneurial success.
• Digital Entrepreneurship: Leveraging technology to start and grow a
business.
• Digital Tools: Utilizing online platforms for business operations.
• Data-Driven Entrepreneurship: Making informed decisions based on data.
• Idea Generation: Developing new business concepts.
• Business Planning: Creating a roadmap for a new venture.
• Ethical Entrepreneurship: Balancing profit with social responsibility.