0% found this document useful (0 votes)
38 views

Unit 1 (Module1)

Uploaded by

Shruthi Iyer
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Unit 1 (Module1)

Uploaded by

Shruthi Iyer
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

MODULE 1

COMPUTER OVERVIEW
The literal meaning of computer is a device that can calculate. However,
modern computers can do a lot more than calculate.
Computer is an electronic device that receives input, stores or processes
the input as per user instructions and provides output in desired format.

Input-Process-Output Model

Computer input is called data and the output obtained after processing
it, based on user’s instructions is called information. Raw facts and
figures which can be processed using arithmetic and logical operations
to obtain information are called data.

The processes that can be applied to data are of two types −


 Arithmetic operations − Examples include calculations like
addition, subtraction, differentials, square root, etc.
 Logical operations − Examples include comparison operations
like greater than, less than, equal to, opposite, etc.
The corresponding figure for an actual computer looks something like
this −
The basic parts of a computer are as follows −
 Input Unit − Devices like keyboard and mouse that are used to
input data and instructions to the computer are called input unit.
 Output Unit − Devices like printer and visual display unit that are
used to provide information to the user in desired format are
called output unit.
 Control Unit − As the name suggests, this unit controls all the
functions of the computer. All devices or parts of computer
interact through the control unit.
 Arithmetic Logic Unit − This is the brain of the computer where
all arithmetic operations and logical operations take place.
 Memory − All input data, instructions and data interim to the
processes are stored in the memory. Memory is of two types
– primary memory and secondary memory. Primary memory
resides within the CPU whereas secondary memory is external to
it.
Control unit, arithmetic logic unit and memory are together called
the central processing unit or CPU. Computer devices like keyboard,
mouse, printer, etc. that we can see and touch are
the hardware components of a computer. The set of instructions or
programs that make the computer function using these hardware parts
are called software. We cannot see or touch software. Both hardware
and software are necessary for working of a computer.
Characteristics of Computer

To understand why computers are such an important part of our lives,


let us look at some of its characteristics −
 Speed − Typically, a computer can carry out 3-4 million
instructions per second.
 Accuracy − Computers exhibit a very high degree of accuracy.
Errors that may occur are usually due to inaccurate data, wrong
instructions or bug in chips – all human errors.
 Reliability − Computers can carry out same type of work
repeatedly without throwing up errors due to tiredness or
boredom, which are very common among humans.
 Versatility − Computers can carry out a wide range of work from
data entry and ticket booking to complex mathematical
calculations and continuous astronomical observations. If you can
input the necessary data with correct instructions, computer will
do the processing.
 Storage Capacity − Computers can store a very large amount of
data at a fraction of cost of traditional storage of files. Also, data
is safe from normal wear and tear associated with paper.

Advantages of Using Computer

Now that we know the characteristics of computers, we can see the


advantages that computers offer−
 Computers can do the same task repetitively with same accuracy.
 Computers do not get tired or bored.
 Computers can take up routine tasks while releasing human
resource for more intelligent functions.

Disadvantages of Using Computer

Despite so many advantages, computers have some disadvantages of


their own −
 Computers have no intelligence; they follow the instructions
blindly without considering the outcome.
 Regular electric supply is necessary to make computers work,
which could prove difficult everywhere especially in developing
nations.

Introduction of computer components


 Computer systems consist of three components as shown in below
image: Central Processing Unit, Input devices and Output
devices. Input devices provide data input to processor, which
processes data and generates useful information that’s displayed to
the user through output devices. This is stored in computer’s
memory.

Central Processing Unit

The Central Processing Unit (CPU) is called "the brain of computer" as


it controls operation of all parts of computer. It consists of two
components: Arithmetic Logic Unit (ALU), and Control Unit.
Arithmetic Logic Unit (ALU)

Data entered into computer is sent to RAM, from where it is then sent
to ALU, where rest of data processing takes place. All types of
processing, such as comparisons, decision-making and processing of
non-numeric information takes place here and once again data is moved
to RAM.

Control Unit

As name indicates, this part of CPU extracts instructions, performs


execution, maintains and directs operations of entire system.
Functions of Control Unit
Control unit performs following functions −

 It controls all activities of computer


 Supervises flow of data within CPU
 Directs flow of data within CPU
 Transfers data to Arithmetic and Logic Unit
 Transfers results to memory
 Fetches results from memory to output devices

Memory Unit

This is unit in which data and instructions given to computer as well as


results given by computer are stored. Unit of memory is "Byte".
1 Byte = 8 Bits

What is a Computer?

A computer is an electronic device that accepts data from the user,


