2. Topics to be covered in UNIT-1
Computer Fundamentals:
Computer Systems: Computer Hardware, Computer Software,
Computer Environments:
Personal Computing Environment, Time-sharing Environment,
Client/Server Environment, Distributed Computing,
Computer Languages:
Machine Languages, Symbolic Languages, High-Level Languages,
Creating and Running Programs:
Writing, editing, compiling, linking, and executing programs,
System Development – SDLC.
Problem Solving Techniques:
Algorithms, pseudo code, flowcharts
Simple illustrations and domain problems like:
Sum of digits of a number,
Nature of quadratic equations,
Income Tax Problem, Standard Deviation.
S.Durga Devi
3. What is a computer?
A computer is a
programmable machine.
It allows the user to
store all sorts of
information and then
process that information
or carry out actions with
the information such as
calculating numbers or
organizing words
S.Durga Devi
5. Computer hardware
• Hardware refers to any physical, electrical components of the
computer.
• The physical equipments required to create, use, manipulate and
store electronic data.
• Hardware consist of five parts- input devices, cpu (central
processing unit), output devices, memory, storage devices.
S.Durga Devi
7. Input Devices:
The input device is used to enter data into a computer.
The devices like keyboard, mouse and scanner are commonly
used input devices.
Central Processing Unit:
It is heart of the computer.
It’s main function is to execute programs stored in the main
memory.
It consists of three functional units: ALU, CU and MU.
Arithmetic and Logic Unit (ALU):
It performs arithmetic and logical operations on the data.
Control Unit:
It controls the overall activities of the components of the
computer.
Memory Unit:
this is the place where data stored temporarily during processing. Ex-
RAM ( Random Access Memory)
the data stored on the main memory is erased when the computer is
turned off. S.Durga Devi
8. Memory: There are two types of memories.
• Volatile Memory
• Non-volatile Memory
Volatile Memory: It means that the information present in these
types of memory devices is deleted as soon as the power is
switched off.
Non-volatile Memory: It means that the information present in
these types of memory devices is not lost as soon as the power is
switched off.
Types of Storage Devices:
• Primary Storage or Main Memory.
• Auxiliary Storage or Secondary Storage
• Cache memory
• Registers
S.Durga Devi
10. Primary Storage/Main Memory:
This is the place where the data is stored temporarily during
processing.
Primary memory (main memory) is available in two forms: RAM
and ROM.
RAM (Random Access Memory):
It is a temporary storage medium in a computer.
The data which is to be processed by the computer is
transferred from a storage device to RAM during data
processing.
RAM is a volatile memory.
ROM (Read Only Memory) :
It is a permanent storage medium which stores start up
programs. Like bootstrap loader.
These programs are loaded when computer is switched on.
ROM is non-volatile memory.S.Durga Devi
11. Auxiliary Storage/Secondary Memory:
The programs which are not needed currently by the CPU are
stored in secondary memory.
It is the place where data to be stored permanently. Ex:
Disk,tapes.
Cache Memory:
It is a memory placed between CPU and main memory.
It is faster compared to the primary memory.
Parts of the program or data that need to be accessed
repeatedly are stored in cache memory.
It is a volatile memory.
Registers:
Registers are small memory units internally available within the
processor which stores the processed data by the CPU
It is a volatile memory.
Output Devices:
It is used to display or print the result.
Monitor, printer and plotter are commonly used output devices.
If output is shown on the screen it is called soft copy. If it is
printed on the paper is called hard copy.S.Durga Devi
12. Computer software
Software refers to set of instructions or program written to
achieve a specific task
these instructions written in programming languages which are
understand by the computer.
Programming language- An artificial set of rules, vocabulary and
syntax used to instruct the computer to execute certain tasks.
Software is categorized into two
1. system software
2. application software.
S.Durga Devi
14. System software
System software manage the hardware resources of a
computer and perform the processing.
1. operating system computer must have operating system in
order to run the other programs.
- ensures operating the system in efficient manner while
allowing the users to access the same system.
2. System support software provides all the utilities that
enable the computer to function. Ex:- sort programs and
disk formatting programs.
3. System development software this includes language
translators used convert into machine language for
execution, debugging tools to ensure that the programs
are error- free. Ex- compilers.
S.Durga Devi
15. Application software
Application Software is responsible for helping the
users in solving the general or specific problems.
1. General purpose software same software used for
several purposes
ex- word processor, DBMS, CAD, MS Office
2. application specific software a software is used only
for the particular task for which it is designed.
ex- Internet explorer, anti virus, media player.
S.Durga Devi
17. Computing environment
1. Personal computing environment
2. Time sharing environment
3. Clientserver environment
4. Distributed environment
S.Durga Devi
18. 1. Personal computing environment
Fig: Personal computing environment
->In this environment a single personal computer is maintained to which all the
computer hardware components are tied together.
->This computer is used by our self. We can do whatever you want. In this environment
no need of server. It is like an individual pc for each individual user.
S.Durga Devi
19. 2. Time sharing environment
FIG- Time-sharing Environment
• In the time sharing environment
many users are connected to
one or more computers.
-> the output devices like printers
and auxiliary storage devices
Are shared by all the users.
->ex:- in college lab mini
computer is shared by all the
Students.
-> in which all computing must
done by the central computer.
-> shared resources are
connected
to central computer so that it
must
Control the shared resources.
-> it must manage the shared
data
and printing. Always keeps the
computer busty.S.Durga Devi
20. 3. clientserver environment
-> all the computing functions are shared between the central computer and users
computers.
-> the users are given personal computer or work station which are known as clients
-> the central computer is called server.
-> this environment much faster than the time sharing environment as the work
shared between the user computers and the server.
S.Durga Devi
21. 4. Distributed computing
-> It is the integration of different clients and different servers.
ex- internet.
-> the connectivity between these different users and different servers
provided by internet through out the world.
S.Durga Devi
22. Computer languages
• A program for the computer must be written
in programming language. The first
programming language is machine language.
computer languages were evolved from
machine language to natural language
( english like language).
S.Durga Devi
23. Machine language
• Machine language was the first programming
language in the early days of computers.
• The language which is understand by the
computer hardware is called machine
language.
• It consists of 0’s and 1’s.
• Internally the computer consists of circuits
which are made of switches, transistors and
other electronic devices that can be in one of
the two states: off or on.
• Off- 0, on- 1.
S.Durga Devi
25. PROGRAM 1-1 The Multiplication Program in Machine Language
S.Durga Devi
26. Symbolic language
• Writing program in machine language is
difficult.
• The language is represented in symbols or
mnemonics so it is called symbolic language.
• This is language does not understand by the
computer .hence, it must be translated to the
machine language using the assembler.
• Another name of the symbolic language is
assembly language.
S.Durga Devi
27. PROGRAM 1-2 The Multiplication Program in Symbolic Language
S.Durga Devi
28. High level languages
• It is like natural language which can understand by the
programmer.
• They must be converted into the machine language is called
compilation.
• First high level language is FORTRAN
• High level languages are – c, c++,java, cobol etc
S.Durga Devi
29. PROGRAM 1-3 The Multiplication Program in C
continued
S.Durga Devi
30. PROGRAM 1-3 The Multiplication Program in C (continued)
S.Durga Devi
31. Creating and Running Programs
• Creating and running programs takes
place in 4 steps.
1. writing and editing the program.
2. compiling.
3. linking the program with the required
library functions.
4. executing the program.
S.Durga Devi
33. 1. writing and editing the program
• Software used to write programs is known as a text
editor, where we can type, edit, store character data.
• Text editor which includes compilers, we complete a
program and save file on to the disk with “.c”
extension. This file is called source file.
S.Durga Devi
34. 2. Compiling program
• The source file on disk must be converted to
machine language using the special software called
compilers. It could complete its task in two steps.
i) preprocessor ii) translator
i) preprocessor- preprocessor reads source file and
checks for special commands known as preprocessor
commands ( instructions which are starts with #
symbols ). The resultant of preprocessor is called
translation unit. Another point about preprocessor
is it processes the source file before compilation.
ii) Translator- translator is a program which converts
the program into machine language and gives the
object modules. This module not yet ready to run
because it not yet include other special functions.
- output of the translator saves the file with .o or
.obj extension filename is same as c program.
S.Durga Devi
35. 3. linking the program with the required library
functions
• After the program is translated into object code, it is ready to
linked with the library functions required in the program.
• Library functions – functions which are already been written and
compiled by the compiler.
• C program made up of different functions in which some
functions can written by programmer and other functions like
input/output processes and mathematical library functions are
included in compiler else where those must be attached to our
program.
• The linker assembles all of these functions and produces the
executable file which is ready to run on the computer.
• Stored with .exe extension.
S.Durga Devi
36. 4. executing the program.
• Now, operating system is responsible to
run the program which uses the run
command.
• It loads the program from the disk to
main memory is called loader.
S.Durga Devi
37. Writing and Running Programs
#include <stdio.h>
/* The simplest C Program */
int main(int argc, char **argv)
{
printf(“Hello Worldn”);
return 0;
}
1. Write text of program (source code) using an editor
such as TC, save as file e.g. my_program.c
2. Run the compiler to convert program from source to
an “executable” or “binary”:
ALT + F9 my_program.obj
my_program
$ gcc -Wall –g my_program.c –o my_program
tt.c: In function `main':
tt.c:6: parse error before `x'
tt.c:5: parm types given both in parmlist and separately
tt.c:8: `x' undeclared (first use in this function)
tt.c:8: (Each undeclared identifier is reported only once
tt.c:8: for each function it appears in.)
tt.c:10: warning: control reaches end of non-void function
tt.c: At top level:
tt.c:11: parse error before `return'
3. Compiler gives errors and warnings; edit source file,
fix it, and re-compile
4. Run it and see if it works
CTRL + F9 (ALT + F5)
C:>/my_program
Hello World
C:>
What if it doesn’t work?
S.Durga Devi
38. System Development life cycle
We’ve now seen the steps that are necessary to build a program.We’ve now seen the steps that are necessary to build a program.
In this section, we discuss how we go about developing aIn this section, we discuss how we go about developing a
program. This critical process determines the overall qualityprogram. This critical process determines the overall quality
and success of our program. If we carefully design eachand success of our program. If we carefully design each
program using good structured development techniques, ourprogram using good structured development techniques, our
programs will be efficient, error-free, and easy to maintain.programs will be efficient, error-free, and easy to maintain.
-> the software development is the translation of user need or-> the software development is the translation of user need or
marketing goal into a software product is calledmarketing goal into a software product is called softwaresoftware
development life cycledevelopment life cycle..
-> sofware development life cycle is a frame work that is used to-> sofware development life cycle is a frame work that is used to
structure, plan and control the process of developing anstructure, plan and control the process of developing an
information system.information system.
-> there are several software development techniques among-> there are several software development techniques among
them waterfall method is one of the famous methodology.them waterfall method is one of the famous methodology.
S.Durga Devi
40. 1. System requirements- if programmer knows what
exactly customer wants then he can develop the
project. The experienced and skilled persons
recognize the requirements from the client.
2. Analysis- looks at different alternatives from the
system point of veiw.
3. Design- what are inputs required and how they are
converted into outputs and also design the
flowchart or algorithm for the program.
4. Coding- implement the program using computer
programming languages.
5. Testing- the project is gone under the testing and
make sure that project works well without any
errors.
6. Maintenance- keeps the project working
S.Durga Devi
41. 41
Program Development
1.Understand the problem
2.Develop solution
1.Structure Chart
2.Algorithm/ pseudocode
3.Flowchat
3.Write the program
4.Test the program
S.Durga Devi
42. Understand the problem
• To solve any problem first we must understand the problem by
knowing the requirements of the problem.
• Once we understand it, review with user(customer) and system
analyst.
S.Durga Devi
43. Develop the solution
• To develop a solution to a problem it needs three
tools.
1. Structure chart-hierarchical chart
- Shows the functional flow through our program.
- Shows how the problem is broken into logical steps.
Each step will be a separate module.
2. Algorithm
3. flowchart
S.Durga Devi
45. Algorithm or pseudo code
• Definition of algorithm- Al Kho-war-iz-mi an ordered sequence
of unambiguous and well-defined instructions that performs
some task and halts in finite time
• Let's examine the four parts of this definition more closely.
1. Ordered sequence- we can number the step.
2. Unambiguous and well defined instructions- each instruction is
clear, understand without difficulty.
3. Performs some task
4. Halts in finite time- algorithm must terminate at some point.
S.Durga Devi
46. Properties of an algorithm:-
Finiteness :- An algorithm must terminate in a finite number of
steps.
Definiteness :- Each step of the algorithm must be precisely and
unambiguously stated.
Effectiveness:-Each step must be effective, and can be
performed exactly in a finite amount of time.
Generality :- The algorithm must be complete in itself.
Input /Output :- Each algorithm must take zero, one or more
inputs and produces one or more outputs.
S.Durga Devi
47. How to represent an algorithm
• 1. use natural language- English
• 2. use formal programming language.
• 3. pseudo code- natural language constructs modeled
looks like statements available in the programming
language.
• Pseudo code- An algorithm written in English like
language that follows the loosely defined syntax is
called pseudo code.
• Pseudo code is a numbered list of instructions to
perform a task.
S.Durga Devi
48. Three Categories of Algorithmic Operations
• An algorithm must have the ability to alter the order of its
instructions. An instruction that alters the order of an
algorithm is called a control structure
• Three Categories of Algorithmic Operations:
1. sequential operations - instructions are executed in order
2. Conditional/selection ("question asking") operations - a control
structure that asks a true/false question and then selects the
next instruction based on the answer
3. iterative operations (loops) - a control structure that execute
block of instructions repeatedly.
S.Durga Devi
49. • Pseudo-code and algorithm Constructions : A Summary
• Computation/Assignment
• setinitialize the value of "variable" to :"arithmetic expression" or
"variable" equals "expression" or
"variable" = "expression"
• Input/Output
• get enterread "variable", "variable", ...
Displayprint "variable", "variable", ...
• Conditional (dot notation used for numbering subordinate statements)
• 1. if "condition"
1.1 (subordinate) statement 1
1.2 etc ...
2. else
2.1 (subordinate) statement 2
2.2 etc ...
• Iterative (dot notation used for numbering subordinate statements)
• 3. while "condition"
3.1 (subordinate) statement 1
3.2 etc ...
S.Durga Devi
50. S.Durga Devi
Example1: To determine whether a student is passed or not
Pseudo Code:
1. If student's grade is greater than or equal
to 60
1.1 Print "passed"
2. else
2.1 Print "failed"
Algorithm:
Begin
1. If grade >= 60
1.1 Print "passed"
2. else
2.1 Print "failed”
End
51. Example 2: Write an algorithm to determine a student’s final grade
and indicate whether it is passing or failing. The final grade is
calculated as the average of four marks.
Pseudo Code:
1. Input set of 4 marks
2. Calculate their average by summing and dividing by 4
3. if average is below 50
4. Print “FAIL”
5. else
6. Print “PASS”
Algorithm:
Begin
Step 1: Input M1,M2,M3,M4
Step 2: GRADE ← (M1+M2+M3+M4)/4
Step 3: if (GRADE < 50) then
Step 4: Print “FAIL”
Step 5: else
Step 6: Print “PASS”
Step 7: endif
End
52. Example- write an algorithm for finding sum of any two
number
1. Start
2. Declare a,b,c
3. Print “ enter a and b values through keyboard”
4. c= a+b
5. Print c
6. Stop.
53. • Example - Computing a Quiz Average: Pseudo-code a routine to
calculate your quiz average.
1. get number of quizzes
2. sum = 0
3. count = 0
4. while count < number of quizzes
4.1 get quiz grade
4.2 sum = sum + quiz grade
4.3 count = count + 1
5. average = sum / number of quizzes
6. display average
7. halt
variables: number of quizzes, sum ,count, quiz grade, average
This example introduces an iterative control statement. As long as the
condition in line 4 is True, we execute the subordinate operations 4.1 -
4.3. When the condition becomes False, we resume the pseudo-code at
line 5.
S.Durga Devi
54. Flow chart
• Pictorial representation of an algorithm is called flow chart.
• A flow chart is a graphical or symbolic representation of a
process.
• A diagram that uses graphic symbols to depict the nature and
flow of the steps in a process.
• Snap shot of an algorithm.
S.Durga Devi
56. Start
c = a + b
End
Flowchart to find the addition of two numbers
input a, b
Display C
57. Algorithm to find whether a given year is a leap year or not.
Algorithm:
BEGIN
Step 1: Accept the YEAR
Step 2: if (YEAR %4 == 0) then
Display “Year is a leap year”
else
Display “Year is not a leap year”
end if
END
58. Start
End
if(year%4 = = 0)
false
true
Flowchart to find whether a given year is a leap year or not
Accept year
Display leap year
Display non leap year
59. 1. Sum of the first 50 natural numbers
2. sum of the digits of a number.
3. nature of quadratic equations
S.Durga Devi