0% found this document useful (0 votes)
2 views16 pages

Understanding Computer Instructions

A computer is an electronic device that processes data through input, storage, and output operations, characterized by speed, accuracy, reliability, and versatility. It performs tasks automatically based on user instructions but lacks intelligence and emotions. The document also outlines the advantages and disadvantages of computers, their components, and the problem-solving process in programming.

Uploaded by

rajddl
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views16 pages

Understanding Computer Instructions

A computer is an electronic device that processes data through input, storage, and output operations, characterized by speed, accuracy, reliability, and versatility. It performs tasks automatically based on user instructions but lacks intelligence and emotions. The document also outlines the advantages and disadvantages of computers, their components, and the problem-solving process in programming.

Uploaded by

rajddl
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Definition of Computer :

A computer is an electronic device that has the ability to store, retrieve, and process
data, and can be programmed with instructions that it remembers.
or
It is an Electronic Device It accepts data through input devices(namely Keyboard, Mouse,
Microphone), process it under CPU (central Processing Unit) and display through dutput
devices (namely Monitor, Printer , Speaker).

Characteristics of Computer :
The major characteristics of computer can be classified in to speed,accuracy,
diligence,versatility and memory which are as follows:
Speed
The computer is able to process the date and give the
output in fractions of seconds such that required
information is given to the user on time enabling the
user to take right decisions on right time. A powerful
computer is capable of executing about 3 million
calculations per second.

Accuracy
Inspire of its high speed of processing, the computers
accuracy is consistently high enough which avoids any
errors. If it all there are errors, they are due to errors in instructions given by the
programmer.

Reliable
The output generated by the computer is very reliable, but it is reliable only when the
data, which is passing as input to the computer and the program, which gives instructions
are correct and reliable.

Storage Capacity
The computer has a provision to store large volumes of data in the small storage devices,
which have capacity to store huge amounts of data and help the retrieval of data an easy
task.

Versatile
The computer perform three basic operations
• It is capable to access and accept information through various input-output
devices from the user.
• It performs basic Arithmetic and Logic operations on data as desired.
• It is capable to generate the desired output in the desired form.

Automation
Once the instructions fed into computer it works automatically without any human
intervention until the completion of execution of program until meets logical instructions to
terminate the job

No IQ: – Computer is a dumb machine and it cannot do any work without instruction from the user. It
performs the instructions at tremendous speed and with accuracy. It is you to decide what you want to
do and in what sequence. So a computer cannot take its own decision as you can.

No Feeling: – It does not have feelings or emotion, taste, knowledge and experience. Thus it does not
get tired even after long hours of work. It does not distinguish between users.

Functionalities of a computer

Any digital computer carries out five functions in gross terms:

• Takes data as input.


• Stores the data/instructions in its memory and use them when required.
• Processes the data and converts it into useful information.
• Generates the output
• Controls all the above four steps.

Definition

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.

Advantages or Features or Benefits


Following list demonstrates the advantages of computers in today's arena.
1) 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 for doing the same task.

2)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 correct input
has been given.
3)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 and many
others.
4)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 do repeated work with same speed and accuracy.
5)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.

6)Reliability
• A computer is a reliable machine.
• Modern electronic components have long lives.
• Computers are designed to make maintenance easy.

7)Automation

• Computer is an automatic machine.


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

8)Reduction in Paper Work


• The use of computers for data processing in an organization leads to
reduction in paper work and results in speeding up a 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.

9)Reduction in Cost
• Though the initial investment for installing a computer is high but it
substantially reduces the cost of each of its transaction.

Disadvantages
Following list demonstrates the disadvantages of computers in today's arena

1)No I.Q
• A computer is a machine that has no intelligence to perform any task.
• Each instruction has to be given to computer.
• A computer cannot take any decision on its own.

2)Dependency
• It functions as per a user’s instruction, so it is fully dependent on human being

3)Environment
• The operating environment of computer should be dust free and suitable.

4)No Feeling
• Computers have no feelings or emotions.
• It cannot make judgement based on feeling, taste, experience, and
knowledge unlike a human being.

Components of computer
All types of computers follow a same basic logical structure and perform the
following five basic operations for converting raw input data into information
useful to their users.
[Link]. Operation Description
The process of entering data and instructions
1 Take Input into the computer system
Saving data and instructions so that they
are available for processing as and when
2 Store Data required.
Performing arithmetic, and logical
Processing operations on data in order to convert
3 Data them into useful information.
The process of producing useful information
Output or results for the user, such as a printed
4 Information report or visual display.
Control the Directs the manner and sequence in which
5 workflow all of the above operations are performed.

Input Unit
This unit contains devices with the help of which we enter data into computer.
This unit makes link between user and computer. The input devices translate the
information into the form understandable by 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 computer.
CPU itself has following three components
• ALU(Arithmetic Logic Unit)
• Memory Unit
• Control Unit
Output Unit
Output unit consists of devices with the help of which we get the information from
computer. This unit is a link between computer and users. Output devices translate
the computer's output into the form understandable by users.