processes it, produces results, displays them to the users, and stores the
results for future usage.
Data is a collection of unorganized facts & figures and does not provide
any further information regarding patterns, context, etc. Hence data
means "unstructured facts and figures".
Information is a structured data i.e. organized meaningful and
processed data. To process the data and convert into information, a
computer is used.

Functions of Computers

A computer performs the following functions −


Receiving Input
Data is fed into computer through various input devices like keyboard,
mouse, digital pens, etc. Input can also be fed through devices like CD-
ROM, pen drive, scanner, etc.
Processing the information
Operations on the input data are carried out based on the instructions
provided in the programs.
Storing the information
After processing, the information gets stored in the primary or
secondary storage area.
Producing output
The processed information and other details are communicated to the
outside world through output devices like monitor, printer, etc.
Sr.No Computer Concepts & Description
.

1 History of Computers

The history of the computer dates back to several


years. There are five prominent generations of
computers. Each generation has witnessed
several technological advances which change the
functionality of the computers.

2 Characteristics of Computer System


Characteristics of Computer System involve
Speed, Accuracy, Diligence, Versatility,
Reliability, Automation, Memory.

3 Basic Applications of Computer


Computers play a role in every field of life. They
are used in homes, business, educational
institutions, research organizations, medical
field, government offices, entertainment, etc.

4 Components of Computer System


Computer systems consist of three components
as shown in below image: Central Processing
Unit, Input devices and Output devices.

5 Input Devices – Keyboard and Mouse


Input devices help to get input or data from user.

6 Other Input Devices


There are few other input devices which help to
feed data to the computer.

7 Output Devices
Output devices help to display output to user

8 Computer Memory
Computer memory refers to storage area where
data is stored. It is of two types Primary
Memory & Secondary Memory.

9 Concept of Hardware and Software


The term hardware refers to mechanical device
that makes up computer.
Software can be categorized into two types -
System software & Application software

10 Programming Languages
The languages that are used to write a program
or set of instructions are called "Programming
languages". Programming languages are broadly
categorized into three types - Machine level
language, Assembly level language, High-level
language.

11 Representation of Data/Information
Computer does not understand human language.
Any data, viz., letters, symbols, pictures, audio,
videos, etc., fed to computer should be converted
to machine language first. Computers represent
that data into different forms.

12 Data Processing & Data Processing Stages


Data processing is a process of converting raw
facts or data into a meaningful information.

13 Applications of IECT
IECT stands for Information Electronics and
Communication Technology

An algorithm is a specific procedure for solving a well-defined


computational problem. The development and analysis of
algorithms is fundamental to all aspects of computer science:
artificial intelligence, databases, graphics, networking, operating
systems, security, and so on.
 Problem − Design an algorithm to add two numbers and display the
result.
 Step 1 − START.
 Step 2 − declare three integers a, b & c.
 Step 3 − define values of a & b.
 Step 4 − add values of a & b.
 Step 5 − store output of step 4 to c.
 Step 6 − print c.
 Step 7 − STOP
Algorithm is a step-by-step procedure, which defines a set of
instructions to be executed in a certain order to get the desired output.
Algorithms are generally created independent of underlying languages,
i.e. an algorithm can be implemented in more than one programming
language.

From the data structure point of view, following are some important
categories of algorithms −

 Search − Algorithm to search an item in a data structure.


 Sort − Algorithm to sort items in a certain order.
 Insert − Algorithm to insert item in a data structure.
 Update − Algorithm to update an existing item in a data structure.
 Delete − Algorithm to delete an existing item from a data structure.

Characteristics of an Algorithm

Not all procedures can be called an algorithm. An algorithm should have


the following characteristics −

 Unambiguous − Algorithm should be clear and unambiguous.


Each of its steps (or phases), and their inputs/outputs should be
clear and must lead to only one meaning.
 Input − An algorithm should have 0 or more well-defined inputs.
 Output − An algorithm should have 1 or more well-defined
outputs, and should match the desired output.
 Finiteness − Algorithms must terminate after a finite number of
steps.
 Feasibility − Should be feasible with the available resources.
 Independent − An algorithm should have step-by-step directions,
which should be independent of any programming code.

How to Write an Algorithm?


There are no well-defined standards for writing algorithms. Rather, it is
problem and resource dependent. Algorithms are never written to
support a particular programming code.

As we know that all programming languages share basic code constructs


like loops (do, for, while), flow-control (if-else), etc. These common
constructs can be used to write an algorithm.

In design and analysis of algorithms, usually the second method is used


to describe an algorithm. It makes it easy for the analyst to analyze the
algorithm ignoring all unwanted definitions. He can observe what
operations are being used and how the process is flowing.

Writing step numbers, is optional.

We design an algorithm to get a solution of a given problem. A problem


