Book Intro To Cs

Download as pdf or txt
Download as pdf or txt
You are on page 1of 127

Computer Science

Computer Science (CS)

1
Computer Science

Computer science (CS)


Computer science is the study of algorithmic processes and computational machines.
[1][2] As a discipline, computer science spans a range of topics from theoretical
studies of algorithms, computation and information to the practical issues of
implementing computing systems in hardware and software. [3][4] Computer science
addresses any computational problems, especially information processes, such as
control, communication, perception, learning, and intelligence. [5][6]

Computer Science is the study of computers and computational systems. Unlike


electrical and computer engineers, computer scientists deal mostly with software and
software systems; this includes their theory, design, development, and application.

Computer science is the study of information, protocols and algorithms for idealized
and real automata.

Automaton: “self-moving” – in our context, self “deciding” or autonomous


mechanism with bounded resources (time and space)

Information: knowledge represented in a form suitable for transmission, manipulation,


etc.

Protocol: rules for exchanging information without problems

Algorithm: an unambiguous, finite description in simple steps or actions

Computer science is the study of information processes. A process is a sequence of


steps. Each step changes the state of the world in some small way, and the result of all
the steps produces some goal state. For example, baking a cake, mailing a letter, and
planting a tree are all processes. Because they involve physical things like sugar and
dirt, however, they are not pure information processes. Computer science focuses on
processes that involve abstract information rather than physical things.

A procedure is a description of a process. A simple process can be described


procedure just by listing the steps. The list of steps is the procedure; the act of
following them is the process. A procedure that can be followed without any thought
is called a mechanical procedure. An algorithm is a mechanical procedure that is
algorithm guaranteed to eventually finish

We can say computer science or CS. CS focuses entirely on efficiently programming


computers. Computer scientists use mathematical algorithms. They study theoretical

2
Computer Science

algorithms and the practical problems that exist in implementing them through
computer software and hardware.

Artificial intelligence, computer graphics, and programming are sub-fields of


computer science. Software engineering is also part of computer science. Artificial
intelligence (AI) refers to software technologies that make computers think and
behave like humans. Most robots have artificial intelligence in their software.

A computer terminal is not some clunky old television with a typewriter in front of it.
It is an interface where the mind and body can connect with the universe and move
bits of it about. "Douglas Adams".

A computer is a machine that can:

1. Accept input. Input could be entered by a human typing at a keyboard, received


over a network, or provided automatically by sensors attached to the computer.
2. Execute a mechanical procedure, that is, a procedure where each step can be
executed without any thought.
3. Produce output. Output could be data displayed to a human, but it could also be
anything that affects the world outside the computer such as electrical signals
that control how a device operates.

Computers exist in a wide range of forms, and thousands of computers are hidden in
devices we use every day but don’t think of as computers such as cars, phones, TVs,
microwave ovens, and access cards. Our primary focus is on universal computers,
which are computers that can perform all possible mechanical computations on
discrete inputs except for practical limits on space and time

3
Computer Science

Computer - Overview

4
Computer Science

Computer - Overview
Today’s world is an information-rich world and it has become a necessity for everyone to know
about computers. A computer is an electronic data processing device, which accepts and stores
data input, processes the data input, and generates the output in a required format.

The purpose of this tutorial is to introduce you to Computers and its fundamentals.

Functionalities of a Computer
If we look at it in a very broad sense, any digital computer carries out the following five
functions −

Step 1 − Takes data as input.

Step 2 − Stores the data/instructions in its memory and uses them as required.

Step 3 − Processes the data and converts it into useful information.

Step 4 − Generates the output.

Step 5 − Controls all the above four steps.

Advantages of Computers
Following are certain advantages of computers.

High Speed

 Computer is a very fast device.


 It is capable of performing calculation of very large amount of data.
 The computer has units of speed in microsecond, nanosecond, and even the picosecond.
 It can perform millions of calculations in a few seconds as compared to man who will spend
many months to perform the same task.

5
Computer Science

Accuracy

 In addition to being very fast, computers are very accurate.


 The calculations are 100% error free.
 Computers perform all jobs with 100% accuracy provided that the input is correct.

Storage Capability

 Memory is a very important characteristic of computers.


 A computer has much more storage capacity than human beings.
 It can store large amount of data.
 It can store any type of data such as images, videos, text, audio, etc.

Diligence

 Unlike human beings, a computer is free from monotony, tiredness, and lack of
concentration.
 It can work continuously without any error and boredom.
 It can perform repeated tasks with the same speed and accuracy.

Versatility

 A computer is a very versatile machine.


 A computer is very flexible in performing the jobs to be done.
 This machine can be used to solve the problems related to various fields.
 At one instance, it may be solving a complex scientific problem and the very next moment it
may be playing a card game.

Reliability

 A computer is a reliable machine.


 Modern electronic components have long lives.
 Computers are designed to make maintenance easy.

Automation

 Computer is an automatic machine.


 Automation is the ability to perform a given task automatically. Once the computer receives
a program i.e., the program is stored in the computer memory, then the program and
instruction can control the program execution without human interaction.

6
Computer Science

Reduction in Paper Work and Cost

 The use of computers for data processing in an organization leads to reduction in paper work
and results in speeding up the process.
 As data in electronic files can be retrieved as and when required, the problem of maintenance
of large number of paper files gets reduced.
 Though the initial investment for installing a computer is high, it substantially reduces the
cost of each of its transaction.

Disadvantages of Computers
Following are certain disadvantages of computers.

No I.Q.

 A computer is a machine that has no intelligence to perform any task.


 Each instruction has to be given to the computer.
 A computer cannot take any decision on its own.

Dependency

 It functions as per the user’s instruction, thus it is fully dependent on humans.

Environment

 The operating environment of the computer should be dust free and suitable.

No Feeling

 Computers have no feelings or emotions.


 It cannot make judgment based on feeling, taste, experience, and knowledge unlike humans.

7
Computer Science

Computer - Applications

In this chapter, we will discuss the application of computers in various fields.

Business

A computer has high speed of calculation, diligence, accuracy, reliability, or versatility which
has made it an integrated part in all business organizations.

Computer is used in business organizations for −

 Payroll calculations
 Budgeting
 Sales analysis
 Financial forecasting
 Managing employee database
 Maintenance of stocks, etc.

Banking

8
Computer Science

Today, banking is almost totally dependent on computers.

Banks provide the following facilities −

 Online accounting facility, which includes checking current balance, making deposits and
overdrafts, checking interest charges, shares, and trustee records.
 ATM machines which are completely automated are making it even easier for customers to
deal with banks.

Insurance

Insurance companies are keeping all records up-to-date with the help of computers. Insurance
companies, finance houses, and stock broking firms are widely using computers for their
concerns.

Insurance companies are maintaining a database of all clients with information showing −

 Procedure to continue with policies


 Starting date of the policies
 Next due installment of a policy
 Maturity date
 Interests due
 Survival benefits
 Bonus

9
Computer Science

Education

The computer helps in providing a lot of facilities in the education system.

 The computer provides a tool in the education system known as CBE (Computer Based
Education).
 CBE involves control, delivery, and evaluation of learning.
 Computer education is rapidly increasing the graph of number of computer students.
 There are a number of methods in which educational institutions can use a computer to
educate the students.
 It is used to prepare a database about performance of a student and analysis is carried out on
this basis.

Marketing
In marketing, uses of the computer are following −

 Advertising − With computers, advertising professionals create art and graphics, write and
revise copy, and print and disseminate ads with the goal of selling more products.
 Home Shopping − Home shopping has been made possible through the use of computerized
catalogues that provide access to product information and permit direct entry of orders to be
filled by the customers.

10
Computer Science

Healthcare
Computers have become an important part in hospitals, labs, and dispensaries. They are being
used in hospitals to keep the record of patients and medicines. It is also used in scanning and
diagnosing different diseases. ECG, EEG, ultrasounds and CT scans, etc. are also done by
computerized machines.

Following are some major fields of health care in which computers are used.

 Diagnostic System − Computers are used to collect data and identify the cause of illness.
 Lab-diagnostic System − All tests can be done and the reports are prepared by computer.
 Patient Monitoring System − These are used to check the patient's signs for abnormality such
as in Cardiac Arrest, ECG, etc.
 Pharma Information System − Computer is used to check drug labels, expiry dates, harmful
side effects, etc.
 Surgery − Nowadays, computers are also used in performing surgery.

Engineering Design
Computers are widely used for Engineering purpose.

One of the major areas is CAD (Computer Aided Design) that provides creation and
modification of images. Some of the fields are −

11
Computer Science

 Structural Engineering − Requires stress and strain analysis for design of ships, buildings,
budgets, airplanes, etc.
 Industrial Engineering − Computers deal with design, implementation, and improvement of
integrated systems of people, materials, and equipment.
 Architectural Engineering − Computers help in planning towns, designing buildings,
determining a range of buildings on a site using both 2D and 3D drawings.

Military

Computers are largely used in defense. Modern tanks, missiles, weapons, etc. Military also
employs computerized control systems. Some military areas where a computer has been used are

 Missile Control
 Military Communication
 Military Operation and Planning
 Smart Weapons

12
Computer Science

Communication
Communication is a way to convey a message, an idea, a picture, or speech that is received and
understood clearly and correctly by the person for whom it is meant. Some main areas in this
category are −

 E-mail
 Chatting
 Usenet
 FTP
 Telnet
 Video-conferencing

Government
Computers play an important role in government services. Some major fields in this category are

 Budgets
 Sales tax department
 Income tax department
 Computation of male/female ratio
 Computerization of voters lists
 Computerization of PAN card
 Weather forecasting

13
Computer Science

Computer - Types

Computers can be broadly classified by their speed and computing power.

S.No. Type Specifications

PC (Personal It is a single user computer system having moderately powerful


1
Computer) microprocessor

It is also a single user computer system, similar to personal computer however


2 Workstation
has a more powerful microprocessor.

It is a multi-user computer system, capable of supporting hundreds of users


3 Mini Computer
simultaneously.

It is a multi-user computer system, capable of supporting hundreds of users


4 Main Frame
simultaneously. Software technology is different from minicomputer.

It is an extremely fast computer, which can execute hundreds of millions of


5 Supercomputer
instructions per second.

PC (Personal Computer)

A PC can be defined as a small, relatively inexpensive computer designed for an individual user.
PCs are based on the microprocessor technology that enables manufacturers to put an entire CPU
on one chip. Businesses use personal computers for word processing, accounting, desktop
publishing, and for running spreadsheet and database management applications. At home, the
most popular use for personal computers is playing games and surfing the Internet.

Although personal computers are designed as single-user systems, these systems are normally
linked together to form a network. In terms of power, now-a-days high-end models of the
Macintosh and PC offer the same computing power and graphics capability as low-end
workstations by Sun Microsystems, Hewlett-Packard, and Dell.

14
Computer Science

Workstation

Workstation is a computer used for engineering applications (CAD/CAM), desktop publishing,


software development, and other such types of applications which require a moderate amount of
computing power and relatively high quality graphics capabilities.

Workstations generally come with a large, high-resolution graphics screen, large amount of
RAM, inbuilt network support, and a graphical user interface. Most workstations also have mass
storage device such as a disk drive, but a special type of workstation, called diskless workstation,
comes without a disk drive.

Common operating systems for workstations are UNIX and Windows NT. Like PC, workstations
are also single-user computers like PC but are typically linked together to form a local-area
network, although they can also be used as stand-alone systems.

Minicomputer
It is a midsize multi-processing system capable of supporting up to 250 users simultaneously.

Mainframe
Mainframe is very large in size and is an expensive computer capable of supporting hundreds or
even thousands of users simultaneously. Mainframe executes many programs concurrently and
supports many simultaneous execution of programs.

15
Computer Science

Supercomputer
Supercomputers are one of the fastest computers currently available. Supercomputers are very
expensive and are employed for specialized applications that require immense amount of
mathematical calculations (number crunching).

For example, weather forecasting, scientific simulations, (animated) graphics, fluid dynamic
calculations, nuclear energy research, electronic design, and analysis of geological data (e.g. in
petrochemical prospecting).

Computer - Components
All types of computers follow the same basic logical structure and perform the following five
basic operations for converting raw input data into information useful to their users.

16
Computer Science

S.No. Operation Description


1 Take Input The process of entering data and instructions into the computer system.
Saving data and instructions so that they are available for processing as
2 Store Data
and when required.
Performing arithmetic, and logical operations on data in order to
3 Processing Data
convert them into useful information.
Output The process of producing useful information or results for the user, such
4
Information as a printed report or visual display.
Control the Directs the manner and sequence in which all of the above operations
5
workflow are performed.

Input Unit
This unit contains devices with the help of which we enter data into the computer. This unit
creates a link between the user and the computer. The input devices translate the information into
a form understandable by the computer.

CPU (Central Processing Unit)


CPU is considered as the brain of the computer. CPU performs all types of data processing
operations. It stores data, intermediate results, and instructions (program). It controls the
operation of all parts of the computer.

CPU itself has the following three components −

 ALU (Arithmetic Logic Unit)


 Memory Unit
 Control Unit

17
Computer Science

Output Unit
The output unit consists of devices with the help of which we get the information from the
computer. This unit is a link between the computer and the users. Output devices translate the
computer's output into a form understandable by the users.

Computer – CPU (Central Processing Unit)


Central Processing Unit (CPU) consists of the following features −

 CPU is considered as the brain of the computer.


 CPU performs all types of data processing operations.
 It stores data, intermediate results, and instructions (program).
 It controls the operation of all parts of the computer.

CPU itself has following three components.

 Memory or Storage Unit


 Control Unit
 ALU(Arithmetic Logic Unit)

18
Computer Science

Memory or Storage Unit


This unit can store instructions, data, and intermediate results. This unit supplies information to
other units of the computer when needed. It is also known as internal storage unit or the main
memory or the primary storage or Random Access Memory (RAM).

Its size affects speed, power, and capability. Primary memory and secondary memory are two
types of memories in the computer. Functions of the memory unit are −

 It stores all the data and the instructions required for processing.
 It stores intermediate results of processing.
 It stores the final results of processing before these results are released to an output device.
 All inputs and outputs are transmitted through the main memory.

Control Unit
This unit controls the operations of all parts of the computer but does not carry out any actual
data processing operations.

Functions of this unit are −

 It is responsible for controlling the transfer of data and instructions among other units of a
computer.
 It manages and coordinates all the units of the computer.
 It obtains the instructions from the memory, interprets them, and directs the operation of the
computer.
 It communicates with Input/Output devices for transfer of data or results from storage.
 It does not process or store data.