1)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
ktop publishing, and for running
spreadsheet and database management applications. At
home, the most popular use for personal computers is
playing games and surfing Internet.
Although personal computers are designed as single
single-user
user systems, these systems
are
re normally linked together to form a network. In terms of power, now-a-days
now
High-end
end models of the Macintosh and PC offer the same computing power and
graphics capability as low--end
end workstations by Sun Microsystems, Hewlett-Packard,
Hewlett
and Dell.

2)Worksta
2)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.
capabilitie
Workstations generally come with a large, high-resolution
high resolution graphics screen, large
amount of RAM, inbuilt network support, and a graphical user interface. Most
workstations also have a mass storage device such as a disk drive, but a special
type of workstation,
tation, called a diskless workstation, comes without a disk drive.
Common operating systems for workstations are UNIX and Windows NT. Like PC,
Workstations are also single
single-user
user computers like PC but are typically linked
together to form a local-area
area network,
network, although they can also be used as stand-
stand
alone systems.

3)Minicomputer
It is a midsize multi-processing
multi processing system capable of supporting up
to 250 users simultaneously.
4)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

5)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).

INTRODUCTION TO PROBLEM SOLVING


 Problem solving is a process of transforming the description of a problem into the
solution of that problem by using our knowledge of the problem domain and by
relying on our ability to select and use appropriate problem-solving
Strategies,
Techniques and Tools.
 Problem solving (with in the context of developing
programs) refers to analyzing a
problem with the intention of deriving a solution for the
problem.
 Using computer’s in problem solving.
 Software development method (SDM).
Consists of the following steps:
 Requirements specifications (Specification of
needs).
 Problem analysis.
 Design the algorithm to solve the problem.
 Implementation.
 Testing and verification.
 Documentation.
 Requirements specifications (Specification of needs).
State the problem clearly and unambiguously (Doubtless) to understand exactly:
•What the problem is?
•What is needed to solve it?
•What the solution should provide
•If there are constraints and special conditions.

 Problem Analysis:
In the analysis phase, we should identity the following:
•Inputs: To the problem, their form and the input media to be used.
•Outputs: Expected from the problem, their form and the output media to be
used.
•Special constraints or (necessity) conditions (if any).
•Formulas or equations to be used.
Example:
Problem: Compute and display the total cost of apples given the number of
kilograms (kg) of apples purchased and the cost per kg of apples.
 Input: Quantity of Apples purchased (in kg).
 Cost per kg of Apples (in Rs. per kg)
 Output: Total cost of Apples (in Rs.).
 Constraint: N/A
 Formula: Total cost = Cost per kg x Quantity

 Design the algorithm to solve the problem.


• Purpose: To develop and verify algorithm
• An algorithm is a list of steps to be executed with the right order in which
these steps
should be executed.
• An algorithm must satisfy these requirements:
•It must have and Input.
•It must have an Output.
•It must not be ambiguous (there should not be different interpretations to
it).
•It must be general (it can be used for different Inputs).
•Writing the algorithm is a difficult task ◊ use top-down design (Divide and
Conquer approach).

o Top-Down design
1. List the major steps (most algorithm consists of at least the following):
•Get the data.
•Perform the computations.
•Display the result.
2. Perform algorithm refinement the step(s) may need to be broken down into
a
more detailed list of steps.
3. Verify that the algorithm works as intended – perform desk check.
- It must be correct and it must solve the problem for which it is designed.
- It must execute and terminate in a finite amount of time.
- It must be efficient enough so that it can solve the intended problem using
the
resource currently available on the computer.

ALGORITHM : An algorithm can be represented using Pseudo codes (or) Flow


charts.
- Specifying the order in which the steps are to be executed is important.
Example:
Algorithm for getting out of bed and prepare to go to work.
o Get out of Bed.
o Take Shower.
o Get Dressed.

•If a same steps are performed in a slightly different order:


o Get out of Bed.
o Get Dressed.
o Take Shower.
What would be the result?

PSEUDO CODE:
Pseudo code is semiformal English – like language with limited
vocabulary that can be
used to design and describe algorithms.
Criteria of a good pseudo code:
 Easy to user stand, precise and clear
 Gives the correct solution in all cases
 Eventually ends
FLOWCHART:
 Flowchart is a graph used to depict or show a step by step solution using
symbols which
represent a task.
 The symbols used consist of geometrical shapes that are connected by
flow lines.
 It is an alternative to pseudo coding, where as a pseudo code description
is verbal. A
flowchart is graphical in nature.
FLOWCHART SYMBOLS

Any algorithm can be described using only three control program structures:
1. Sequence.
2. Selection.
3. Repetition.
SEQUENCE CONTROL STRUCTURE:
- A series of steps or statements that are executed in a specific order.
- The beginning and end of a block of statements can be optionally marked
with the
keywords begin & end.
- The structure:
Statement 1
Statement 2
Statement 3

Selection control structure:


- Defines two courses of action depending on the outcome of a condition
- A condition is an expression that is either true (or) false.
- The keyword used are if and else.

REPETITION CONTROL STRUCTURE:


- specifies a block of one or more statements that are repeatedly executed
until a
condition is satisfied
- (repeated until some termination condition occurs)
- Key word used is while

IMPLEMENTATION:
- the process of implementing an algorithm by writing a computer program
using a
programming language (example: using ‘c’ language)
- the output of the program must be the solution of the intended problem.

TESTING AND VERIFICATION:


- program testing is the process of executing a program to demonstrate its
correctness.
- Program verification is the process of ensuring that a program meets user
requirement
- After the program is compiled we must run the program and test/verify it
with
different inputs before the program can be released to the public or other
users (or
to the instructor of this class)
DOCUMENTATION
- contains details produced at all stages of the program development cycle.
Can be done in 2 ways
• writing comments between your line of codes.
• Creating a separate text file to explain the program.
- Important not only for other people to use or modify your program, but also
for you to understand your own program after along time.

Documentation is so important because:


 You may return to this program in future to use whole of or a part of it
again.
 Other programmer or end user will need some information about your
program
for reference (or) maintenance.
 You may some day have to modify the program, or may discover some
errors or
weakness in your program.
 Although documentation is listed as the last stage of software
development
method, it is actually an or going process which should be done from the
very
beginning of the software development process.

HISTORY OF ‘C’
- ‘C’ is a general purpose structured programming language developed at bell
laboratories in 1972/
- It was designed and written by a system programmer named dennis Ritchie.
- C is a powerful programming language, which is attracting considerable
attention world wide because it is reliable, simple, east to use and highly
portable, ( i.e, a program written in c can be transferred easily from one
computer to another)
- one man language (live PASCAL APL & USP)
- Programmers can write additional library functions of their own, this features
& capabilities of the c language can be extended by the user.
- C language is used for developing database systems, graphics packages,
spread sheets, CAD/CAM applications, word processor, and office automation,
scientific and engineering applications.
STEPS IN LEARING C
Learning C is easier than any other programming language.
Fig: shows the steps in learning C

The ‘C’ character set:


- A character denotes an alphabet, digit, or a special character.
- These character can be combined to form variables.
- C uses constants, variables, operator, keywords and expressions as building block
to form a basic C program.
- Valid characters used in ‘C’ programming are as follows
ALPHABETS:
Upper case letters A-Z Digits: 0-9
Lower case letters a-z

Special characters:
~ Tilde _ under score < Less than symbol
! Exclamation mark + Plus sign > Greater than symbol
@ At symbol - Minus sign ? Question mark
# Number sign = Equal to {Left flower brace
$ dollar sign ‘Apostrophe } right flower brace
% percent sign “Quotation mark [ left bracket
^ Caret : Colon ] right bracket
& ampersand ; Semicolon . dot operator
* Aste risk , comma \ back slash
(Left parenthesis | Vertical bar
) right parenthesis / slash

WHITE SPACE CHARACTERS:


\b blank space \r carriage return
\f form feed \t horizontal tab
\n new line \v vertical tab
- Because they serve the same purpose as the spaces between words and lines on a
printed
pate.- they make reading easier.
KEY WORDS AND IDENTIFIERS:
- Key words also referred as reserved words the words whose meaning has been already
defined in the C compiler.
- All key words have fixed meaning and their meanings cannot be changed.
- Key words can be used only for their intented purpose and they cannot be used as user
defined variables.
- All key words must be compulsorily written in lower case
Auto Float
Double short Case size of
Int unsigned Enum volatitle
Struct continue Register do
Break for Typedef if
Else void Char static
Long default Extern while
Switch goto Return
Union some compilers may use additional keywords
Const
- An identifier is a string of alphanumeric characters that begins with an alphabetic
character (or) an underscore character various programming elements such as
variables,
functions, arrays, structure, unions and so on.
- these are 53 characters, to represent identifiers.
They are 52 alphabetic characters (i.e., both uppercase lower case alphabets)

And underscore character.


- The under score character is considered as as letter in identifiers. The underscore
character is usually used in the middle of an identifier.
- these are 63 alpha numeric characters, i.e, 53 alphabetic characters and 10
digits(i.e., 0-9)

RULES FOR CONSTRUCTION IDENTIFIERS


* The first character in an identifier must be an alphabet or an underscore and can
be followed only by any number of alphabets, or digits or under scores.
* No commas or blank spaces are allowed within a variable name.
* The name used to representation an identifier should not be a keyword
* No special character other than underscore can be used to represents identifiers.
* Identifiers are case sensitive (i.e., AVERRGE is different from Average (or)
average(or) AVERAGE)
White space characters:
\n – closes a line
\f – closes a page
\t - prints a tab wide spaces
\b – blank space

DATA TYPES
_ The data types supported in a language dictates the type of values.
- It supports a wide variety of data types each of which may be represented
differently
within the computers memory which allows programmer to select the appropriate
type to
the needs of the application
Various datatypes available in C
- Primary data type
- User defined data type
All C compilers supports four primary data types namely.
• Character data type represented as char
• Integer data type represented as Int
• Floating point data type reprinted as float
• Double-Precision floating-point data type represented as double.

You might also like