can be solved in more than one ways.

Hence, many solution algorithms can be derived for a given problem.


The next step is to analyze those proposed solution algorithms and
implement the best suitable solution
What do you mean by flowchart?

The Flowchart is the most widely used graphical representation of an


algorithm and procedural design workflows. It uses various symbols to
show the operations and decisions to be followed in a program. It flows
in sequential order.

Types of Flowchart

The various types of the flowchart are given below.

o Horizontal Flowchart
o Panoramic Flowchart
o Vertical Flowchart
o Architectural Flowchart

Rules or guidelines of Flow

chart:

The various Rules or Guidelines for drawing the flowchart

are given below.

o Only conventional flowchart symbols should be used.


o Proper use of names and variables in the flowchart.
o If the flowchart becomes large and complex, use connector
symbols.
o Flowcharts should have start and stop points.

Flowchart symbols:

The different flowchart symbols have different conventional meanings.

The various symbols used in Flowchart Designs are given below.


o Terminal Symbol: In the flowchart, it is represented with the help
of a circle for denoting the start and stop symbol. The symbol
given below is used to represent the terminal symbol.

o Input/output Symbol: The input symbol is used to represent the


input data, and the output symbol is used to display the output
operation. The symbol given below is used for representing the
Input/output symbol.

o Processing Symbol:It is represented in a flowchart with the help


of a rectangle box used to represent the arithmetic and data
movement instructions. The symbol given below is used to
represent the processing symbol.

o Decision Symbol: Diamond symbol is used for represents


decision-making statements. The symbol given below is used to
represent the decision symbol.

o Connector Symbol:The connector symbol is used if flows


discontinued at some point and continued again at another place.
The following symbol is the representation of the connector
symbol.

o Flow lines: It represents the exact sequence in which instructions


are executed. Arrows are used to represent the flow lines in a
flowchart. The symbol given below is used for representing the
flow lines:

o Hexagon symbol (Flat): It is used to create a preparation box


containing the loop setting statement. The symbol given below is
used for representing the Hexagon symbol.

o On-Page Reference Symbol: This symbol contains a letter inside


that indicates the flow continues on a matching symbol containing
the same letters somewhere else on the same page. The symbol
given below is used for representing the on-page reference symbol.

o Off-Page Reference: This symbol contains a letter inside


indicating that the flow continues on a matching symbol containing
the same letter somewhere else on a different page. The symbol
given below is used to represent the off-page reference symbol.

o Delay or Bottleneck: This symbol is used for identifying a delay


in a flowchart. The alternative name used for the delay is the
bottleneck. The symbol given below is used to represent the delay
or bottleneck symbol.

o Document Symbol: This symbol is used in a flowchart to indicate


a document or report.The symbol given below is used to represent
the document symbol.

o Internal storage symbol: The symbol given below is used to


represent the internal storage symbol.

Advantages of Flowchart in C:

Following are the various advantages of flowchart:

o Communication: A flowchart is a better way of communicating


the logic of a program.
o Synthesis: Flowchart is used as working models in designing new
programs and software systems.
o Efficient Coding: Flowcharts act as a guide for a programmer in
writing the actual code in a high-level language.
o Proper Debugging: Flowcharts help in the debugging process.
o Effective Analysis: Effective analysis of logical programs can be
easily done with the help of a related flowchart.
o Proper Documentation: Flowchart provides better and proper
documentation. It consists of various activities such as collecting,
organizing, storing, and maintaining all related program records.
o Testing: A flowchart helps in the testing process.
o Efficient program maintenance: The maintenance of the
program becomes easy with the help of a flowchart.

Disadvantages of Flowchart in C:

Following are the various disadvantages of flowchart:

o Time-consuming: Designing a flowchart is a very time-


consuming process.
o Complex: It isn't easy to draw a flowchart for large and complex
programs.
o There is no standard in the flowchart; there is no standard to
determine the quantity of detail.
o Difficult to modify: It is very difficult to modify the existing
flowchart.

Examples of flowchart:

The various examples of the flowchart are given below:

Example 1:

Design a flowchart for adding two numbers entered by the user.


Pseudo code
Pseudo code in C is a simple way to write programming code in
English. Pseudo-code is informal writing style for program
algorithm independent from programming languages to show the
basic concept behind the code.
Pseudocode is not an actual programming language. So it cannot be
compiled and not be converted into an executable program. It uses short
or simple English language syntax to write code for programs before it is
converted into a specific programming language.

Introduction:

It is also useful in a program development process and the programmers


will ensure that actual programming is likely to match design
specifications. The errors finding at the pseudo-code stage is less costly
than catching them later in the development process.