19
Computer Science

ALU (Arithmetic Logic Unit)


This unit consists of two subsections namely,

 Arithmetic Section
 Logic Section

Arithmetic Section

Function of arithmetic section is to perform arithmetic operations like addition, subtraction,


multiplication, and division. All complex operations are done by making repetitive use of the
above operations.

Logic Section

Function of logic section is to perform logic operations such as comparing, selecting, matching,
and merging of data.

Computer - Input Devices


Input device is any peripheral (piece of computer hardware equipment to provide data
and control signals to an information processing system such as a computer or other
information appliance. Input device Translate data from form that humans understand to
one that the computer can work with. Most common are keyboard and mouse

Following are some of the important input devices which are used in a computer −

 Keyboard
 Mouse
 Joy Stick
 Light pen
 Track Ball
 Scanner
 Graphic Tablet
 Microphone
 Magnetic Ink Card
Reader(MICR)
 Optical Character
Reader(OCR)
 Bar Code Reader
 Optical Mark
Reader(OMR)

20
Computer Science

Computer - Output Devices


An output device is any piece of computer hardware equipment used to communicate the results
of data processing carried out by an information processing system (such as a computer) which
converts the electronically generated information into human readable form.

Following are some of the important output devices used in a computer.

 Monitors
 Plotters
 Printer (All types)
 Projector
 Speaker(s)
 LCD Projection Panels
 Computer Output Microfilm (COM)

Note Basic types of monitors are a.Cathode Ray Tube (CRT). B. Liquid Crystal Displays
(LCD).
 C.light-emitting diode (LED).
 Printer types: 1-Laser Printer. 2-Ink Jet Printer. 3-Dot Matrix Printer

Computer - Memory
memory is just like a human brain. It is used to store data and instructions. Computer memory is
the storage space in the computer, where data is to be processed and instructions required for
processing are stored. The memory is divided into large number of small parts called cells. Each
location or cell has a unique address, which varies from zero to memory size minus one. For
example, if the computer has 64k words, then this memory unit has 64 * 1024 = 65536 memory
locations. The address of these locations varies from 0 to 65535.

21
Computer Science

Memory is primarily of three types −

 Cache Memory
 Primary Memory/Main Memory
 Secondary Memory

Cache Memory
Cache memory is a very high speed semiconductor memory which can speed up the CPU. It acts
as a buffer between the CPU and the main memory. It is used to hold those parts of data and
program which are most frequently used by the CPU. The parts of data and programs are
transferred from the disk to cache memory by the operating system, from where the CPU can
access them.

Advantages

The advantages of cache memory are as follows −

 Cache memory is faster than main memory.


 It consumes less access time as compared to main memory.
 It stores the program that can be executed within a short period of time.
 It stores data for temporary use.

Disadvantages

The disadvantages of cache memory are as follows −

 Cache memory has limited capacity.


 It is very expensive.

22
Computer Science

Primary Memory (Main Memory)


Primary memory holds only those data and instructions on which the computer is currently
working. It has a limited capacity and data is lost when power is switched off. It is generally
made up of semiconductor device. These memories are not as fast as registers. The data and
instruction required to be processed resides in the main memory. It is divided into two
subcategories RAM and ROM.

Characteristics of Main Memory

 These are semiconductor memories.


 It is known as the main memory.
 Usually volatile memory.
 Data is lost in case power is switched off.
 It is the working memory of the computer.
 Faster than secondary memories.
 A computer cannot run without the primary memory.

Secondary Memory
This type of memory is also known as external memory or non-volatile. It is slower than the
main memory. These are used for storing data/information permanently. CPU directly does not
access these memories, instead they are accessed via input-output routines. The contents of
secondary memories are first transferred to the main memory, and then the CPU can access it.
For example, disk, CD-ROM, DVD, etc.

23
Computer Science

Characteristics of Secondary Memory

 These are magnetic and optical memories.


 It is known as the backup memory.
 It is a non-volatile memory.
 Data is permanently stored even if power is switched off.
 It is used for storage of data in a computer.
 Computer may run without the secondary memory.
 Slower than primary memories.

Computer - Memory Units


Memory unit is the amount of data that can be stored in the storage unit. This storage capacity is
expressed in terms of Bytes.

The following table explains the main memory storage units −

S.No. Unit & Description


Bit (Binary Digit)
1
A binary digit is logical 0 and 1 representing a passive or an active state of a component in
an electric circuit.
Nibble
2
A group of 4 bits is called nibble.
Byte
3
A group of 8 bits is called byte. A bit is the smallest unit, which can represent a data item
or a character.
Word

A computer word, like a byte, is a group of fixed number of bits processed as a unit, which
4
varies from computer to computer but is fixed for each computer.

The length of a computer word is called word-size or word length. It may be as small as 8

24
Computer Science

bits or may be as long as 96 bits. A computer stores the information in the form of
computer words.

The following table lists some higher storage units −

S.No. Unit & Description


Kilobyte (KB)
1
1 KB = 1024 Bytes
Megabyte (MB)
2
1 MB = 1024 KB
GigaByte (GB)
3
1 GB = 1024 MB
TeraByte (TB)
4
1 TB = 1024 GB
PetaByte (PB)
5
1 PB = 1024 TB

25
Computer Science

Computer - Hardware

Hardware represents the physical and tangible components of a computer, i.e. the components
that can be seen and touched.

Examples of Hardware are the following −

 Input devices − keyboard, mouse, etc.


 Output devices − printer, monitor, etc.
 Secondary storage devices − Hard disk, CD, DVD, etc.
 Internal components − CPU, motherboard, RAM, etc.

Relationship between Hardware and Software


 Hardware and software are mutually dependent on each other. Both of them must work together
to make a computer produce a useful output.
 Software cannot be utilized without supporting hardware.
 Hardware without a set of programs to operate upon cannot be utilized and is useless.
 To get a particular job done on the computer, relevant software should be loaded into the
hardware.
 Hardware is a one-time expense.
 Software development is very expensive and is a continuing expense.
 Different software applications can be loaded on a hardware to run different jobs.
 A software acts as an interface between the user and the hardware.
 If the hardware is the 'heart' of a computer system, then the software is its 'soul'. Both are
complementary to each other.

26
Computer Science

Computer - Software
Software is a set of programs, which is designed to perform a well-defined function. A program
is a sequence of instructions written to solve a particular problem.

There are two types of software −

 System Software
 Application Software

System Software
The system software is a collection of programs designed to operate, control, and extend the
processing capabilities of the computer itself. System software is generally prepared by the
computer manufacturers. These software products comprise of programs written in low-level
languages, which interact with the hardware at a very basic level. System software serves as the
interface between the hardware and the end users.

Some examples of system software are Operating System, Compilers, Interpreter, Assemblers,
etc.

Here is a list of some of the most prominent features of a system software −

 Close to the system


 Fast in speed
 Difficult to design
 Difficult to understand
 Less interactive
 Smaller in size
 Difficult to manipulate
 Generally written in low-level language

27
Computer Science

Application Software
Application software products are designed to satisfy a particular need of a particular
environment. All software applications prepared in the computer lab can come under the
category of Application software.

Application software may consist of a single program, such as Microsoft's notepad for writing
and editing a simple text. It may also consist of a collection of programs, often called a software
package, which work together to accomplish a task, such as a spreadsheet package.

Examples of Application software are the following −

 Payroll Software
 Student Record Software
 Inventory Management Software
 Income Tax Software
 Railways Reservation Software
 Microsoft Office Suite Software
 Microsoft Word
 Microsoft Excel
 Microsoft PowerPoint

Features of application software are as follows −

 Close to the user


 Easy to design
 More interactive
 Slow in speed
 Generally written in high-level language
 Easy to understand
 Easy to manipulate and use
 Bigger in size and requires large storage space
 Write briefly the difference between Hardware and Software?

28
Computer Science

Computer Number System

29
Computer Science

Data and Program Representation


In order to be understood by a computer, data and software programs need to be represented
appropriately. Consequently, coding systems are used to represent data and programs in a
manner that can be understood by the computer.

Digital Data Representation


Virtually all computers today—such as the embedded computers, mobile devices, personal
computers, servers, mainframes, and supercomputers are digital computers. Most digital
computers are binary computers, which can understand only two states, usually thought of as off
and on and represented by the digits 0 and 1. Consequently, all data processed by a binary
computer must be in binary form (0s and 1s). The 0s and 1s used to represent data can be
represented in a variety of ways, such as with an open or closed circuit, the absence or presence
of electronic current, two different types of magnetic alignment on a storage medium, and soon.

Ways of representing 0 and 1. Binary computers recognize only


two states—off and on—usually represented by 0 and 1.

Regardless of their physical representations, these 0s and 1s are commonly referred to as bits, a
computing term derived from the phrase binary digits. A bit is the smallest unit of data that a
binary computer can recognize. Therefore, the input you enter via a keyboard, the software
program you use to play your music collection, the term paper stored on your USB flash drive,
and the digital photos located on your mobile phone are all just groups of bits. Representing data
in a form that can be understood by a digital computer is called digital data representation.
Because most computers can only understand data and instructions in binary form, binary can be
thought of as the computer’s natural language. People, of course, do not speak in binary. For
example, you are not likely to go up to a friend and say,
0100100001001001
which translates into the word “HI” using one binary coding system. People communicate with
one another in their natural languages, such as English, Chinese, Spanish, and French. For
example, this book is written in English, which uses a 26-character alphabet. In addition, most
countries use a numbering system with 10 possible symbols—0 through 9. As already
mentioned, however, binary computers understand only 0s and 1s. For us to interact with a
computer, a translation process from our natural language to 0s and 1s and then back again to our
natural language is required. When we enter data into a computer system, the computer translates

30
Computer Science

the natural-language symbols we input into binary 0s and 1s. After processing the data, the
computer translates and outputs the resulting information in a form that we can understand.

A bit by itself typically represents only a fraction of a piece of data. Consequently, large
numbers of bits are needed to represent a written document, computer program, digital photo,
music file, or virtually any other type of data. Eight bits grouped together are collectively
referred to as a byte. It is important to be familiar with this concept because byte terminology is
frequently used in a variety of computer contexts, such as to indicate the size of a document or
digital photo, the amount of memory a computer has, or the amount of room left on a storage
medium. Because these quantities often involve thousands or millions of bytes, prefixes are
commonly used in conjunction with the term byte to represent larger amounts of data. For
instance, a kilobyte (KB) is equal to 1,024 bytes, but is usually thought of as approximately
1,000 bytes; a megabyte (MB) is about 1 million bytes; a gigabyte (GB) is about 1 billion bytes;
a terabyte (TB) is about 1 trillion bytes; a petabyte (PB) is about 1,000 terabytes.

Bits and Byte.

Computers represent programs and data through a variety of binary-based coding systems. The
coding system used depends primarily on the type of data that needs to be represented; the most
common coding systems are discussed in the next few sections.

Computer - Number System


When we type some letters or words, the computer translates them in numbers as computers can
understand only numbers. A computer can understand the positional number system where there
are only a few symbols called digits and these symbols represent different values depending on
the position they occupy in the number.

The value of each digit in a number can be determined using −

 The digit
 The position of the digit in the number
 The base of the number system (where the base is defined as the total number of digits available
in the number system)

31
Computer Science

Representing Numerical Data


A numbering system is a way of representing numbers. The number system that we use in our
day-to-day life is the decimal number system. The numbering system we commonly use is called
the decimal numbering system because it uses 10 symbols—the digits 0, 1, 2, 3, 4, 5, 6, 7, 8,
and 9—to represent all possible numbers. Numbers greater than nine, such as 21 and 683, are
represented using combinations of these 10 symbols. In decimal number system, the successive
positions to the left of the decimal point represent units, tens, hundreds, thousands, and so on.
Each position represents a specific power of the base (10). For example, the decimal number
7216 consists of the digit 6 in the units position, 1 in the tens position, 2 in the hundreds position,
and 7 in the thousands position. The binary numbering system uses only two symbols—the
digits 0 and 1—to represent all possible numbers. Consequently, binary computers use the binary
numbering system to represent numbers and to perform math computations.

Examples of using the decimal and binary numbering systems.

In both numbering systems, the position of each digit determines the power, or exponent, to
which the base number (10 for decimal or 2 for binary) is raised. In the decimal numbering
system, going from right to left, the first position or column (the ones column) represents 100 or
1; the second column (the tens column) represents 101 or 10; the third column (the hundreds

32
Computer Science

column) represents 102 or 100; and so forth. Therefore, as the previous figure shows, the
decimal number 7,216 is understood as 7 × 103 + 2 ×102 + 1 × 10l + 6 × 100 or 7,000 + 200 + 10
+ 6 or 7,216. In binary, the concept is the same but the columns have different place values. For
example, the far-right column is the ones column (for 20), the second column is the twos column
(21), the third column is the fours column (22), and so on. Therefore, although 1001 represents
“one thousand one” in decimal notation, 1001 represents “nine” (1 × 23 + 0 × 22 + 0 × 21 + 1 × 20
or 8 + 0 + 0 + 1 or 9) in the binary numbering system, as illustrated in the lower half of the
previous figure.

As a computer programmer or an IT professional, you should understand the following number


systems which are frequently used in computers.

S.No. Number System and Description


Binary Number System
1
Base 2. Digits used : 0, 1
Octal Number System
2
Base 8. Digits used : 0 to 7
Hexa Decimal Number System
3
Base 16. Digits used: 0 to 9, Letters used : A- F

Binary Number System


Characteristics of the binary number system are as follows −

 Uses two digits, 0 and 1


 Also called as base 2 number system
 Each position in a binary number represents a 0 power of the base (2). Example 20
 Last position in a binary number represents a x power of the base (2). Example 2x where x
represents the last position - 1.

Example

Binary Number: 101012


Calculating Decimal Equivalent −
Step Binary Number Decimal Number
Step 1 101012 ((1 x 2 ) + (0 x 23) + (1 x 22) + (0 x 21) + (1 x 20))10
4

Step 2 101012 (16 + 0 + 4 + 0 + 1)10


Step 3 101012 2110

Note − 101012 is normally written as 10101.

33
Computer Science

Octal Number System


Characteristics of the octal number system are as follows −

 Uses eight digits, 0, 1, 2, 3, 4, 5, 6, 7


 Also called as base 8 number system
 Each position in an octal number represents a 0 power of the base (8). Example 80
 Last position in an octal number represents a x power of the base (8). Example 8x where x
represents the last position - 1

Example

Octal Number: 125708

Calculating Decimal Equivalent −

Step Octal Number Decimal Number


Step 1 125708 ((1 x 8 ) + (2 x 83) + (5 x 82) + (7 x 81) + (0 x 80))10
4

Step 2 125708 (4096 + 1024 + 320 + 56 + 0)10


Step 3 125708 549610

Note − 125708 is normally written as 12570.

Hexadecimal Number System


Characteristics of hexadecimal number system are as follows −

 Uses 10 digits and 6 letters, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F


 Letters represent the numbers starting from 10. A = 10. B = 11, C = 12, D = 13, E = 14, F = 15
 Also called as base 16 number system
 Each position in a hexadecimal number represents a 0 power of the base (16). Example, 160
 Last position in a hexadecimal number represents a x power of the base (16). Example 16x where
x represents the last position - 1

Example

Hexadecimal Number: 19FDE16

Calculating Decimal Equivalent −

Binary
Step Decimal Number
Number
Step 1 19FDE16 ((1 x 164) + (9 x 163) + (F x 162) + (D x 161) + (E x 160))10

34
Computer Science

Step 2 19FDE16 ((1 x 164) + (9 x 163) + (15 x 162) + (13 x 161) + (14 x 160))10
Step 3 19FDE16 (65536+ 36864 + 3840 + 208 + 14)10
Step 4 19FDE16 10646210

Note − 19FDE16 is normally written as 19FDE.

Computer - Number Conversion


There are many methods or techniques which can be used to convert numbers from one base to
another. In this chapter, we'll demonstrate the following −

 Other Base System to Decimal


 Decimal to Other Base System
 Other Base System to Non-Decimal
 Shortcut method - Binary to Octal
 Shortcut method - Octal to Binary
 Shortcut method - Binary to Hexadecimal
 Shortcut method - Hexadecimal to Binary

Other Base System to Decimal System


Step 1 − Determine the column (positional) value of each digit (this depends on the position of
the digit and the base of the number system).

Step 2 − Multiply the obtained column values (in Step 1) by the digits in the corresponding
columns.

Step 3 − Sum the products calculated in Step 2. The total is the equivalent value in decimal.

Example

Binary Number: 111012

Calculating Decimal Equivalent −

Step Binary Number Decimal Number


Step 1 111012 ((1 x 24) + (1 x 23) + (1 x 22) + (0 x 21) + (1 x 20))10
Step 2 111012 (16 + 8 + 4 + 0 + 1)10
Step 3 111012 2910
Binary Number: 111012 = Decimal Number: 2910

35
Computer Science

Example 1: Convert from binary (11010.11)2 and (1010.011)2 to decimal

1 × 24 + 1 × 23 + 0 × 22 + 1 × 21 + 0 × 20 + 1 × 2-1 + 1 × 2-2 = 16 + 8 + 2 + 0.5 + 0.25 = (26.75)10

1 × 23 + 0 × 22 + 1 × 21 + 0 × 20 + 0 × 2-1 + 1 × 2-2 + 1 × 2-3 = 8 + 2 + 0.25 + 0.125 = (10.375)10

Example 2: Convert (123.2)4 to decimal

1 × 43 + 2 × 42 + 3 × 41 + 2 × 40 + 2 × 4-1 = 64 + 32 + 2 + 0.5 = (98.5)10

Example 3: Convert (4021.2)5 to decimal

4 × 53 + 0 × 52 + 2 × 51 + 1 × 50 + 2 × 5-1 = 500 + 10 + 1 + 0.4 = (511.4)10

Example 4: Convert (630.4)8 and (147.3)8 to decimal

6 × 82 + 3 × 81 + 0 × 80 + 4 × 8-1 = 384 + 24 + 0.5 = (408.5)10

1 × 82 +4 × 81 + 7 × 80 + 3 × 8-1 = 64 + 32 + 7 + 0.5 = (103.375)10

Example 5: Convert (B65F)16 and (A2F)16 to decimal

11 × 163 + 6 × 162 + 5 × 161 + 15 ×160 = 12288 + 1536 + 15 = (13919)10

10 × 162 + 2 × 161 + 15 ×160 = 2560 + 32 + 15 = (2607)10

Decimal to Other Base System


Step 1 − Divide the decimal number to be converted by the value of the new base.

Step 2 − Get the remainder from Step 1 as the rightmost digit (least significant digit) of the new
base number.

Step 3 − Divide the quotient of the previous divide by the new base.

Step 4 − Record the remainder from Step 3 as the next digit (to the left) of the new base number.

Repeat Steps 3 and 4, getting remainders from right to left, until the quotient becomes zero in
Step 3.

The last remainder thus obtained will be the Most Significant Digit (MSD) of the new base
number.

Example: Decimal Number: 2910

Calculating Binary Equivalent −

36
Computer Science

Step Operation Result Remainder


Step 1 29 / 2 14 1
Step 2 14 / 2 7 0
Step 3 7/2 3 1
Step 4 3/2 1 1
Step 5 1/2 0 1

As mentioned in Steps 2 and 4, the remainders have to be arranged in the reverse order so that
the first remainder becomes the Least Significant Digit (LSD) and the last remainder becomes
the Most Significant Digit (MSD).

Decimal Number: 2910 = Binary Number: 111012.

Example 1: Convert from decimal (53)10 and (41)10 to binary


Integer Remainder Integer Remainder
53 2 41 2
26 1 20 1
13 0 10 0
6 1 5 0
3 0 2 1
1 1 1 0
0 1 0 1
Decimal (53)10 = (110101)2 Decimal (41)10 = (110101)2

Example 2: Convert from decimal (153)10 and (250)10 to octal


Integer Remainder Integer Remainder
153 8 250 8
19 1 31 2
2 3 3 7
0 2 0 3

Decimal (153)10 = (231)8 Decimal (250)10 = (372 )8

Example 3: Convert from decimal (596)10 and (100)10 to hexadecimal


Integer Remainder Integer Remainder
596 16 1000 16
37 4 62 8
2 5 3 14
0 2 5 3

Decimal (596)10 = (254)16 Decimal (100)10 = (3E8)16

37
Computer Science

The conversion of a decimal fraction to binary is accomplished by a method similar to that used
for integers. However, multiplication is used instead of division, and integers instead of
remainders are accumulated. Again, the method is best explained by example.

Example 5: Convert from decimal (0.6875)10 to Binary

Example 6: Convert from decimal (0.513)10 to 0ctal

This process is continued until we have


obtained a sufficient number of digits.

Other Base System to Non-Decimal System


Step 1 − Convert the original number to a decimal number (base 10).

Step 2 − Convert the decimal number so obtained to the new base number.

Example: Octal Number: 258


Calculating Binary Equivalent −

Step 1 - Convert to Decimal

Step Octal Number Decimal Number


Step 1 258 ((2 x 81) + (5 x 80))10
Step 2 258 (16 + 5)10
Step 3 258 2110
Octal Number : 258 = Decimal Number : 2110

38
Computer Science

Step 2 - Convert Decimal to Binary

Step Operation Result Remainder


Step 1 21 / 2 10 1
Step 2 10 / 2 5 0
Step 3 5/2 2 1
Step 4 2/2 1 0
Step 5 1/2 0 1

Decimal Number: 2110 = Binary Number: 101012

Octal Number: 258 = Binary Number: 101012

Shortcut Method ─ Binary to Octal


Step 1 − Divide the binary digits into groups of three (starting from the right).

Step 2 − Convert each group of three binary digits to one octal digit.

Example

Binary Number: 101012

Calculating Octal Equivalent −

Step Binary Number Octal Number


Step 1 101012 010 101
Step 2 101012 28 58
Step 3 101012 258

Binary Number: 101012 = Octal Number: 258

Example 1: Convert from binary (10110111)2 and (01101100)2 to octal

a) 10110111 = 010 110 111 = (267)8


