Unit - I: S.Durga Devi 10/03/12 1
Unit - I: S.Durga Devi 10/03/12 1
Unit - I: S.Durga Devi 10/03/12 1
1. Computer fundamentals i. computer systems ii. Computer hardware iii. Computer software 2. computer environments i. Personal computing environment ii. Time- sharing environment iii. Client/server environment iv. Distributed environment.
10/03/12 S.Durga Devi 1
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
10/03/12
S.Durga Devi
Computer systems
Computer is a system made up of two components hardware and software.
10/03/12
S.Durga Devi
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.
Computer hardware
10/03/12
S.Durga Devi
Computer hardware
1. Input devices- keyboard, mouse, scanner, pen drive, touch screen. 2. CPU ( central processing unit)- enable to process data also known as a processor. 3. out put devices- monitor, printer, external disks. If output shown on the screen is the soft copy. If it is printed on the paper is called hard copy. 4. memory it is a part of the computer used to hold the waiting data to be processed. 5. storage devices- place where computer stores the data. these are two storage devices- primary storage or main memory. - main memory- 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. - auxiliary storage- also known as secondary storage this is the place where data to be stored permanently
10/03/12 S.Durga Devi 6
Computer software
Software is the computerized instructions that operate the computer, execute particular functions or tasks, and manipulate the data. These instructions need to be written in a programming language that the computer can understand.
Programming language- An artificial set of rules vocabulary and syntax used to instruct the computer to execute certain tasks.
10/03/12
S.Durga Devi
Computer software
10/03/12
S.Durga Devi
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. 2. System support software provides all the utilities that enable the computer to function. Ex:- sort programs and disk formatting. 3.System development software this includes language translators used convert into machine language for execution, debugging tools to ensure that the programs are
10/03/12
Application software
1. General purpose software same software used for several purposes ex- word processor, DBMS, CAD 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.
10/03/12
S.Durga Devi
10
Computing environment
1. 2. 3. 4. Personal computing environment Time sharing environment Client\server environment Distributed 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.
3. client\server 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.
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.
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).
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 0s and 1s. 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.
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.
PROGRAM 1-2
continued
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.
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.
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
$ 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 C:>/my_program Hello World C:>
(ALT + F5)
What if it doesnt work?
my_program
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.
Program Dvelopment
1.Understand the problem 2.Develop solution 1.Structure Chart 2.Algorithm/pseudocode 3.Flowchat 3.Write the program 4.Test the program
36
10/03/12
S.Durga Devi
37
Buy a computer
Get configurati on
calculate
Print report
desktop
Laptop
DELL
hp
DELL
hp
10/03/12
S.Durga Devi
39
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 output.
Examples: 1.. If student's grade is greater than or equal to 60 1.1 Print "passed" 2 else 2.1 Print "failed"
10/03/12
S.Durga Devi
43
10/03/12
S.Durga Devi
44
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 10/03/12 S.Durga block of instructions 45 repeats the execution of aDevi
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.
10/03/12 S.Durga Devi 46
Pseudo-code Language Constructions : A Summary Computation/Assignment set\initialize the value of "variable" to :"arithmetic expression" or "variable" equals "expression" or "variable" = "expression" Input/Output get \enter\read "variable", "variable", ... Display\print "variable", "variable", ... Conditional (dot notation used for numbering subordinate statements) 6. if "condition" 6.1 (subordinate) statement 1 6.2 etc ... 7. else 7.1 (subordinate) statement 2 7.2 etc ... Iterative (dot notation used for numbering subordinate statements) 9. while "condition" 9.1 (subordinate) statement 1 9.2 etc ...
10/03/12 S.Durga Devi 47
Pseudo code consists of readable and formally-styled natural language used to explain specific tasks within a program's algorithm while an Algorithm is a set of instructions used to solve a particular problem. First produce a general algorithm (one can use pseudo code) Redefine the algorithm successively to get step by step detailed algorithm that is very close to a computer language.
10/03/12
S.Durga Devi
48
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.
10/03/12
S.Durga Devi
49
The Flowchart
A Flowchart
shows logic of an algorithm emphasizes individual steps and their interconnections Shows flow of execution of the algorithm. e.g. control flow from one action to the next
SYMBOL
oval parallelogram
PURPOSE
Beginning and ending of flow chart Input/output data Mathematical calculations, data transfer, logical operations Alternate path Transfer to another point in a flow chart or next page. Path of a logical flow in a program.
Rectangle
diamond circle
1. sum of the digits of a number. 2. nature of quadratic equations. 3. income tax problem. 4. standard deviation. 5. fibonacci sequence and golden ratio 6. towers of hanoi.