It is possible to write programs that will convert a given pseudo-code


language into a given programming language. In simple terms, pseudo-
code = Natural Language + Programming Language.

The pseudo code in C consists of words and phrases that make pseudo
code looks similar to the program but not a program. Pseudo codes are
written with respect to a programming language, but programming
language syntax or grammar is not strictly followed.

The pseudo-code is neither an algorithm nor a program. pseudo-code is a


semi-formal description of the steps to be carried out by the computer,
including Steps that are to be repeated and decisions that are to be made
but it constructs/models and maybe even look like programming code.

Pseudocode is made up of two words, ‘pseudo’ and ‘code’. Pseudo


means imitation and code refer to instructions, written in a programming
language.

Pseudocode is also known as Program Design Language (PDL) or


Structured has the following characteristics:

A free syntax of natural language that describes a processing feature.

A subprogram definition and calling techniques.

Fixed syntax of keywords that provide for all structured constructs, data
declarations and modularity characteristics.

A data declaration facility.

Pseudocode is a set of sequential written human language instructions,


usually numbered, that is used to describe the actions a program will
take when it is coded in a programming language.

Notations of Pseudo Code in C


IF (condition is True) THEN
List of Actions
ELSE
List of Different Actions
ENDIF
.
.
It is clear that if the condition is true, Action1 will be performed
otherwise Action2 will be performed. After performing the list of
actions, the control of the program moves on to the other actions in the
process flow.

Case Construct:

In this selection construct, multiple sets of statements are specified. Each


block of statements is associated with a value. The selection of a
particular set of statements is made on the basis of the value of the
variable given at the beginning of the selection structure.

Advantages and Disadvantages of Pseudo Codes

Advantages Of Pseudo Code in C:

Pseudo code is easier and simpler to understood by the programmers of


all types.

It cannot be compiled into an executable program.

Compared to a flowchart, it is easier to modify the pseudo-code of


program logic whenever program modifications are necessary.

Converting a pseudo code to a programming language is very easy as


compared with converting flowchart to a programming language.

To develop a pseudo-code it requires less time and effort than other


programming tools such as flowchart.

pseudo-code is easier to write than writing a program in a programming


language because pseudo-code as a method has only a few rules to
follow.
Disadvantages of Pseudo Code in C:

Pseudocode is textual representation of an algorithm. It does not provide


a graphical or visual representation.

Therefore, sometimes, it becomes difficult to understand the complex


written in Pseudocode.

There are no standard rules to follow in using the Pseudo code in C.

Different programmers use their own style of writing pseudo code and
hence communication problems occur due to lack of standardization.

For a beginner, it is more difficult to follow the logic or write pseudo


code as compared to the flowchart.

Number System and Base Conversions


Electronic and Digital systems may use a variety of different number
systems, (e.g. Decimal, Hexadecimal, Octal, Binary).
A number N in base or radix b can be written as:

N)b = dn-1 dn-2 -- -- -- -- d1 d0 . d-1 d-2 -- -- -- -- d-m


In the above, dn-1 to d0 is the integer part, then follows a radix point, and
then d-1 to d-m is the fractional part.
dn-1 = Most significant bit (MSB)
d-m = Least significant bit (LSB)
How to convert a number from one base to another?
Follow the example illustrations:
1. Decimal to Binary
(10.25)10

Note: Keep multiplying the fractional part with 2 until decimal part 0.00
is obtained.
(0.25)10 = (0.01)2

Answer: (10.25)10 = (1010.01)2


2. Binary to Decimal
(1010.01)2
1x23 + 0x22 + 1x21+ 0x20 + 0x2 -1 + 1x2 -2 = 8+0+2+0+0+0.25 = 10.25
(1010.01)2 = (10.25)10
3. Decimal to Octal
(10.25)10
(10)10 = (12)8
Fractional part:
0.25 x 8 = 2.00
Note: Keep multiplying the fractional part with 8 until decimal part .00
is obtained.
(.25)10 = (.2)8
Answer: (10.25)10 = (12.2)8

4. Octal to Decimal
(12.2)8
1 x 81 + 2 x 80 +2 x 8-1 = 8+2+0.25 = 10.25
(12.2)8 = (10.25)10
5. Hexadecimal to Binary
To convert from Hexadecimal to Binary, write the 4-bit binary
equivalent of hexadecimal.

(3A)16 = (00111010)2
6. Binary to Hexadecimal
To convert from Binary to Hexadecimal, start grouping the bits in
groups of 4 from the right-end and write the equivalent hexadecimal for
the 4-bit binary. Add extra 0’s on the left to adjust the groups.
1111011011
0011 1101 1011
(001111011011 )2 = (3DB)16

You might also like