b) 01101100 = 001 101 100 = (154)8
c) 10110001101011.111100000110 = 10 110 001 101 011.111 100 000 110 = (26153.7406)8

39
Computer Science

Shortcut Method ─ Octal to Binary


Step 1 − Convert each octal digit to a 3-digit binary number (the octal digits may be treated as
decimal for this conversion).

Step 2 − Combine all the resulting binary groups (of 3 digits each) into a single binary number.

Example

Octal Number: 258

Calculating Binary Equivalent −

Step Octal Number Binary Number


Step 1 258 210 510
Step 2 258 0102 1012
Step 3 258 0101012

Octal Number: 258 = Binary Number : 101012

Example 1: Convert from octal (327)8, (601)8 and (673.124)8 to binary

a) (327)8 = 011 010 111 = 011010111


b) (601)8 = 110 000 001 = 110000001
c) (673.124)8 = 110 111 011 . 001 010 100 = 110111011.001010100

Shortcut Method ─ Binary to Hexadecimal


Step 1 − Divide the binary digits into groups of four (starting from the right).

Step 2 − Convert each group of four binary digits to one hexadecimal symbol.

Example: Binary Number: 101012

Calculating hexadecimal Equivalent −

Step Binary Number Hexadecimal Number


Step 1 101012 0001 0101
Step 2 101012 110 510
Step 3 101012 1516

Binary Number : 101012 = Hexadecimal Number : 1516


40
Computer Science

Example 1: Convert from binary (10110111)2 and (01101100)2 to Hexadecimal

a) 10110111 = 1011 0111 = (B7)16


b) 01101100 = 0110 1100 = (6C)16
c) (10110001101011.11110010)2 = ( 10 1100 0110 1011.1111 0010 )2 = (2C6B.F2)16

Shortcut Method - Hexadecimal to Binary


Step 1 − Convert each hexadecimal digit to a 4-digit binary number (the hexadecimal digits may
be treated as decimal for this conversion).

Step 2 − Combine all the resulting binary groups (of 4 digits each) into a single binary number.

Example

Hexadecimal Number: 1516

Calculating Binary Equivalent −

Step Hexadecimal Number Binary Number


Step 1 1516 110 510
Step 2 1516 00012 01012
Step 3 1516 000101012

Hexadecimal Number: 1516 = Binary Number: 101012

Example 1: Convert from Hexadecimal (A2E)16 and (60F)16 to binary

a) (A2E)16 = 1010 0010 1110 = 101000101110


b) (60F)16 = 0110 0000 1111 = 011000001111
c) (306.D)16 = 0011 0000 0110. 1101 = 001100000110.1101

41
Computer Science

Complements
Complements are used in digital computers for simplifying the subtraction operation and for logical
manipulation. Simplifying operations leads to simpler, less expensive circuits to implement the
operations. There are two types of complements for each base-r system: the radix complement and the
diminished radix complement. The first is referred to as the r's complement and the second as the (r-1)'s
complement. When the value of the base r is substituted in the name, the two types are referred to as the
2‘s complement and 1‘s complement for binary numbers, and the 10‘s complement and 9‘s complement
for decimal numbers.

Diminished Radix Complement


Given a number N in base r having n digits, the (r - 1)'s complement of N , i.e., its diminished
radix complement, is defined as (rn- 1) - N. For decimal numbers, r = 10 and r - 1 = 9, so the 9’s
complement of N is (10n- 1) - N. In this case, 10 represent a number that consists of a single 1
followed by n 0’s. 10n- 1 is a number represented by n 9’s.

For example, if n = 4, we have 104= 10,000 and 104- 1 = 9999. It follows that the 9’s
complement of a decimal number is obtained by subtracting each digit from 9.Here are some
numerical examples:

The 9's complement of 546700 is 999999 - 546700 = 453299.

The 9"s complement of 012398 is 999999 - 012398 = 987601.

For binary numbers, r = 2 and r - 1 = 1, so the 1’s complement of N is (2n- 1) - N.


Again, 2n- 1 is a binary number that consists of a 1 followed by n 0’s. (2n- 1) is a binary number
represented by n 1’s. For example, if n = 4, we have 24= (10000)2 and 24- 1 = (1111)

42
Computer Science

. Thus, the 1’s complement of a binary number is obtained by subtracting each digit from 1.
However, when subtracting binary digits from 1, we can have either 1 - 0 = 1 o r 1 - 1 = 0,
which causes the bit to change from 0 to 1 or from 1 to 0, respectively. Therefore, the 1’s
complement of a binary number is formed by changing 1’s to 0’s and 0’s to 1’s. The
following are some numerical examples:

The 1’s complement of 1011000 is 0100111.

The 1’s complement of 0101101 is 1010010.

The (r - 1)'s complement of octal or hexadecimal numbers is obtained by subtracting each digit
from 7 or F (decimal 15), respectively.

Radix Complement
The r’s complement of an n-digit number N in base r is defined as rn - N for N ≠ 0 and as 0 for
N = 0. Comparing with the (r - 1)'s complement, we note that the r’s complement is obtained by
adding 1 to the (r - 1)'s complement, since rn - N = [(rn- 1) - N] + 1. Thus, the 10’s complement
of decimal 2389 is 7610 + 1 = 7611 and is obtained by adding 1 to the 9’s complement value.The
2’s complement of binary 101100 is 010011 + 1 = 010100 and is obtained by adding 1 to the 1’s-
complement value.

Since 10 is a number represented by a 1 followed by n 0’s, 10n- N, which is the 10’s


complement of N, can be formed also by leaving all least significant 0’s unchanged, subtracting
the first nonzero least significant digit from 10, and subtracting all higher significant digits from
9. Thus,

The 10’s complement of 012398 is 987602

and

The 10’s complement of 246700 is 753300

The 10’s complement of the first number is obtained by subtracting 8 from 10 in the least
significant position and subtracting all other digits from 9. The 10’s complement of the second
number is obtained by leaving the two least significant 0’s unchanged, subtracting 7 from 10,
and subtracting the other three digits from.

Similarly, the 2’s complement can be formed by leaving all least significant 0’s and the first 1
unchanged and replacing 1’s with 0’s and 0’s with 1’s in all other higher significant digits. For
example,
The 2’s complement of 1101100 is 0010100
and

The 2’s complement of 0110111 is 1001001

43
Computer Science

The 2’s complement of the first number is obtained by leaving the two least significant 0’s and
the first 1 unchanged and then replacing 1’s with 0’s and 0’s with 1’s in the other four most
significant digits. The 2’s complement of the second number is obtained by leaving the least
significant 1 unchanged and complementing all other digits.

In the previous definitions, it was assumed that the numbers did not have a radix point. If the
original number N contains a radix point, the point should be removed temporarily in order to
form the r’s or (r - 1)'s complement. The radix point is then restored to the complemented
number in the same relative position. It is also worth mentioning that the complement of the
complement restores the number to its original value. To see this relationship, note that the
r’s complement of N is rn- N, so that the complement of the complement is rn- (rn- N) = N and
is equal to the original number.

1’s and 2’s COMPLEMENTS


 1’s and 2’s complement allow the representation of negative numbers in binary.
 The 1's complement of a binary number is found by simply changing all 1s to 0s and all 0s
to 1s.
Examples
The 1’s complement of 10001111 = 01110000 .
The 1’s complement of 01101100 = 10010011 .
The 1’s complement of 00110011 = 11001100 .
 The 2's complement of a binary number is found by adding 1 to the LSB of the 1 's
complement.
Example
 The 2’s complement of 10001111 = 01110000 +1 = 01110001
 The 2’s complement of 01101100 = 10010011 + 1 =10010100
 The 2’s complement of 00110011 = 11001100 + 1 = 11001101

 Another way of obtaining the 2’s complement of a binary number is to start with the LSB
(the rightmost bit) and leave the bits unchanged until you find the first 1. Leave the first 1
unchanged and complement the rest of the bits (change 0 to 1 and 1 to 0).
Example

The 2’s complement of 10001111 = 01110001


The 2’s complement of 01101100 = 10010100
The 2’s complement of 00110011 = 11001101

44
Computer Science

Representation of Signed Numbers

There are three basic ways to represent signed numbers:

 sign-magnitude
 1’s complement
 2’s complement.

Sign-Magnitude

 The number consists of two parts:


o the MSB (most significant bit) represents the sign
o the other bits represent the magnitude of the number.
 If the sign bit is 1 the number is negative and if it is 0 the number is positive.
o If the MSB is 1 the number is –ve
o If the MSB is 0 the number is +ve
 The sign-magnitude suffers from the problem of two representations of zero.

Examples: decimal to sign-magnitude

 -30 = 1 0011110 (The leftmost 1 indicates that the number is negative.


The remaining 7-bits carry the magnitude of 30)
 30 = 0 0011110 (The only difference between –30 and +30 is the sign
bit because the magnitude bits are similar in both numbers.)
 -121 = 1 1111001
 99 = 0 1100011

Examples: sign-magnitude to decimal

 10111001 = -57 (The leftmost 1 indicates that the number is negative.


The remaining 7-bits carry the magnitude of 57)
 11111111 = -127 (The minimum number that can be represented in an 8-bit
register using sign-magnitude representation)
 01111111 = +127 (The maximum number that can be represented in
 an 8-bit register using sign-magnitude representation)

Range of numbers in Sign-Magnitude Representation

o for an n-bit number, the range of values that could be represented using sign-magnitude
notation is from
 –(2n-1-1) to +(2n-1-1).
o For example if n=8 the range is from –127 to 127

45
Computer Science

Representation of negative numbers in 1’s Complement

 Negative numbers are represented in 1’s complement format


 positive numbers are represented as the positive sign-magnitude numbers
 The 1’s complement representation like the sign-magnitude suffers from the problem of two
representations of zero.

Examples: decimal to 1’s complement

 30 = 00011110
 -30 = 11100001
o the number equals the 1’s complement of 30
 121 = 01111001
 -121 = 10000110
 99 = 01100011

Examples: 1’s complement to decimal

 10111001 = -01000110 = -70


o The leftmost 1 indicates that the number is negative. Take the 1’s complement of
the number to get the magnitude of 70
 11111111 = -00000000 = -0
o there are two representations of zero
 01111111 = +127
o The maximum +ve number
 10000000 = -01111111 = -127
o The maximum –ve number

Ranges of numbers in 1’s complement Representation

 –(2n-1-1) to +(2n-1-1).
o exactly the same as the range of numbers in sign-magnitude
o For example if n=8 the range is from –127 to 127

Representation of negative numbers in 2’s Complement

 Negative numbers are represented in 2’s complement format


 Positive numbers are represented exactly the same way as in sign-magnitude and in 1’s
complement
 In 2’s complement representation we overcame the problem with two representation of
zero.

46
Computer Science

Examples: decimal to 2’s complement

 30 = 00011110
 -30 = 11100010
o the number equals the 2’s complement of 30
 121 = 01111001
 -121 = 10000111
 99 = 01100011

Examples: 2’s complement to decimal

 10111001 = -01000111 = -71


o The leftmost 1 indicates that the number is negative.
o Take the 2’s complement of the number to get the magnitude of 71
 11111111 = -00000001 = -1
o No two representations of zero
 01111111 = +127
o The maximum +ve number
 10000000 = -10000000 = -128
o The minimum –ve number

Ranges of numbers in 2’s complement Representation

 –(2n-1) to +(2n-1-1)
 if n=8 the range is from –128 to 127

2's Complement Evaluation

 Positive and negative numbers in the 2's complement system are evaluated by summing the
weights in all bit positions where there are 1s and ignoring those positions where there are
zeros.
 The weight of the sign bit in a negative number is given a negative value

Example

 01010110 = 64 + 16 + 4 + 2 = +86
-27 26 25 24 23 22 21 2°

0 1 0 1 0 1 1 0

 10101010 = -128 + 32 + 8 + 2 = -86


-27 26 25 24 23 22 21 2°
1 0 1 0 1 0 1 0

47
Computer Science

Binary arithmetic operations with unsigned numbers

 Binary Addition

1 1 1 1 1 1 1 1 1 1

0 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1

0 1 1 1 1 1 0 0 0 1 0 0 0 0 1 1

1 0 1 1 1 0 1 1 1 0 0 1 1 0 0 0 0

11101101 + 01000011 = 100110000 This example shows that the result could not fit in 8-bits (
237 + 67 = 304) and the maximum capacity of 8-bits is 255. That is what we call overflow.

 Binary Subtraction

The four cases for subtracting binary digits (X - Y) are as follows X Y D B


0 0 0 0
D is the difference and B is the borrow 0 1 1 1
1 0 1 0
 Subtract the following binary numbers and put the result in 8-bits. 1 1 0 1
Verify your answer by converting into decimal:

a) 10111111 - 01111100 = 01000011 (191 - 124 = 67)

b) 11101101 – 01000011= 10101010 (237 – 67 = 170)

0 10 0 10

1 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1

0 1 1 1 1 1 0 0 0 1 0 0 0 0 1 1

0 1 0 0 0 0 1 1 1 0 1 0 1 0 1 0

 Binary Multiplication

a) 11100 x 101 = 10001100


(16+8+4) x (4+1) = (128+8+4) 28 x 5 = 140
b) 11011 x 1101 = 101011111
(16+8+2+1) x (8+4+1) = (256+64+16+8+4+2+1) 27 x 13 = 351

48
Computer Science

1 1 1 0 0 1 1 0 1 1
1 0 1 1 1 0 1
1 1 1 0 0 1 1 0 1 1
0 0 0 0 0 0 0 0 0 0
1 1 1 0 0 1 1 0 1 1
1 0 0 0 1 1 0 0 1 1 0 1 1
1 0 1 0 1 1 1 1 1

 Binary Division

11001 ÷ 101 = 101 1 0 1


1 0 1 1 1 0 0 1
(16+8+1) ÷ (4+1) = (4+1)
1 0 1
25 ÷ 5 = 5
1 0 1
1 0 1
0 0 0

Binary arithmetic operations with unsigned numbers

 Addition

We have four cases when adding two signed numbers;

 Both numbers are +ve.


 One +ve and the other is –ve with the +ve number with magnitude larger than the –ve number.
 One +ve and the other is –ve with the +ve number with magnitude smaller than the –ve
number.
 Both numbers are -ve.
1- Both numbers positive:
00000111 7
+ 00000100 +4
00001011 11
2- Positive number with magnitude larger than negative number:
00001111 15
+11111010 + -6
Discard carry —>1 1 0 0 0 0 1 0 0 1 9
3- Negative number with magnitude larger than positive number:
00010000 16
+11101000 + -24
11111000 -8 - (0 0 0 0 1 0 0 0)

49
Computer Science

4- Both numbers negative:


11111011 —5
+11110111 + -9
Discard carry—> 1 1 11110010 -14

 Overflow Condition

o When two numbers are added and the number of bits required to represent the sum
exceeds the number of bits in the two numbers, an overflow results
o incorrect sign bit
o only when both numbers are positive or both numbers are negative

Example 01111101 125


+ 00111010 + 58
10110111 183
o Incorrect sign
o Incorrect magnitude
o What if we have an extra bit?

 Subtraction with Complements

The subtraction of two n -digit unsigned numbers M-N in base r can be done as follows:

1. Add the minuend M to the r’s complement of the subtrahend N. Mathematically,


M + (rn - N) = M - N + rn
2. I f M ≤ N, the sum will produce an end carry rn, which can be discarded; what is left is
the result M - N.
3. I f M < N, the sum does not produce an end carry and is equal to rn - (N - M), which is the
r’s complement of (N - M). To obtain the answer in a familiar form, take the r’s complement
of the sum and place a negative sign in front.

The following examples illustrate the procedure:


1- Using 10’s complement, subtract 72532 - 3250.
M = 72532
10's complement of N = + 96750
Sum = 169282
Discard end carry 105 = - 100000
Answer = 69282
Note that M has five digits and N has only four digits. Both numbers must have the same
number of digits, so we write N as 03250. Taking the 10’s complement of N produces a 9 in the
most significant position. The occurrence of the end carry signifies that M ≥ N and that the
result is therefore positive.

50
Computer Science

2- Using 10’s complement, subtract 3250 - 72532.


M = 03250
10's complement of N = + 27468
Sum = 30718
There is no end carry. Therefore, the answer is -(10's complement of 30718) = -69282. Note that
since 3250 < 72532, the result is negative. Because we are dealing with unsigned numbers, there
is really no way to get an unsigned result for this case. When subtracting with complements, we
recognize the negative answer from the absence of the end carry and the complemented result.
When working with paper and pencil, we can change the answer to a signed negative number in
order to put it in a familiar form.
Subtraction with complements is done with binary numbers in a similar manner, using the
procedure outlined previously.

3- Given the two binary numbers X = 1010100 and Y = 1000011, perform the subtraction
(a) X - Y and (b) Y - X by using 2’s complements.
(a) X= 1010100
2's complement of Y = + 0111101
Sum = 10010001
7
Discard end carry 2 = - 10000000
Answer: X - Y = 0010001

(b) Y = 1000011
2's complement of X = + 0101100
Sum = 1101111

There is no end carry. Therefore, the answer is Y - X = -(2's complement of 1101111) =-0010001
Subtraction of unsigned numbers can also be done by means of the (r - 1)'s complement.
Remember that the (r- 1)'s complement is one less than the r’s complement. Because of this, the
result of adding the minuend to the complement of the subtrahend produces a sum that is one less
than the correct difference when an end carry occurs. Removing the end carry and adding 1 to
the sum is referred to as an end‐around carry.

Examples.: perform each of the following subtraction of signed numbers

A) 00001000-00000011 B) 00001100-11110111
C)11100111-00010011 D) 10001000-11100010

A) 00001000-00000011 = 00001000 + (-00000011)


= 00001000 + ( 11111101)
=1 00000101 = 5 (discard the carry)

B) 00001100-11110111 = 00001100 + (-11110111)


= 00001100 + ( 00001001)
= 00010101 = +21

51
Computer Science

C) 11100111-00010011 = 11100111 + (-00010011)


= 11100111 + ( 11101101)
= 1 11010100 = -44 (discard the carry)

D) 10001000-11100010 = 10001000 + (-11100010)


= 10001000 + ( 00011110)
= 10100110 = -90

E) 10001000 – 11100010
-120 - (-30) = -120 + 30 = -90
10001000 Minuend (-120)
+ 00011110 2's complement of subtrahend (+30)
10100110 Difference (-90)

BINARY CODED DECIMAL (BCD)

Although the binary number system is the most natural system for a computer because it is
readily represented in today’s electronic technology, most people are more accustomed to the
decimal system. One way to resolve this difference is to convert decimal numbers to binary,
perform all arithmetic calculations in binary, and then convert the binary results back to decimal.
This method requires that we store decimal numbers in the computer so that they can be
converted to binary. Since the computer can accept only binary values, we must represent the
decimal digits by means of a code that contains 1’s and 0’s. It is also possible to perform the
arithmetic operations directly on decimal numbers when they are stored in the computer in coded
form.

A binary code will have some unassigned bit combinations if the number of elements in the set is
not a multiple power of 2. The 10 decimal digits form such a set. A binary code that
distinguishes among 10 elements must contain at least four bits, but 6 out of the 16 possible
combinations remain unassigned. Different binary codes can be obtained by arranging four bits
into 10 distinct combinations. The code most commonly used for the decimal digits is the
straight binary assignment listed in the next Table. This scheme is called binary‐coded decimal
and is commonly referred to as BCD. Other decimal codes are possible and a few of them are
presented later in this section.

The next Table gives the four‐bit code for one decimal digit. A number with k decimal digits will
require 4k bits in BCD. Decimal 396 is represented in BCD with 12 bits as 0011 1001 0110, with
each group of 4 bits representing one decimal digit. A decimal number in BCD is the same as
its equivalent binary number only when the number is between 0 and 9. A BCD number greater
than 10 looks different from its equivalent binary number, even though both contain 1’s and 0’s.
Moreover, the binary combinations 1010 through 1111 are not used and have no meaning in
BCD. Consider decimal 185 and its corresponding value in BCD and binary:

52
Computer Science

Binary coded decimal (BCD) is used to represent each of the ten decimal digits as a 4-bit binary
code.

(185)10 = (0001 1000 0101 )BCD = (10111001 )2


(125)10 = (0001 0010 0101 )BCD = (1111 101 )2
(1476)10 = (0001 0100 0111 0110 )BCD = (10111000100)2
(3890)10 = (0011 1000 1001 0000 )BCD = (111100110010 )2

1000 0010 1001 = (829)10


BCD Addition
Consider the addition of two decimal digits in BCD, together with a possible carry from a
previous less significant pair of digits. Since each digit does not exceed 9, the sum cannot be
greater than 9 + 9 + 1 = 19, with the 1 being a previous carry. Suppose we add the BCD
digits as if they were binary numbers. Then the binary sum will produce a result in the range
from 0 to 19. In binary, this range will be from 0000 to 10011, but in BCD, it is from 0000 to
11001, with the first (i.e., leftmost) 1 being a carry and the next four bits being the BCD sum.
When the binary sum is equal to or less than 1001 (without a carry), the corresponding BCD
digit is correct. However, when the binary sum is greater than or equal to 1010, the result is an
invalid BCD digit. The addition of 6 = (0110)2 to the binary sum converts it to the correct digit
and also produces a carry as required. This is because a carry in the most significant bit position
of the binary sum and a decimal carry differ by 16 - 10 = 6. Consider the following three
BCD additions:

4 0100 4 0100 8 1000


+5 + 0101 +8 + 1000 +9 1001
9 1001 12 1100 17 10001
+ 0110 + 0 110
10010 10111

53
Computer Science

In each case, the two BCD digits are added as if they were two binary numbers. If the binary
sum is greater than or equal to 1010, we add 0110 to obtain the correct BCD sum and a carry. In
the first example, the sum is equal to 9 and is the correct BCD sum. In the second example, the
binary sum produces an invalid BCD digit. The addition of 0110 produces the correct BCD sum,
0010 (i.e., the number 2), and a carry. In the third example, the binary sum produces a carry.
This condition occurs when the sum is greater than or equal to 16. Although the other four bits
are less than 1001, the binary sum requires a correction because of the carry. Adding 0110, we
obtain the required BCD sum 0111 (i.e., the number 7) and a BCD carry.
The addition of two n- digit unsigned BCD numbers follows the same procedure.
Consider the addition of 184 + 576 = 760 in BCD:

BCD 11
0001 1000 0100 184
+0101 0111 0110 +576
Binary sum 0111 10000 1010
Add 6 0110 0110
BCD sum 0111 0110 0000 760

The first, least significant pair of BCD digits produces a BCD digit sum of 0000 and a carry for
the next pair of digits. The second pair of BCD digits plus a previous carry produces a digit sum
of 0110 and a carry for the next pair of digits. The third pair of digits plus a carry produces a
binary sum of 0111 and does not require a correction.

54
Computer Science

Computer – Data and Information

55
Computer Science

Computer - Data and Information


Data can be defined as a representation of facts, concepts, or instructions in a formalized
manner, which should be suitable for communication, interpretation, or processing by human or
electronic machine.

Data is represented with the help of characters such as alphabets (A-Z, a-z), digits (0-9) or
special characters (+,-,/,*,<,>,= etc.)

What is Information?
Information is organized or classified data, which has some meaningful values for the receiver.
Information is the processed data on which decisions and actions are based.

For the decision to be meaningful, the processed data must qualify for the following
characteristics −

 Timely − Information should be available when required.


 Accuracy − Information should be accurate.
 Completeness − Information should be complete.

Data Processing Cycle


Data processing is the re-structuring or re-ordering of data by people or machine to increase their
usefulness and add values for a particular purpose. Data processing consists of the following
basic steps - input, processing, and output. These three steps constitute the data processing cycle.

56
Computer Science

 Input − In this step, the input data is prepared in some convenient form for processing. The form
will depend on the processing machine. For example, when electronic computers are used, the
input data can be recorded on any one of the several types of input medium, such as magnetic
disks, tapes, and so on.
 Processing − In this step, the input data is changed to produce data in a more useful form. For
example, pay-checks can be calculated from the time cards, or a summary of sales for the month
can be calculated from the sales orders.
 Output − At this stage, the result of the proceeding processing step is collected. The particular
form of the output data depends on the use of the data. For example, output data may be pay-
checks for employees.

Computer - Networking
computer network is a system in which multiple computers are connected to each other to share
information and resources.

Characteristics of a Computer Network


 Share resources from one computer to another.
 Create files and store them in one computer, access those files from the other computer(s)
connected over the network.
 Connect a printer, scanner, or a fax machine to one computer within the network and let other
computers of the network use the machines available over the network.

Following is the list of hardware's required to set up a computer network.

57
Computer Science

 Network Cables
 Distributors
 Routers
 Internal Network Cards
 External Network Cards

Computer - Operating System


The Operating System is a program with the following features −

 An operating system is a program that acts as an interface between the software and the
computer hardware.
 It is an integrated set of specialized programs used to manage overall resources and operations of
the computer.
 It is a specialized software that controls and monitors the execution of all other programs that
reside in the computer, including application programs and other system software.

Objectives of Operating System


The objectives of the operating system are −

 To make the computer system convenient to use in an efficient manner.


 To hide the details of the hardware resources from the users.
 To provide users a convenient interface to use the computer system.
58
Computer Science

 To act as an intermediary between the hardware and its users, making it easier for the users to
access and use other resources.
 To manage the resources of a computer system.
 To keep track of who is using which resource, granting resource requests, and mediating
conflicting requests from different programs and users.
 To provide efficient and fair sharing of resources among users and programs.

Characteristics of Operating System


Here is a list of some of the most prominent characteristic features of Operating Systems −

 Memory Management − Keeps track of the primary memory, i.e. what part of it is in use by
whom, what part is not in use, etc. and allocates the memory when a process or program requests
it.
 Processor Management − Allocates the processor (CPU) to a process and deallocates the
processor when it is no longer required.
 Device Management − Keeps track of all the devices. This is also called I/O controller that
decides which process gets the device, when, and for how much time.
 File Management − Allocates and de-allocates the resources and decides who gets the
resources.
 Security − Prevents unauthorized access to programs and data by means of passwords and other
similar techniques.
 Job Accounting − Keeps track of time and resources used by various jobs and/or users.
 Control Over System Performance − Records delays between the request for a service and
from the system.
 Interaction with the Operators − Interaction may take place via the console of the computer in
the form of instructions. The Operating System acknowledges the same, does the corresponding
action, and informs the operation by a display screen.
 Error-detecting Aids − Production of dumps, traces, error messages, and other debugging and
error-detecting methods.
 Coordination Between Other Software and Users − Coordination and assignment of
compilers, interpreters, assemblers, and other software to the various users of the computer
systems.

Basics of Computers - Types of OS


As computers and computing technologies have evolved over the years, so have their usage
across many fields. To meet growing requirements more and more customized software have
flooded the market. As every software needs operating system to function, operating systems
have also evolved over the years to meet growing demand on their techniques and capabilities.
Here we discuss some common types of OS based on their working techniques and some
popularly used OS as well.

59
Computer Science

GUI OS
GUI is the acronym for Graphical User Interface. An operating system that presents an interface
comprising graphics and icons is called a GUI OS. GUI OS is very easy to navigate and use as
users need not remember commands to be given to accomplish each task. Examples of GUI OS
includes Windows, macOS, Ubuntu, etc.

Time Sharing OS
Operating systems that schedule tasks for efficient processor use are called time sharing OS.
Time sharing, or multitasking, is used by operating systems when multiple users located at
different terminals need processor time to complete their tasks. Many scheduling techniques like
round robin scheduling and shortest job next scheduling are used by time sharing OS.

Real Time OS
An operating system that guarantees to process live events or data and deliver the results within a
stipulated span of time is called a real time OS. It may be single tasking or multitasking.

Distributed OS
An operating system that manages many computers but presents an interface of single computer
to the user is called distributed OS. Such type of OS is required when computational
requirements cannot be met by a single computer and more systems have to be used. User
interaction is restricted to a single system; it’s the OS that distributed work to multiple systems
and then presents the consolidated output as if one computer has worked on the problem at hand.

Popular Operating Systems


Initially computers had no operating systems. Every program needed full hardware specifications
to run correctly as processor, memory and device management had to be done by the programs
themselves. However, as sophisticated hardware and more complex application programs
developed, operating systems became essential. As personal computers became popular among
individuals and small businesses, demand for standard operating system grew. Let us look at
some of the currently popular operating systems −

 Windows − Windows is a GUI operating system first developed by Microsoft in 1985. The latest
version of Windows is Windows 10. Windows is used by almost 88% of PCs and laptops
globally.
 Linux − Linux is an open source operating system mostly used by mainframes an
supercomputers. Being open source means that its code is available for free and anyone can
develop a new OS based on it.
 BOSS − Bharat Operating System Solutions is an Indian distribution of Linux based on Debian,
an OS. It is localized to enable use of local Indian languages. BOSS consists of −

60
Computer Science

o Linux kernel
o Office application suite BharteeyaOO
o Web browser
o Email service Thunderbird
o Chat application Pidgim
o File sharing applications
o Multimedia applications

Mobile OS
An operating system for smartphones, tablets and other mobile devices is called mobile OS.
Some of the most popular OS for mobile devices includes−

 Android − This Linux-based OS by Google is the most popular mobile OS currently. Almost
85% of mobile devices use it.
 Windows Phone 7 − It is the latest mobile OS developed by Microsoft.
 Apple iOS − This mobile OS is an OS developed by Apple exclusively for its own mobile
devices like iPhone, iPad, etc.
 Blackberry OS − This is the OS used by all blackberry mobile devices like smartphones and
playbooks.

61
Computer Science

62
Computer Science

What is a Computer Network?


o Computer Network is a group of computers connected with each other through wires,
optical fibres or optical links so that various devices can interact with each other through
a network.
o The aim of the computer network is the sharing of resources among various devices.
o In the case of computer network technology, there are several types of networks that vary
from simple to complex level.

Components Of Computer Network:

Major components of a computer network are:


NIC (National interface card)
NIC is a device that helps the computer to communicate with another device. The network
interface card contains the hardware addresses, the data-link layer protocol use this address to
identify the system on the network so that it transfers the data to the correct destination.

There are two types of NIC: wireless NIC and wired NIC.

o Wireless NIC: All the modern laptops use the wireless NIC. In Wireless NIC, a
connection is made using the antenna that employs the radio wave technology.
o Wired NIC: Cables use the wired NIC to transfer the data over the medium.

63
Computer Science

Hub
Hub is a central device that splits the network connection into multiple devices. When computer
requests for information from a computer, it sends the request to the Hub. Hub distributes this
request to all the interconnected computers.

Switches
Switch is a networking device that groups all the devices over the network to transfer the data to
another device. A switch is better than Hub as it does not broadcast the message over the
network, i.e., it sends the message to the device for which it belongs to. Therefore, we can say
that switch sends the message directly from source to the destination.

Cables and connectors


Cable is a transmission media that transmits the communication signals. There are three types of
cables:

o Twisted pair cable: It is a high-speed cable that transmits the data over 1Gbps or more.
o Coaxial cable: Coaxial cable resembles like a TV installation cable. Coaxial cable is
more expensive than twisted pair cable, but it provides the high data transmission speed.
o Fibre optic cable: Fibre optic cable is a high-speed cable that transmits the data using
light beams. It provides high data transmission speed as compared to other cables. It is
more expensive as compared to other cables, so it is installed at the government level.

Router
Router is a device that connects the LAN to the internet. The router is mainly used to connect the
distinct networks or connect the internet to multiple computers.

Modem
Modem connects the computer to the internet over the existing telephone line. A modem is not
integrated with the computer motherboard. A modem is a separate part on the PC slot found on
the motherboard.

64
Computer Science

Uses of Computer Network


o Resource sharing: Resource sharing is the sharing of resources such as programs,
printers, and data among the users on the network without the requirement of the physical
location of the resource and user.
o Server-Client model: Computer networking is used in the server-client model. A server
is a central computer used to store the information and maintained by the system
administrator. Clients are the machines used to access the information stored in the server
remotely.
o Communication medium: Computer network behaves as a communication medium
among the users. For example, a company contains more than one computer has an email
system which the employees use for daily communication.
o E-commerce: Computer network is also important in businesses. We can do the business
over the internet. For example, amazon.com is doing their business over the internet, i.e.,
they are doing their business over the internet.

Computer Network Architecture


Computer Network Architecture is defined as the physical and logical design of the software,
hardware, protocols, and media of the transmission of data. Simply we can say that how
computers are organized and how tasks are allocated to the computer.

The two types of network architectures are used:

o Peer-To-Peer network
o Client/Server network

65
Computer Science

Peer-To-Peer network
o Peer-To-Peer network is a network in which all the computers are linked together with
equal privilege and responsibilities for processing the data.
o Peer-To-Peer network is useful for small environments, usually up to 10 computers.
o Peer-To-Peer network has no dedicated server.
o Special permissions are assigned to each computer for sharing the resources, but this can
lead to a problem if the computer with the resource is down.

Advantages of Peer-To-Peer Network:


o It is less costly as it does not contain any dedicated server.
o If one computer stops working but, other computers will not stop working.
o It is easy to set up and maintain as each computer manages itself.

Disadvantages of Peer-To-Peer Network:


o In the case of Peer-To-Peer network, it does not contain the centralized system .
Therefore, it cannot back up the data as the data is different in different locations.
o It has a security issue as the device is managed itself.

Client/Server Network
o Client/Server network is a network model designed for the end users called clients, to
access the resources such as songs, video, etc. from a central computer known as Server.

66
Computer Science

o The central controller is known as a server while all other computers in the network are
called clients.
o A server performs all the major operations such as security and network management.
o A server is responsible for managing all the resources such as files, directories, printer,
etc.
o All the clients communicate with each other through a server. For example, if client1
wants to send some data to client 2, then it first sends the request to the server for the
permission. The server sends the response to the client 1 to initiate its communication
with the client 2.

Advantages of Client/Server network:


o A Client/Server network contains the centralized system. Therefore we can back up the
data easily.
o A Client/Server network has a dedicated server that improves the overall performance of
the whole system.
o Security is better in Client/Server network as a single server administers the shared
resources.
o It also increases the speed of the sharing resources.

Disadvantages of Client/Server network:


o Client/Server network is expensive as it requires the server with large memory.
o A server has a Network Operating System(NOS) to provide the resources to the clients,
but the cost of NOS is very high.

67
Computer Science

o It requires a dedicated network administrator to manage all the resources.

Computer Network Types


A computer network is a group of computers linked to each other that enables the computer to
communicate with another computer and share their resources, data, and applications.

A computer network can be categorized by their size. A computer network is mainly of four
types:

o LAN (Local Area Network)


o PAN (Personal Area Network)
o MAN (Metropolitan Area Network)
o WAN (Wide Area Network)

LAN (Local Area Network)


o Local Area Network is a group of computers connected to each other in a small area such
as building, office.
o LAN is used for connecting two or more personal computers through a communication
medium such as twisted pair, coaxial cable, etc.
o It is less costly as it is built with inexpensive hardware such as hubs, network adapters,
and ethernet cables.
o The data is transferred at an extremely faster rate in Local Area Network.
o Local Area Network provides higher security.

68
Computer Science

PAN (Personal Area Network)


o Personal Area Network is a network arranged within an individual person, typically
within a range of 10 meters.
o Personal Area Network is used for connecting the computer devices of personal use is
known as Personal Area Network.
o Thomas Zimmerman was the first research scientist to bring the idea of the Personal
Area Network.
o Personal Area Network covers an area of 30 feet.
o Personal computer devices that are used to develop the personal area network are the
laptop, mobile phones, media player and play stations.

69
Computer Science

There are two types of Personal Area Network:

o Wired Personal Area Network


o Wireless Personal Area Network

Wireless Personal Area Network: Wireless Personal Area Network is developed by simply
using wireless technologies such as WiFi, Bluetooth. It is a low range network.

Wired Personal Area Network: Wired Personal Area Network is created by using the USB.

MAN (Metropolitan Area Network)


o A metropolitan area network is a network that covers a larger geographic area by
interconnecting a different LAN to form a larger network.
o Government agencies use MAN to connect to the citizens and private industries.
o In MAN, various LANs are connected to each other through a telephone exchange line.
o The most widely used protocols in MAN are RS-232, Frame Relay, ATM, ISDN, OC-3,
ADSL, etc.
o It has a higher range than Local Area Network(LAN).

WAN (Wide Area Network)


o A Wide Area Network is a network that extends over a large geographical area such as
states or countries.
o A Wide Area Network is quite bigger network than the LAN.
o A Wide Area Network is not limited to a single location, but it spans over a large
geographical area through a telephone line, fibre optic cable or satellite links.

70
Computer Science

o The internet is one of the biggest WAN in the world.


o A Wide Area Network is widely used in the field of Business, government, and
education.

Advantages Of Wide Area Network:


Following are the advantages of the Wide Area Network:

o Geographical area: A Wide Area Network provides a large geographical area. Suppose
if the branch of our office is in a different city then we can connect with them through
WAN. The internet provides a leased line through which we can connect with another
branch.
o Centralized data: In case of WAN network, data is centralized. Therefore, we do not
need to buy the emails, files or back up servers.
o Get updated files: Software companies work on the live server. Therefore, the
programmers get the updated files within seconds.
o Exchange messages: In a WAN network, messages are transmitted fast. The web
application like Facebook, Whatsapp, Skype allows you to communicate with friends.
o Sharing of software and resources: In WAN network, we can share the software and
other resources like a hard drive, RAM.

Internetwork
o An internetwork is defined as two or more computer network LANs or WAN or
computer network segments are connected using devices, and they are configured by a
local addressing scheme. This process is known as internetworking.
o An interconnection between public, private, commercial, industrial, or government
computer networks can also be defined as internetworking.
o An internetworking uses the internet protocol.

71
Computer Science

o The reference model used for internetworking is Open System Interconnection(OSI).

Types of Internetwork:
1. Extranet: An extranet is a communication network based on the internet protocol such
as Transmission Control protocol and internet protocol. It is used for information sharing.
The access to the extranet is restricted to only those users who have login credentials. An
extranet is the lowest level of internetworking. It can be categorized as MAN, WAN or other
computer networks. An extranet cannot have a single LAN, atleast it must have one connection
to the external network.

2. Intranet: An intranet is a private network based on the internet protocol such


as Transmission Control protocol and internet protocol. An intranet belongs to an
organization which is only accessible by the organization's employee or members. The main
aim of the intranet is to share the information and resources among the organization employees.
An intranet provides the facility to work in groups and for teleconferences.

What is Topology?
Topology defines the structure of the network of how all the components are interconnected to
each other. There are two types of topology: physical and logical topology.

Physical topology is the geometric representation of all the nodes in a network.

72
Computer Science

Bus Topology

o The bus topology is designed in such a way that all the stations are connected through a
single cable known as a backbone cable.
o Each node is either connected to the backbone cable by drop cable or directly connected
to the backbone cable.
o When a node wants to send a message over the network, it puts a message over the
network. All the stations available in the network will receive the message whether it has
been addressed or not.
o The bus topology is mainly used in 802.3 (ethernet) and 802.4 standard networks.
o The configuration of a bus topology is quite simpler as compared to other topologies.

Ring Topology

73
Computer Science

o Ring topology is like a bus topology, but with connected ends.


o The node that receives the message from the previous computer will retransmit to the
next node.
o The data flows in one direction, i.e., it is unidirectional.
o The data flows in a single loop continuously known as an endless loop.
o It has no terminated ends, i.e., each node is connected to other node and having no
termination point.
o The data in a ring topology flow in a clockwise direction.

Star Topology

o Star topology is an arrangement of the network in which every node is connected to the
central hub, switch or a central computer.
o The central computer is known as a server, and the peripheral devices attached to the
server are known as clients.
o Coaxial cable or RJ-45 cables are used to connect the computers.
o Hubs or Switches are mainly used as connection devices in a physical star topology.
o Star topology is the most popular topology in network implementation.

74
Computer Science

Tree topology

o Tree topology combines the characteristics of bus topology and star topology.
o A tree topology is a type of structure in which all the computers are connected with each
other in hierarchical fashion.
o The top-most node in tree topology is known as a root node, and all other nodes are the
descendants of the root node.
o There is only one path exists between two nodes for the data transmission. Thus, it forms
a parent-child hierarchy.

Mesh topology

o Mesh technology is an arrangement of the network in which computers are


interconnected with each other through various redundant connections.
o There are multiple paths from one computer to another computer.

75
Computer Science

o It does not contain the switch, hub or any central computer which acts as a central point
of communication.
o The Internet is an example of the mesh topology.
o Mesh topology is mainly used for WAN implementations where communication failures
are a critical concern.
o Mesh topology is mainly used for wireless networks.
o Mesh topology can be formed by using the formula:
Number of cables = (n*(n-1))/2;

Where n is the number of nodes that represents the network.

Mesh topology is divided into two categories:

o Fully connected mesh topology


o Partially connected mesh topology

o Full Mesh Topology: In a full mesh topology, each computer is connected to all the
computers available in the network.
o Partial Mesh Topology: In a partial mesh topology, not all but certain computers are
connected to those computers with which they communicate frequently.

76
Computer Science

Hybrid Topology

o The combination of various different topologies is known as Hybrid topology.


o A Hybrid topology is a connection between different links and nodes to transfer the data.
o When two or more different topologies are combined together is termed as Hybrid
topology and if similar topologies are connected with each other will not result in Hybrid
topology. For example, if there exist a ring topology in one branch of ICICI bank and bus
topology in another branch of ICICI bank, connecting these two topologies will result in
Hybrid topology.

o Effective: Hybrid topology is very effective as it can be designed in such a way that the
strength of the network is maximized and weakness of the network is minimized.

o Costly infrastructure: The infrastructure cost is very high as a hybrid network requires a
lot of cabling, network devices, etc.

77
Computer Science

78
Computer Science

Computer Security - Terminologies

In this section, we will discuss about the different terminology used in Computer Security.

 Unauthorized access − An unauthorized access is when someone gains access to a


server, website, or other sensitive data using someone else's account details.
 Hacker − Is a Person who tries and exploits a computer system for a reason which can
be money, a social cause, fun etc.
 Threat − Is an action or event that might compromise the security.
 Vulnerability − It is a weakness, a design problem or implementation error in a system
that can lead to an unexpected and undesirable event regarding security system.
 Attack − Is an assault on the system security that is delivered by a person or a machine
to a system. It violates security.
 Antivirus or Antimalware − Is a software that operates on different OS which is used
to prevent from malicious software.
 Social Engineering − Is a technique that a hacker uses to stole data by a person for
different for purposes by psychological manipulation combined with social scenes.
 Virus − It is a malicious software that installs on your computer without your consent
for a bad purpose.
 Firewall − It is a software or hardware which is used to filter network traffic based on
rules.

Computer Security - Elements


The general state in Computer Security has the ability to detect and prevent attacks and to be
able to recover. If these attacks are successful as such then it has to contain the disruption of
information and services and check if they are kept low or tolerable.

Different Elements in Computer Security


In order to fulfil these requirements, we come to the three main elements which
are confidentiality, integrity, and availability and the recently added authenticity and utility.

79
Computer Science

Confidentiality
Confidentiality is the concealment of information or resources. Also, there is a need to keep
information secret from other third parties that want to have access to it, so just the right people
can access it.
Example in real life − Let’s say there are two people communicating via an encrypted email
they know the decryption keys of each other and they read the email by entering these keys into
the email program. If someone else can read these decryption keys when they are entered into
the program, then the confidentiality of that email is compromised.

Integrity
Integrity is the trustworthiness of data in the systems or resources by the point of view of
preventing unauthorized and improper changes. Generally, Integrity is composed of two sub-
elements – data-integrity, which it has to do with the content of the data and authentication
which has to do with the origin of the data as such information has values only if it is correct.
Example in real life − Let’s say you are doing an online payment of 5 USD, but your
information is tampered without your knowledge in a way by sending to the seller 500 USD,
this would cost you too much.

80
Computer Science

In this case cryptography plays a very major role in ensuring data integrity. Commonly used
methods to protect data integrity includes hashing the data you receive and comparing it with
the hash of the original message. However, this means that the hash of the original data must be
provided in a secure way.

Availability
Availability refers to the ability to access data of a resource when it is needed, as such the
information has value only if the authorized people can access at right time. Denying access to
data nowadays has become a common attack. Imagine a downtime of a live server how costly it
can be.
Example in real life − Let’s say a hacker has compromised a webserver of a bank and put it
down. You as an authenticated user want to do an e-banking transfer but it is impossible to
access it, the undone transfer is a money lost for the bank.

Computer Security - Antiviruses


In the previous section, we saw how to secure our computers and one of the points was
installing and updating antivirus software. Without this software there is a high chance that your
systems and networks will be hit and will suffer hacking attacks and also can be affected by the
various viruses.
It is important that the antivirus scan engine and virus signatures to be updated regularly, we do
this because if your system is hit by the latest malware it will be detected.

Basic Functions of Antivirus Engines


All antivirus engines have three components to function accordingly. It is important to have a
look at these functions because it will help us for better manual cleaning of viruses in case we
need.
 Scanning − When a new virus is detected in the cyberspace, antivirus producers start
writing programs (updates) that scans for similar signature strings.
 Integrity Checking − This method generally checks for manipulated files in OS from
the viruses.
 Interception − This method is used basically to detect Trojans and it checks the request
made by the operating system for network access.
The following image shows the schema for an antivirus engines functionality.

81
Computer Science

Online Virus Testing


If the system administrator does not have an antivirus installed or suspects a file that is infected.
They would recommend to use the online testing antivirus engine which (according to me) is
one of the best – https://virustotal.com/.
Q. Why this option?
Ans. It is a free and independent service. It uses multiple antivirus engines (41 anti-virus
engines), so its result will be showing for all the 41 engines. It updates the engines in real-time.
For further clarity, please see the following screenshot, wherein I uploaded a file with virus and
the result is 33/41 (Detection Ratio), which means that it has virus and did not pass the class,
so it should not be opened.

A good feature of this site is URL checking, before entering to a website you can enter the URL
and it checks for you if the site has infection and can harm you.

82
Computer Science

I did a test with a URL and it came out to be clean and that too 100%, so I can visit it without
my computer being infected.

Free Antivirus Software


We will show you where to get free antiviruses and where to download in case you don’t have
enough budget.
The free versions of anti-viruses have nearly identical malware detection scores to the paid
versions produced by the same company, but the commercial antivirus makes a small difference
in the performance of security and in our case we are system administrators and we want
maximum protection in the work environment.
From the PCMagazine (http://in.pcmag.com/) you can get a review which are the best top rated
free antiviruses at the moment. In the following URL you can check by
yourself http://www.pcmag.com/article2/0,2817,2388652,00.asp
Let us understand in detail about some of these antivirus software −

Avast Antivirus
This antivirus has good scores in malware blocking and anti-phishing test scans, it can be
downloaded from https://www.avast.com/en-eu/index
For server installation you need a commercial version.

83
Computer Science

AVG Antivirus
It can be downloaded from http://www.avg.com/us-en/free-antivirus-download. For server
installation you need to purchase the commercial version.

Panda Antivirus 2016


It can be downloaded from http://www.pandasecurity.com/usa/homeusers/downloads/
It has the following good features −

 Rescue Disk
 USB protection
 Process Monitor

84
Computer Science

For server installation you will need to purchase the commercial version.

Bitdefender Antivirus
It can be downloaded from http://www.bitdefender.com/solutions/free.html A good feature in
this antivirus is that it can work entirely in the background. No configuration setting. For server
installation you need to buy the commercial version.

85
Computer Science

Microsoft Security Essentials


Even though it is not among the top-most free antiviruses owing to the Microsoft brand, it is
worth a mention that Microsoft itself offers you a free antivirus which is called as Microsoft
Security Essentials.
It can be downloaded from http://windows.microsoft.com/en-us/windows/security-essentials-
download

Commercial Antivirus
I should mention that all the producers of free antiviruses offers their commercial versions too.
Based on PC magazine, the best commercial antiviruses are −

 Kaspersky Anti-Virus
 Bitdefender Antivirus Plus 2016
 McAfee AntiVirus Plus (2016)
 Webroot SecureAnywhere Antivirus (2015)
Please see the following link to check by yourself
− http://www.pcmag.com/article2/0,2817,2372364,00.asp

Kaspersky Antivirus
It can be downloaded as a free trial from http://www.kaspersky.com/free-trials/anti-virus
It has an excellent score in anti-phishing. It also gives a useful bonus in security tools like credit
card protection in your computers.

86
Computer Science

Computer Security - Malwares

In the previous sections we treated antiviruses which helped us to protect our systems but in this
chapter we will treat malwares, how to detect them manually, what are their forms, what are
their file extensions, signs of an infected computer, etc. They are important to be treated
because the infection rates of businesses and personal computers are too high in nowadays.
They are self-replication programs that reproduce their own codes by attaching themselves to
other executable codes. They operate without the permissions or knowledge of the computer
users. Viruses or malwares like in real-life, in computers they contaminate other healthy files.
However, we should remember that viruses infect outside machines only with the assistance of
a computer user only. These can happen by clicking a file that comes attached with email from
an unknown person, plugging a USB without scanning, opening unsafe URLs for that reason.
We as system administrators have to remove the administrator permissions of users in these
computers. We categorize malwares in three types −

 Trojans and Rootkits


 Viruses
 Worms

Characteristics of a Virus
Following are a couple of characteristics of any virus that infects our computers.
 They reside in a computer’s memory and activates themselves while the program that is
attached starts running.
For example − They attach themselves in general to the explorer.exe in windows OS
because it is the process that is running all the time, so you should be cautious when this
process starts to consume too much of your computer capacities.
 They modify themselves after the infection phase like they source codes, extensions, new
files, etc. so it is harder for an antivirus to detect them.
 They always try to hide themselves in the operating systems in the following ways −
o Encrypts itself into cryptic symbols, and they decrypt themselves when they
replicate or execute.
For example − You can see this in the following image for better understanding
as in my computer I found this file.

87
Computer Science

After finding this file, I opened it with a text editor and as thought the text was not
understandable as shown in the following screenshot.

After finding this, I tried it on a base64 decoder and I found that it was a Virus file.

88
Computer Science

This virus can cause the following to your computer −


 It may delete important data from your computer to gain space for their processes.
 It may avoid detection by redirection of disk data.
 It may perform tasks by triggering an event with itself. For example, this happens when
in an infected computer pop-up tables etc., show up automatically on the screen.
 They are common in Windows and Mac OS because these operation systems do not have
multiple file permissions and are more spread out.

Working Process of Malwares and how to Clean it


Malwares attach themselves to programs and transmit to other programs by making use of some
events, they need these events to happen because they cannot −

 Start by themselves
 Transmit themselves by using non-executable files
 Infect other networks or computer
From the above conclusions, we should know that when some unusual processes or services are
run by themselves we should further investigate their relations with a possible virus. The
investigation process is as follows −
To investigate these processes, start with the use of the following tools −

 fport.exe
 pslist.exe
 handle.exe
 netstat.exe
The Listdll.exe shows all the dll files being used, while the netstat.exe with its variables shows
all the processes that are being run with their respective ports.
You can see the following example on how I mapped the process of Kaspersky antivirus which
I used along with the command netstat-ano to see the process numbers and task manager to see
to which process belongs to this number.

89
Computer Science

Then we should look for any modified, replaced or deleted files and the shared
libraries should also be checked. They generally infect executable program files with extension
like .EXE, .DRV, .SYS, .COM, .BIN. Malwares changes extension of genuine files, for
example: File.TXT to File.TXT.VBS.
If you are a system administrator of a webserver, then you should be aware of another form of
malware which is called as webshell. It generally is in a .php extension but with strange file
names and in an encrypted form. You should delete them in case you detect them.
After that is done, we should update the antivirus program and rescan the computer again.

Detecting a Computer Error from a Virus Infection


In this section we will treat how to detect a computer or OS fault from a virus because
sometimes people and system administrators mix the symptoms.
The following events are most likely not caused by a malware −

 Error while the system is booting in bios stage, like Bios’s battery cell display, timer error
display.
 Hardware errors, like beeps RAM burn, HDD, etc.
 If a document fails to start normally like a corrupted file, but the other files can be opened
accordingly.
 Keyboard or mouse doesn’t answer to your commands, you have to check the plug-ins.

90
Computer Science

 Monitor switching on and off too often, like blinking or vibrating, this is a hardware fault.
On the other hand, if you have the following signs in your system, you should check for
malware.
 Your computer shows a pop-up or error tables.
 Freezes frequently.
 It slows down when a program or process starts.
 Third parties complain that they are receiving invitation in social media or via email by
you.
 Files extensions changes appear or files are added to your system without your consent.
 Internet Explorer freezes too often even though your internet speed is very good.
 Your hard disk is accessed most of the time as you can see from the LED light on your
computer case.
 OS files are either corrupted or missing.
 If your computer is consuming too much bandwidth or network resources this is the case
of a computer worm.
 Hard disk space is occupied all the time, even when you are not taking any action, for
example installing a new program.
 Files and program sizes changes comparing to its original version.
Some Practical Recommendations to Avoid Viruses −

 Don’t open any email attachment coming from unknown people or from known people that
contain suspicious text.
 Don’t accept invitation from unknown people on social media.
 Don’t open URL sent by unknown people or known people that are in any weird form.

Virus Information
If you have found a virus but you want to investigate further regarding its function. I would
recommend you to have a look at these virus databases, which are offered generally by antivirus
vendors.
 Kaspersky Virus Database − (http://www.kaspersky.com/viruswatchlite?hour_offset=-
1)
 F-Secure − (https://www.f-secure.com/en/web/labs_global/threat-descriptions)
 Symantec – Virus Encyclopedia −
(https://www.symantec.com/security_response/landing/azlisting.jsp)

91
Computer Science

McAfee AntiVirus Plus


It can be downloaded as a free trial from
− http://home.mcafee.com/downloads/OneClickTrial.aspx?culture=en-us
It protects all the operating systems like Windows, Mac OS, Android, and iOS devices. very
good malicious URL blocking and anti-phishing.

92
Computer Science

Webroot SecureAnywhere Antivirus


It can be downloaded as a free trial from − http://www.webroot.com/us/en/home/products/av
Some of its prominent features are −

 Recover files encrypted by ransomware


 Uses tiny amount of disk space
 Very fast scan
 Handles unknown malware
 Includes firewall

93
Computer Science

94
Computer Science

What is Data?
Data is a collection of a distinct small unit of information. It can be used in a variety of forms
like text, numbers, media, bytes, etc. it can be stored in pieces of paper or electronic memory,
etc.

Word 'Data' is originated from the word 'datum' that means 'single piece of information.' It is
plural of the word datum.

In computing, Data is information that can be translated into a form for efficient movement and
processing. Data is interchangeable.

What is Database?
A database is an organized collection of data, so that it can be easily accessed and managed.

You can organize data into tables, rows, columns, and index it to make it easier to find relevant
information.

Database handlers create a database in such a way that only one set of software program
provides access of data to all the users.

The main purpose of the database is to operate a large amount of information by storing,
retrieving, and managing data.

There are many dynamic websites on the World Wide Web nowadays which are handled
through databases. For example, a model that checks the availability of rooms in a hotel. It is an
example of a dynamic website that uses a database.

There are many databases available like MySQL, Sybase, Oracle, MongoDB, Informix,
PostgreSQL, SQL Server, etc.

Modern databases are managed by the database management system (DBMS).

SQL or Structured Query Language is used to operate on the data stored in a database. SQL
depends on relational algebra and tuple relational calculus.

A cylindrical structure is used to display the image of a database.

95
Computer Science

Evolution of Databases
The database has completed more than 50 years of journey of its evolution from flat-file system
to relational and objects relational systems. It has gone through several generations.

The Evolution
File-Based

1968 was the year when File-Based database were introduced. In file-based databases, data was
maintained in a flat file. Though files have many advantages, there are several limitations.

One of the major advantages is that the file system has various access methods, e.g., sequential,
indexed, and random.

It requires extensive programming in a third-generation language such as COBOL, BASIC.

Hierarchical Data Model

1968-1980 was the era of the Hierarchical Database. Prominent hierarchical database model was
IBM's first DBMS. It was called IMS (Information Management System).

In this model, files are related in a parent/child manner.

Below diagram represents Hierarchical Data Model. Small circle represents objects.

96
Computer Science

Like file system, this model also had some limitations like complex implementation, lack
structural independence, can't easily handle a many-many relationship, etc.

Network data model


Charles Bachman developed the first DBMS at Honeywell called Integrated Data Store (IDS).
It was developed in the early 1960s, but it was standardized in 1971 by the CODASYL group
(Conference on Data Systems Languages).

In this model, files are related as owners and members, like to the common network model.

Network data model identified the following components:

o Network schema (Database organization)


o Sub-schema (views of database per user)
o Data management language (procedural)

This model also had some limitations like system complexity and difficult to design and
maintain.

Relational Database

1970 - Present: It is the era of Relational Database and Database Management. In 1970, the
relational model was proposed by E.F. Codd.

Relational database model has two main terminologies called instance and schema.

The instance is a table with rows or columns

Schema specifies the structure like name of the relation, type of each column and name.

This model uses some mathematical concept like set theory and predicate logic.

The first internet database application had been created in 1995.

During the era of the relational database, many more models had introduced like object-oriented
model, object-relational model, etc.

Cloud database
Cloud database facilitates you to store, manage, and retrieve their structured, unstructured data
via a cloud platform. This data is accessible over the Internet. Cloud databases are also called a
database as service (DBaaS) because they are offered as a managed service.

97
Computer Science

Some best cloud options are:

o AWS (Amazon Web Services)


o Snowflake Computing
o Oracle Database Cloud Services
o Microsoft SQL server
o Google cloud spanner

Advantages of cloud database

Lower costs

Generally, company provider does not have to invest in databases. It can maintain and support
one or more data centers.

Automated

Cloud databases are enriched with a variety of automated processes such as recovery, failover,
and auto-scaling.

Increased accessibility

You can access your cloud-based database from any location, anytime. All you need is just an
internet connection.

NoSQL Database
A NoSQL database is an approach to design such databases that can accommodate a wide variety
of data models. NoSQL stands for "not only SQL." It is an alternative to traditional relational
databases in which data is placed in tables, and data schema is perfectly designed before the
database is built.

NoSQL databases are useful for a large set of distributed data.

Some examples of NoSQL database system with their category are:

o MongoDB, CouchDB, Cloudant (Document-based)


o Memcached, Redis, Coherence (key-value store)
o HBase, Big Table, Accumulo (Tabular)

98
Computer Science

Advantage of NoSQL
High Scalability

NoSQL can handle an extensive amount of data because of scalability. If the data grows, NoSQL
database scale it to handle that data in an efficient manner.

High Availability

NoSQL supports auto replication. Auto replication makes it highly available because, in case of
any failure, data replicates itself to the previous consistent state.

Disadvantage of NoSQL
Open source

NoSQL is an open-source database, so there is no reliable standard for NoSQL yet.

Management challenge

Data management in NoSQL is much more complicated than relational databases. It is very
challenging to install and even more hectic to manage daily.

GUI is not available

GUI tools for NoSQL database are not easily available in the market.

Backup

Backup is a great weak point for NoSQL databases. Some databases, like MongoDB, have no
powerful approaches for data backup.

The Object-Oriented Databases


The object-oriented databases contain data in the form of object and classes. Objects are the real-
world entity, and types are the collection of objects. An object-oriented database is a
combination of relational model features with objects oriented principles. It is an alternative
implementation to that of the relational model.

Object-oriented databases hold the rules of object-oriented programming. An object-oriented


database management system is a hybrid application.

99
Computer Science

Graph Databases
A graph database is a NoSQL database. It is a graphical representation of data. It contains nodes
and edges. A node represents an entity, and each edge represents a relationship between two
edges. Every node in a graph database represents a unique identifier.

Graph databases are beneficial for searching the relationship between data because they highlight
the relationship between relevant data.

Graph databases are very useful when the database contains a complex relationship and dynamic
schema.

It is mostly used in supply chain management, identifying the source of IP telephony.

DBMS (Data Base Management System)


Database management System is software which is used to store and retrieve the database. For
example, Oracle, MySQL, etc.; these are some popular DBMS tools.

o DBMS provides the interface to perform the various operations like creation, deletion,
modification, etc.
o DBMS allows the user to create their databases as per their requirement.
o DBMS accepts the request from the application and provides specific data through the
operating system.
o DBMS contains the group of programs which acts according to the user instruction.
o It provides security to the database.

Advantage of DBMS
Controls redundancy

It stores all the data in a single database file, so it can control data redundancy.

Data sharing

An authorized user can share the data among multiple users.

100
Computer Science

Backup

It providesBackup and recovery subsystem. This recovery system creates automatic data from
system failure and restores data if required.

Multiple user interfaces

It provides a different type of user interfaces like GUI, application interfaces.

Disadvantage of DBMS
Size

It occupies large disk space and large memory to run efficiently.

Cost

DBMS requires a high-speed data processor and larger memory to run DBMS software, so it is
costly.

Complexity

DBMS creates additional complexity and requirements.

RDBMS (Relational Database Management System)


The word RDBMS is termed as 'Relational Database Management System.' It is represented as a
table that contains rows and column.

RDBMS is based on the Relational model; it was introduced by E. F. Codd.

A relational database contains the following components:

o Table
o Record/ Tuple
o Field/Column name /Attribute
o Instance
o Schema
o Keys

An RDBMS is a tabular DBMS that maintains the security, integrity, accuracy, and consistency
of the data.

101
Computer Science

Types of Databases
There are various types of databases used for storing different varieties of data:

1) Centralized Database
It is the type of database that stores data at a centralized database system. It comforts the users to
access the stored data from different locations through several applications. These applications
contain the authentication process to let users access data securely. An example of a Centralized
database can be Central Library that carries a central database of each library in a
college/university.

Advantages of Centralized Database


o It has decreased the risk of data management, i.e., manipulation of data will not affect the
core data.
o Data consistency is maintained as it manages data in a central repository.
o It provides better data quality, which enables organizations to establish data standards.
o It is less costly because fewer vendors are required to handle the data sets.

Disadvantages of Centralized Database


o The size of the centralized database is large, which increases the response time for
fetching the data.
o It is not easy to update such an extensive database system.
o If any server failure occurs, entire data will be lost, which could be a huge loss.

102
Computer Science

2) Distributed Database
Unlike a centralized database system, in distributed systems, data is distributed among different
database systems of an organization. These database systems are connected via communication
links. Such links help the end-users to access the data easily. Examples of the Distributed
database are Apache Cassandra, HBase, Ignite, etc.

We can further divide a distributed database system into:

o Homogeneous DDB: Those database systems which execute on the same operating
system and use the same application process and carry the same hardware devices.
o Heterogeneous DDB: Those database systems which execute on different operating
systems under different application procedures, and carries different hardware devices.

Advantages of Distributed Database


o Modular development is possible in a distributed database, i.e., the system can be
expanded by including new computers and connecting them to the distributed system.
o One server failure will not affect the entire data set.

3) Relational Database
This database is based on the relational data model, which stores data in the form of rows(tuple)
and columns(attributes), and together forms a table(relation). A relational database uses SQL for
storing, manipulating, as well as maintaining the data. E.F. Codd invented the database in 1970.
Each table in the database carries a key that makes the data unique from others. Examples of
Relational databases are MySQL, Microsoft SQL Server, Oracle, etc.

103
Computer Science

Properties of Relational Database


There are following four commonly known properties of a relational model known as ACID
properties, where:

A means Atomicity: This ensures the data operation will complete either with success or with
failure. It follows the 'all or nothing' strategy. For example, a transaction will either be
committed or will abort.

C means Consistency: If we perform any operation over the data, its value before and after the
operation should be preserved. For example, the account balance before and after the transaction
should be correct, i.e., it should remain conserved.

I means Isolation: There can be concurrent users for accessing data at the same time from the
database. Thus, isolation between the data should remain isolated. For example, when multiple
transactions occur at the same time, one transaction effects should not be visible to the other
transactions in the database.

D means Durability: It ensures that once it completes the operation and commits the data, data
changes should remain permanent.

4) NoSQL Database
Non-SQL/Not Only SQL is a type of database that is used for storing a wide range of data sets. It
is not a relational database as it stores data not only in tabular form but in several different ways.
It came into existence when the demand for building modern applications increased. Thus,
NoSQL presented a wide variety of database technologies in response to the demands. We can
further divide a NoSQL database into the following four types:

a. Key-value storage: It is the simplest type of database storage where it stores every single
item as a key (or attribute name) holding its value, together.

104
Computer Science

b. Document-oriented Database: A type of database used to store data as JSON-like


document. It helps developers in storing data by using the same document-model format
as used in the application code.
c. Graph Databases: It is used for storing vast amounts of data in a graph-like structure.
Most commonly, social networking websites use the graph database.
d. Wide-column stores: It is similar to the data represented in relational databases. Here,
data is stored in large columns together, instead of storing in rows.

Advantages of NoSQL Database


o It enables good productivity in the application development as it is not required to store
data in a structured format.
o It is a better option for managing and handling large data sets.
o It provides high scalability.
o Users can quickly access data from the database through key-value.

5) Cloud Database
A type of database where data is stored in a virtual environment and executes over the cloud
computing platform. It provides users with various cloud computing services (SaaS, PaaS, IaaS,
etc.) for accessing the database. There are numerous cloud platforms, but the best options are:

o Amazon Web Services(AWS)


o Microsoft Azure
o Kamatera
o PhonixNAP
o ScienceSoft
o Google Cloud SQL, etc.

6) Object-oriented Databases
The type of database that uses the object-based data model approach for storing data in the
database system. The data is represented and stored as objects which are similar to the objects
used in the object-oriented programming language.

7) Hierarchical Databases
It is the type of database that stores data in the form of parent-children relationship nodes. Here,
it organizes data in a tree-like structure.

105
Computer Science

Data get stored in the form of records that are connected via links. Each child record in the tree
will contain only one parent. On the other hand, each parent record can have multiple child
records.

8) Network Databases
It is the database that typically follows the network data model. Here, the representation of data
is in the form of nodes connected via links between them. Unlike the hierarchical database, it
allows each record to have multiple children and parent nodes to form a generalized graph
structure.

9) Personal Database
Collecting and storing data on the user's system defines a Personal Database. This database is
basically designed for a single user.

Advantage of Personal Database


o It is simple and easy to handle.
o It occupies less storage space as it is small in size.

10) Operational Database


The type of database which creates and updates the database in real-time. It is basically designed
for executing and handling the daily data operations in several businesses. For example, An
organization uses operational databases for managing per day transactions.

106
Computer Science

107
Computer Science

Windows

Windows and its Components


The main components of Windows when you start your computer are the Desktop, My
Computer, Recycle Bin, Start Button, Taskbar, and shortcuts to applications.

After opening an application, you will also have a window with an active application which will
appear in your desktop and taskbar.

108
Computer Science

Desktop
The Desktop is the very first screen you see after Windows starts. There you find the folders:
My Documents, My Computer, the Recycle Bin and any Shortcuts for applications and files that
you have created.

109
Computer Science

My Computer
When you double-click on the My Computer icon on the desktop, it will open a window similar
to the one shown below, where you can navigate between the computer's drives and Control
Panel tools.

Recycle Bin
When you delete a file from your computer's hard drive, it is removed to the folder called
Recycle Bin. Files deleted from your hard drive are still available for
restoring if needed, unless you empty your Recycle Bin.

 To restore the files, open the Recycle Bin folder by double-clicking the icon on your
desktop, select the file and then select Restore.
 To clear the Recycle Bin, select Empty Recycle Bin and the files will be permanently removed from
your computer.

110
Computer Science

Note that the recycle bin does not apply to the contents of a floppy disk. If you delete a file from
a floppy disk, it is permanently deleted, and you cannot restore it.

Minimize/Maximize/Close Buttons

In the top-right corner of your document are the Minimize/Maximize/Close buttons.

The first one when clicked minimize your screen, sending it to the taskbar. The second one
maximize your screen, filling all desktop with the document you are working with.The last
button is used to close your document.

It is best practice to work with your document window maximized.

Start Menu
By clicking the Start button, in the very bottom-left corner of the screen, a vertical window will
come up with the Start Menu.

The list of submenus in the pop-up window let you navigate and select the application you want
to run.

111
Computer Science

Taskbar
The Taskbar is the row at the bottom of the Windows screen where all currently open
applications or files are listed.

The taskbar is used to select a file or application that is already opened or to put an application in
the foreground.

To put an application in the foreground, just click on the icon of the application in the taskbar.
Another way to put an application in the foreground when more than one is in use is to hold the
ALT button and then click TAB on your keyboard to see all the open applications; you will need
to hold the ALT button and continue pressing TAB to go through each application until you
come to the one you want to use.

Shortcut
A shortcut creates a button or icon which typically stays on the
desktop and when clicked, quickly allows you to start a program or
open a file without having to go to its permanent location on your
computer.

112
Computer Science

To create a shortcut, open the Windows Explorer or go to the Start menu, select the file or
program you want to create a shortcut for, place the cursor on the icon for the file, then right-
click and select Create Shortcut from the menu that pops up. The shortcut file will be created.
After that, you drag the shortcut file to the desktop and whenever you click on it, it will open the
application or document related to the shortcut.

Right and Left Click


To use the mouse, usually you click the left button. However you can also right-click to display
a hidden menu related to the object you are in when clicking. This menu can vary depending on
which application you are using.

With right-clicking, you can operate different functions such as:

 Copy/cut or paste a text, file, or folder.


 Rename or delete a file or folder.

113
Computer Science

Multitasking
The term multitasking means to be running or working in two or more applications at the same
time. You can be more productive by multitasking. For instance, you can download files from
the Internet while managing your files or word processing.

In order to switch between the applications you can use the Taskbar, clicking on the icon of the
application you want to have in the foreground.

114
Computer Science

Highlight
Put your cursor at the beginning of a word or sentence you want to highlight, then click and drag
your mouse to the end of the selection.

Copy/Cut and Paste Text

Copy is used when you want to have an area of text from a


document twice at the same document or in another document. You
first select the area of the text by highlighting it and then press
CTRL+C, or go to Edit menu and select Copy.

Cut is used to delete an area of text from a document. You first


select the area of the text by highlighting it and then press CTRL+X,
or go to Edit menu and select Cut.

115
Computer Science

Paste is used to insert an area of text or image in a document by


hitting CTRL+V or in the Edit menu selecting Paste.

Another way of using the copy, cut or paste commands is using the
right-click button of your mouse.

1. After highlighting the text you right-click and a menu will appear
where you can select Copy or Cut.
2. To paste you just insert your cursor where you want, right-click and
select Paste.

Copying or cutting and pasting a text in Microsoft Word:

1. Highlight the text you want to copy or cut, press CTRL+C (for copy) or CTRL+X (for paste).

2. Insert your cursor where you want to paste the text.

116
Computer Science

3. Paste your text by pressing CTRL+V. The text will appear.

Standard and Formatting Toolbars


Toolbars are rows of buttons and boxes. When you click on a button or box, an application opens
or a task is performed. Toolbars normally appear at the top of an application's window. The
Standard Toolbar shown in the image below is from Windows Explorer; the standard toolbars
in other applications may have buttons that allow youto open a new document, save, print, and
spell check.

The Formatting Toolbar is used to format a text using alignments, font type, font size, bold,
italic, and lists. It is provided in most applications. The image below shows the Formatting
Toolbar from Netscape Composer.

117
Computer Science

Save and/or Save As

Save is used when:

 It is the first time you are saving a file.


 You want to keep saving a existing file in different moments that
you are working on it.
 It is the end of a working period.

Note that clicking Save will replace whatever file you were
working on.

Go to File menu and select Save or use the combination keys


CTRL+S.

Save As is used when you want to save a file with a different name
to create backups of a file in the creation process. In that way, you
can have different versions of the same document and can return to
a previous stage.

Go to File menu and select Save As or use the combination


keys CTRL+SHIFT+S.

Print Command

To print a page go to the File menu and select Print. A window will pop up with options for how many
copies and which pages you want to print. Other options are also available depending on the printer.

118
Computer Science

New Folder
To create a New Folder, which means a new directory (a place where documents from the same
subject are stored), go to the File menu, then New and select Folder from the pop-up menu,
either in My Computer or in Windows Explorer.

To open Windows Explorer, click the Start button, select Programs/Accessories/Windows


Explorer.

Copy/Move Files
To copy and move a file or folder, use Windows Explorer.

To open the Explorer application, click the Start button and select Programs and Windows
Explorer (some computer have Explorer under Programs/Accessories).

Copy or move a file using Menu command:

119
Computer Science

1. Select the disk drive that contains the file by clicking twice on it.
2. Click on the folder where the file is located
3. Select the file by clicking on it.
4. Go to Edit menu, select Copy (if you want to retain a copy of the file in the original place) or Cut (if you
want to move the file).
5. Navigate to the new location where you want to paste the file.
6. Go to Edit menu, select Paste.

The same procedure can be used if you want to copy or move an entire folder.

Drag and Drop


Drag is when the mouse button is held down while the mouse is moved. It is mostly used to
move files around in Windows Explorer or in some other applications. Drop is the release of the
button, after finishing dragging the mouse.

120
Computer Science

Here is an example of dragging and dropping a file from the hard drive to the floppy drive in
Windows Explorer:

1. Select the file, hold down the left mouse button and drag it in the direction of the floppy drive on the left
side.

2. After the floppy drive highlights you can release the mouse button; the file will be dropped and copied
there.

121
Computer Science

File Extensions

A file extension is the three letters of a file name after the dot. It is created by the application
when you save a file. It is the way operation systems identify which application to use to open a
file. Windows often doesn't list them when you are searching for a file, but they are there.
Examples are: .txt, .doc, .exe, .html, .jpg, .gif, .wav.

However, sometimes you will want to save a file with different extensions. In order to do that,
select Save As in the File menu. The Save As box will open. Choose from the drop-down menu
next to Save As Type the type you want to save. The extension of the type will be created for
you by the application.

Here is an example from Microsoft Word:

Some file extensions:

 Graphic files: .bmp, .gif, .tif, .jpg


 Word document: .doc
 Program file: .exe
 Webpages files: .htm, .html
 Unformatted text: .txt
 Excel spreadsheet file: .xls
 Compressed file: .zip
 Rich Formatted Text: .rtf
 Sound file: .wav
 Acrobat Reader file: .pdf

Hard Drive and Floppy Drive


In your computer there are different drives: the hard drive, the floppy drive and the compact
disk drive.

The hard drive, also called the C: drive, is used for storing all your applications and files. The
floppy drive, or A: drive, is used when you insert a floppy disk to store files that you want to
transport or create a back up.

122
Computer Science

To select the hard drive or floppy drive for file management you can go to either Windows
Explorer in programs or to My Computer on the desktop.

In Windows Explorer select the hard or floppy drive.

Hard Drive C:

Floppy Drive A:

or in My Computer, select the Hard or Floppy Drive.

123
Computer Science

Hard Drive C:

Floppy Drive A:

Rename/Delete a Folder or File


Using Windows Explorer you can rename or delete a file or folder.

To Rename a file or folder:

1. Navigate and select the file or folder you want to rename from the proper drive (c:, a:).
2. Go to the File menu and select Rename.
3. The file name will be highlighted and blinking in the right corner waiting for you to type the new file
name.

124
Computer Science

To Delete a file or folder:

1. Navigate and select the file or folder you want to delete.


2. Go to the File menu and select Delete.

Another way of renaming or deleting a file or folder is using the right-click button of your
mouse. After highlighting the file or folder, you right-click and a menu will appear where you
can select Rename or Delete.

125
Computer Science

References

 https://en.wikipedia.org/wiki/Computer_science#cite_note-6
 "What is Computer Science? - Computer Science, The University of York".
www.cs.york.ac.uk. Retrieved June 11, 2020.
 Dijkstra, E.W. (1986). "On a cultural gap". The Mathematical Intelligencer. 8 (1):
48–52. doi:10.1007/bf03023921. S2CID 120847834.
 "WordNet Search—3.1". Wordnetweb.princeton.edu. Retrieved May 14, 2012.
 "Definition of computer science | Dictionary.com". www.dictionary.com.
Retrieved June 11, 2020.
 Jump up to:a b c d e Denning, Peter J. (2000). "Computer Science: The Discipline"
(PDF). Encyclopedia of Computer Science. Archived from the original (PDF) on
May 25, 2006.
 Denning, Peter J. (April 1, 2005). "Is computer science science?". Communications
of the ACM. 48 (4): 27–31. doi:10.1145/1053291.1053309. S2CID 827843.
 Floridi, Luciano (February 25, 2010). Information: A Very Short Introduction.
OUP Oxford. ISBN 978-0-19-160954-1.
 https://www.tutorialspoint.com
 Computer Science: An Overview (12th Edition)Apr 11, 2014
 by Glenn Brookshear and Dennis Brylow
 Invitation to Computer ScienceFeb 4, 2015
 by G.Michael Schneider and Judith Gersting
 An Introduction to Computer Science, 2nd Ed.May 7, 2010 | Student
 Edition by John Zelle
 Introduction to Computer ScienceJun 20, 2011
 by ITL Education Solutions Limited
 A Balanced Introduction to Computer Science (3rd Edition)Sep 10,
 2010 by David Reed
 Introduction to Computer Science: A Textbook for Beginners in
 InformaticsOct 11, 2013 by Gilbert Brands
 Connecting with Computer Science (Introduction to CS) Jan 14, 2010
 by Greg Anderson and David Ferro
 Ecdl Information Technology Manual

126
Computer Science

Basic reference materials:


 Timothy J. O’Leary, Linda I. O’ Leary : Computing Essentials 2007 Complete
Edition, 18th Edition, McGraw-Hill, USA, 2007.
 Thomas H. Cormen: Introduction to Algorithms, Second Edition MIT Press, 2001.
 Conor Sexton: C Programming Made Simple, Reed Educational & Professional
Publishing Ltd., 1997.
 Brian W. Kernighan, Dennis M. Ritchie: The C Programming Language, Second
Edition, Prentice –Hall Inc., New Jersey, 1988.
 Lecture notes: ftp://zly.kis.p.lodz.pl/pub/people/L.Jackowska/ItCS
 Laboratory instruction: http://lidia-js.kis.p.lodz.pl/ITCS/

127

You might also like