Your SlideShare is downloading. ×
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Cp unit 1_2011
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Cp unit 1_2011

355

Published on

Download C programming Unit - 1

Download C programming Unit - 1

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
355
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 1.0 INTRODUCTIONWe know information processing, plays very important role in taking decisionevery moment. In this context, computers play a significant role in bulk ofinformation processing. Here in this unit, we study what is a computer andarchitecture of a computer and what are the different program developmentsteps.Computer is an electronic device used to store, retrieve and process data. Datais the unprocessed facts, figures and statistics. Process is the conversion of rawdata into useful information. To process data a finite and ordered set ofinstructions needed.Applications of computer  Computers in Business  Medicine and Healthcare  Education  Science  Engineering  Manufacturing  Government  Military  Entertainment1.1 COMPUTER ARCHITECTURE (BLOCK DIAGRAM)A computer system consists of hardware and software. Hardware refers to anyphysical, electrical, electromechnaical components of the computer. For examplekeyboard, mouse, cabinet of computer is considered as hardware. Softwarerefers to a program or set of instructions that is written to achieve a specifiedtask.The figure 1.1 illustrates the block diagram of a computer. It consists of threeparts: 1. Input Devices 2. Central Processing Unit 3. Output DevicesB.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 1
  • 2. Figure 1.1: Block diagram of a computer1.1.1 INPUT DEVICESThe input device is used to enter data and information into a computer. Thedevices like keyboard, mouse and scanner are commonly used as input devices.  A keyboard is used to enter alphanumeric characters and symbols.  The mouse is used to pick or select a command from the monitor screen.  A scanner is used to scan an image or read a barcode and so on.1.1.2 CENTRAL PROCESSING UNITIt is the brain of the computer, performs the bulk of the data processingoperations. Its main function is to execute programs stored in the main memoryby fetching the instructions, examining them and executing them. The programinstructions are processed one at a time along with the necessary data. Theresults are sent to memory and the next instruction is processed. This method isrepeated until the program is executed. CPU Consists of 3 functional units: ALU,CU and MU.B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 2
  • 3. Arithmetic and Logic unitThe arithmetic-logic unit (ALU) is the unit of the computer that performsarithmetic and logical operations on the data. This section of the machine can berelatively small consisting of circuits and registers which perform arithmetic (+, -,*, /) and logic (>,<,<=,>=,etc) operations.Arithmetic-logic units which can add and subtract and perform logical operationsform the backbone for the arithmetic and control operations in computers. Toperform scientific calculations the floating-point number system is used.Control unitThe control unit controls the overall activities of the components of the computer.It is mainly used to coordinate the activities among other units. It will sendcommands signals and controls the sequence of instructions to be executed.The control unit may be defined as “the parts that effect the retrieval ofinstructions in proper sequence and application of the proper signals to thearithmetic unit and the other parts”.Memory UnitThe memory unit holds data and instructions that are entered through the inputunit, before they are processed. It preserves the intermediate and final resultsbefore these are sent to the output devices. It also saves the data for the lateruse. The CPU memory is also called as memory register.1.1.3 OUTPUT DEVICESThe output device is used to display or print result from a computer. Monitor,printer and plotter are commonly used output devices.  A monitor is used to display the result in the form of text and graphics.  The printer is used to print the result.  A plotter is used to plot or print graphical result from a computer.  Note that a result displayed in a monitor is temporary and it disappears when the next result is displayed.  whereas the output printed using a printer or a plotter is permanent and these printouts can be used for any business correspondence or documentation.  Normally soft copy is referred to information that is stored on the storage device.  A hard copy refers to a print out showing the information.B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 3
  • 4. 1.2 COMPUTER SYSTEMSA computer system consists of hardware and software. Hardware refers to anyphysical, electrical, electromechnaical components of the computer. For examplekeyboard, mouse, cabinet of computer is considered as hardware. Softwarerefers to a program or set of instructions that is written to achieve a specifiedtask.1.2.1 COMPUTER HARDWAREThe hardware component of the computer system consists of: Input devices,Output devices and Processor discussed in 1.1. Memory will be discussed in 1.3.1.2.2 COMPUTER SOFTWARE  Software is a set of instructions that are used to carry out a task.  Software can be grouped into two categories namely application software and system software.  System software manages the computer resources. It provides the interface between the hardware and the users.  Application software, on the other hand, is directly responsible for helping users solving the problems. Figure: 1.2 Categories of SoftwareSystem SoftwareSystem software consists of programs that manage the hardware resources of acomputer and perform required information processing tasks.B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 4
  • 5. System software is divided in to three categories:  Operating System: consisting of programs and data, this runs on computers and manages the computer hardware. It keeps the system operating in an efficient manner while allowing the users access to the system.  System Support Software: provides system utilities and other operation services. Example disk format programs etc.,  System Development Software: includes the language translators that convert programs in to machine language for execution. Example compiler, assembler.Application SoftwareApplication Software is divided in to two categories: general-purpose softwareand application-specific software.  General-purpose software can be used for more than one application, is purchased from software development organizations. Examples include word processor, database management systems, c etc.,  Application-specific software can be used only for its intended purpose. Examples include library automations system etc.,1.3 MEMORY  Computer memory refers to the physical devices used to store data or programs (sequences of instructions) on a temporary or permanent basis for use in an electronic digital computer.  Computers represent information in binary code, written as sequences of 0s and 1s.  A bit is a binary digit, taking a value of either 0 or 1.  A byte is a collection of eight bits.There are two main types of memory, one is called volatile memory and other isnon-volatile memory.Volatile memory: The term volatile memory means that the information presentin these types of memory devices is deleted as soon as the power is switched off.Non-volatile memory: The term non volatile memory means that the informationpresent in these types of memory devices is not lost as soon as the power isswitched off.Categories of MemoryB.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 5
  • 6. Computer memory categorized into the following types 1. Primary memory 2. Secondary memory 3. Cache memory 4. Registers Figure 1.3 Categories of Memory1.3.1 PRIMARY MEMORYPrimary memory (main memory) is available in two forms: RAM and ROM.Random Access MemoryRandom Access Memory is a temporary storage medium in a computer. All datato be processed by the computer are transferred from a storage device orkeyboard to RAM during data processing. Results obtained from executing anyprogram are also stored in RAM. RAM is a volatile memory.Two main types of RAM are the Dynamic RAM and the Static RAM. The DynamicRAM is capacitance-based and cheap, while the Static RAM is switch-based andfast.RAM consists of many storage cells each of size 1 byte and is identified by usinga number called as address or memory location. The memory address isassigned by the computer which also varies from computer to computer and timeto time. The data stored in memory are identified using the memory address.ROM (Read Only Memory)B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 6
  • 7. Read Only Memory is a permanent storage medium which stores start upprograms. These programs which are loaded when computer is switched on.ROM stores essentially the BIOS (Basic Input Output System) programs whichare recorded by the manufacturer of the computer system. ROM is non-volatilememory.1.3.2 SECONDARY MEMORYSecondary Memory devices it is used to store data and program on a permanentbasis. Secondary Memories are non-volatile in nature. The secondary memorydevices are available in huge sizes. It is much slower in speed compared to theinternal or the primary memory devices. Examples hard disk, CD ROM, DVD etc.,1.3.3 CACHE MEMORYCache memory is a memory placed between CPU and main memory. It is fastercompared to the primary memory. Parts of the program or data that need to beaccessed repeatedly are stored in Cache memory.It is a volatile memory.Internal CacheIt is available internally within the CPU (like the CPU registers). Hence theinternal Cache is comparable to the registers in terms of speed but much largerin size compared to the registers.External CacheIt is available externally along with the CPU, ROM and RAM. These are fasterthan the RAM and the ROM.1.3.4 REGISTERSRegisters are small memory units internally available within the processor. It is avolatile memory.1.4 COMPUTING ENVIRONMENTB.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 7
  • 8. In the early days of computers, there was only one environment: the mainframecomputers hidden in a central computing department. With the advent ofpersonal computers, the environment changed, resulting in computers oneverywhere. In this section we will describe different environments.Personal Computing EnvironmentIn 1971, Marcian E. Hoff, working for Intel, combined the basic elements of thecentral processing unit into the microprocessor.If we are using a personal computer, all of the computer hardware componentsare tied together in our personal computer. In this situation, we have the wholecomputer for our self: we can do whatever we want. A typical personal computeris shown in Figure 1.4. Figure 1.4 Personal Computing EnvironmentTime-Sharing EnvironmentEmployees in large companies often work in what is known as a time-sharingenvironment. In the time-sharing environment, many users are connected to oneor more computers. These computers may be minicomputers or centralmainframes. The terminals they use are often nonprogrammable, although todaywe see more and more microcomputers being used to simulate terminals. Also,in the time-sharing environment, the output and auxiliary storage devices areshared by all users. . A typical personal computer is shown in Figure 1.5.B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 8
  • 9. Figure 1.5 Time-sharing EnvironmentIn the time–sharing environment, all computing must be done by the centralcomputer. In other words, the central computer has many duties: It must controlthe shared resources; it must manage the shared data and printing; and it mustdo the computing. All of this work tends to keep the computer busy. In fact, it issometimes so busy that the user becomes frustrated by the computer’s slowresponses.Client / Server EnvironmentA Client / Server computing environment splits the computing function between acentral computer and user’s computers. The users are given personal computersor workstations so that some of the computation responsibility can be movedfrom the central computer and assigned to the workstations.In the client/server environment, the user’s microcomputers or workstations arecalled the Client. The central computer, which may be a powerfulmicrocomputer, minicomputer, or central mainframe system, is known as theserver. Because the work is now shared between the users’ computers and thecentral computer, response time and monitor display are faster and the users aremore productive. Figure 1.6 shows a typical client/ server environment.B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 9
  • 10. Figure 1.6 The Client/Server EnvironmentDistributed ComputingA distributed computing environment provided a seamless integration ofcomputing functions between different servers and clients. The Internet providesconnectivity to different servers throughout the world. For example, eBay usesseveral computers to provide its auction service. This environment provides areliable, scalable, and highly available network. Figure 1.7 shows a distributedcomputing system. Figure 1.7 Distributed Computing System.B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 10
  • 11. 1.5 COMPUTER LANGUAGESComputer Programming is an art of making a computer to do the requiredoperations, by means of issuing sequence of commands to it.Categories of Computer Languages 1. Machine Language 2. Symbolic Languages 3. High-Level Languages1.5.1 MACHINE LANGUAGESMachine Language is the only language that is directly understood by thecomputer. It does not need any translator program. The instructions are calledmachine instruction (machine code) and it is written as strings of 1s (one) and 0’s(zero). When this sequence of codes is fed in to the computer, it recognizes thecode and converts it in to electrical signals.For example, a program instruction may look like this: 10110001101Machine language is considered to be the first generation language. Because ofit design, machine language is not an easy language to learn. It is also difficult todebug the program written in this language.Advantage  The program runs faster because no translation is needed. (It is already in machine understandable form)Disadvantages  It is very difficult to write programs in machine language. The programmer has to know details of hardware to write program  It is difficult to debug the program.1.5.2 SYMBOLIC LANGUAGEIn Symbolic language, set of mnemonics (symbolic keywords) are used torepresent machine codes. Mnemonics are usually combination of words likeADD, SUB and LOAD etc.B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 11
  • 12. AssemblerIn order to execute the programs written in symbolic language, a translatorprogram is required to translate it to the machine language. This translatorprogram is called Assembler. Later symbolic language known as Assemblylanguage. It is considered to be the second-generation language.Advantages:  The symbolic keywords are easier to code and saves time and effort  It is easier to correct errors and modify programming instructions  Assembly Language has utmost the same efficiency of execution as the machine level language, because there is one-to-one translation between assembly language program and its corresponding machine language program.Disadvantages:  Assembly languages are machine dependent. A program written for one computer might not run in other computer.1.5.3 HIGH LEVEL LANGUAGESHigh level languages are the simple languages that use English like instructionsand mathematical symbols like +, -, %, /, for its program construction. In highlevel languages, it is enough to know the logic and required instructions for agiven problem, irrespective of the type of computer used.CompilerCompiler is a translator program which converts a program in high level languagein to machine language.Examples of Higher level languages are: PASCAL, C, ALGOL etc..,Advantages  High level languages are easy to learn and use1.6 PROGRAM DEVELOPMENT STEPSProblem solving is a creative process. It is an act of defining a problem,determining the cause of the problem, identifying, prioritizing, and selectingalternatives for a solution and implementing a solution.B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 12
  • 13. A problem can be solved successfully only after making an effort to understandthe problem. To understand the problem, the following questions help  What do we know about the problem?  What is the information that we have to process in order the find the solution?  What does the solution look like?  What sort of special cases exist?  How can we recognize that we have found the solution?It is important to see if there are any similarities between the current problem andother problems that have already been solved. We have to be sure that the pastexperience does not hinder us in developing new methodology or technique forsolving a problem. The important aspect to be considered in problem-solving isthe ability to view a problem from a variety of angles.The various steps involved in Program Development are: 1. Defining or Analyzing the problem 2. Design (Algorithm, Flowchart) 3. Coding 4. Compiling and Running the Program 5. Testing and Debugging 6. Maintenance&Documenting the program1.6.1 DEFINING OR ANALYZING THE PROBLEMThe problem is defined by doing a preliminary investigation. Defining a problemhelps us to understand the problem clear. It is also known as Program Analysis.Tasks in defining a problem:  Specifying the input requirements  Specifying the output requirements  Specifying the processing requirementsSpecifying the input requirementsDetermine the inputs required and source of the data. The input specification isobtained by answering the following questions:  What specific values will be provided as input to the program?  What format will the values be?  For each input item, what is the valid range of values that it may assume?  What restrictions are placed on the use of these values?Specifying the output requirementsB.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 13
  • 14. Describe in detail the output that will be produced. The output specification isobtained by answering the following questions:  What values will be produced?  What is the format of these values?  What specific annotation, headings, or titles are required in the report?  What is the amount of output that will be produced?Specifying the Processing RequirementsDetermine the processing requirements for converting the input data to output.The processing requirement specification is obtained by answering the followingquestions:  What is the method (technique) required in producing the desired output?  What calculations are needed?  What are the validation checks that need to be applied to the input data?LOGICA method of human thought that involves thinking in a linear, step by stepmanner about how a problem can be solved.Logic is a language for reasoning. It is a collection of rules we use when doingreasoning.Importance of Logic in problem solvingFor solving a problem there may be multiple valid logics some may be simple andothers may be complexFor example: Determine whether a given number is prime or not?Logic 1: Divide the number by all the numbers from 2 to one less than thenumber and if for all the division operations, the reminder is non zero, the numberis prime otherwise it is not primeLogic 2: Same as logic1 but divide the number only from 2 to the number /2As a programmer our job is to find out appropriate logic to solve given problem.1.6.2 DESIGNB.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 14
  • 15. A design is the path from the problem to a solution in code. Program Design isboth a product and a process. The process results in a theoretical framework fordescribing the effects and consequences of a program as they are related to itsdevelopment and implementation.A well designed program is more likely to be:  Easier to read and understand later  Less of bugs and errors  Easier to extend to add new features  Easier to program in the first placeModular DesignOnce the problem is defined clearly, several design methodologies can beapplied. An important approach is Top-Down programming design. It is astructured design technique which breaks up the problem into a set of sub-problems called Modules and creates a hierarchical structure of modules.While applying top-down design to a given problem, consider the followingguidelines:  A problem is divided it into smaller logical sub-problems, called Modules  Each module should be independent and should have a single task to do  Each module can have only one entry point and one exit point, so that the logic flow of the program is easy to follow  When the program is executed, it must be able to move from one module to the next in sequence, until the last module is executed  Each module should be of manageable size, in order to make the design and testing easierAdvantages  Breaking up the problem into parts helps us to clarify what is to be done.  At each step of refinement, the new parts become more focused and, therefore, easier to design.  Modules may be reused.  Breaking the problem into parts allows more than one person to work on the solution simultaneously.Algorithm (Design technique)Finite set of steps to accomplish a task Step-by-step, simple, mechanicalprocedure to compute a function on every possible input.FlowchartB.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 15
  • 16. Flowchart is a diagrammatic representation of an algorithm. It uses differentsymbols to represent the sequence of operations, required to solve a problem.1.6.3 CODINGAn algorithm expressed in programming languages is called Program. Writing aprogram is called Coding. The logic that has been developed in the algorithm isused to write the program.1.6.4 COMPILING AND EXECUTING THE PROGRAMCompilation is a process of translating a source program into machineunderstandable form. The compiler is system software, which does thetranslation after examining each instruction for its correctness. The translationresults in the creation of object code.After compilation, Linking is done if necessary. Linking is the process of puttingtogether all the external references (other program files and functions) that arerequired by the program. The program is now ready for execution. Duringexecution, the executable object code is loaded into the computer’s memory andthe program instructions are executed.1.6.5 TESTING AND DEBUGGINGTestingTesting is the process of executing a program with the deliberate intent of findingerrors. Testing is needed to check whether the expected output matches theactual output. Program should be tested with all possible input data and controlconditions.Testing is done during every phase of program development. Initially,requirements can be tested for its correctness. Then, the design (algorithm, flowcharts) can be tested for its exactness and efficiency. Structured walk through ismade to verify the design.Programs are tested with several test criteria and the important ones are givenbelow:  Test whether each and every statement in the program is executed at least once (Basic path testing).  Test whether every branch in the program is traversed at least once (control flow).  Test whether the input data flows through the program and is converted to an output (data flow).DebuggingB.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 16
  • 17. Debugging is a process of correcting the errors. Programs may have logicalerrors which cannot be caught during compilation. Debugging is the process ofidentifying their root causes. One of the ways to ensure the correctness of theprogram is by printing out the intermediate results at strategic points ofcomputation.Some programmers use the terms “testing” and “debugging” interchangeably, butcareful programmers distinguish between the two activities. Testing meansdetecting errors. Debugging means diagnosing and correcting the root causes.On some programs, debugging occupies as much as 50 percent of the totaldevelopment time. For many programmers, debugging is the hardest part ofprogramming because of improper documentation.1.6.6 MAINTENANCE AND DOCUMENTING THE PROGRAMMaintenancePrograms require a continuing process of maintenance and modification to keeppace with changing requirements and implementation technologies.Maintainability and modifiability are essential characteristics of every program.Documenting the ProgramDocumentation explains how the program works and how to use the program.Documentation can be of great value, not only to those involved in maintaining ormodifying a program, but also to the programmers themselves. Details ofparticular programs, or particular pieces of programs, are easily forgotten orconfused without suitable documentation.1.7 ALGORITHMAn algorithm is a step-by-step description of the solution to a problem. It isdefined as an ordered sequence of well-defined and effective operations which,when carried out for a given set of initial conditions, produce output, andterminate in a finite time. The term “ordered sequence” specifies, after thecompletion of each step in the algorithm, the next step must be unambiguouslydefined.1.7.1 PROPERTIES OF AN ALGORITHM 1. Finiteness: Must terminate after a finite number of steps.B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 17
  • 18. 2. Definiteness: Action in each step to be carried out must be rigorously and unambiguously specified. 3. Input: Has zero or more inputs that are provided to it initially or dynamically. 4. Output: Has one or more outputs; quantities that have a specified relation to inputs. 5. Effectiveness: operations must all be sufficiently basic.1.7.2 CATEGORIES OF AN ALGORITHMAlgorithm is mainly divided in to three types. 1. Sequence: A series of steps that we perform one after the other. Steps carried out in given sequence 2. Selection: Making a choice from multiple available options. Next step depends on outcome of condition. 3. Iteration: Performing repetitive tasks. Partial sequence of steps executed repeatedly until condition reached.1.7.3 DEVELOPING ALGORITHMSAlgorithm development process is a trial-and-error process.Programmers make initial attempt to the solution and review it, to test itscorrectness. The errors identified leads to insertions, deletions, or modificationsto the existing algorithm.This refining continues until the programmer is satisfied that, the algorithm isessentially correct and ready to be executed.The more experience we gain in developing an algorithm, the closer our firstattempt will be to a correct solution and the less revision will be required.However, a novice programmer should not view developing algorithm as a single-step operation.1.6.4 EXAMPLESExample (sequence)B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 18
  • 19. 1. Write an algorithm to find the Area of a Circle. Aim: Algorithm to find the Area of a Circle Algorithm: BEGIN Step 1: Accept the RADIUS Step 2: Find the square of RADIUS and store it in SQUARE Step 3: Multiply SQUARE with 3.14 and store the result in AREA Step 4: Display AREA END2. Write an algorithm to add two numbers. Aim: algorithm to find the addition of two numbers. Algorithm BEGIN Step 1: Accept two numbers in A and B Step 2: C = A + B Step 3: Display C END Aim: algorithm to find whether student has passed or fail BEGINExample (selection) Marks1, Marks2, Marks3 Step 1: Accept Step 2: Total = Marks1 + Marks2 + Marks31. Write an 3: Average = Total /average marks of a student. Step algorithm to find the 3 Also check whether the student has passed or failed. (Average<35 Fail). Step 4: if Average < 35 then Display “Student Failed” else PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 19B.V.RAJESH, ASSISTANT Display “Student passed” end if END
  • 20. 2. Write an Algorithm to find whether a given year is a leap year or not. Aim: 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 END1.7 PSEUDO CODEPseudo code is an informal high-level description of an algorithm that uses thestructural conventions of programming languages, but omits language-specificsyntax. It is an outline of a program written in English or the users naturallanguage.1.8 FLOWCHARTA flowchart is a diagrammatic representation of computation. A flowchart is anorganized combination of shapes, lines and text that graphically illustrates aprocess or structure.B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 20
  • 21. Typical flowchart symbols are given below: Figure 1.8 Symbols used in flowchartExample (sequence) 1. Draw a flowchart to find the addition of two numbers.B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 21
  • 22. Star t Accept a, b C=a + b Display c End Figure: 1.9 Flowchart to find addition of two numbersExample (selection)1. Draw a Flowchart to find the whether a given year is a leap year or not. Star tB.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 22 if(year Accept year %4==0
  • 23. False True Display non Display leap leap year year End Figure: 1.10 Flowchart to find the given year is leap or not1.9 SYSTEM DEVELOPMENT (SDLC)Today’s large-scale projects are built using a series of interrelated phasescommonly referred to as the software development life cycle.Depending on the company and the type of the software being developed, thismodel consists of between five to seven steps. Figure 1.11 is one possiblevariation of the sdlc model.  Sdlc model starts with Requirement. In this phase, the analyst defines the requirements that specify what the proposed project is to accomplish, defines needed information, function, behavior, performance of the proposed project.  Design phase determines how the system will be built.  Coding can be done using any programming language consists of programs.  After coding we need to test the project. All the programs are tested together to make sure the system works as a whole.B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 23
  • 24.  Final phase, maintenance, keeps the project working once it has put into production. Figure: 1.11 Software Development Life Cycle APPENDIX OVERVIEW OF COMPUTERB.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 24
  • 25. Objective Questions 1. Computer systems is made up of [ ]B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 25
  • 26. a) Hardware b) Software c) Both a & b d) None of the above 2. Primary Memory is also called as [ ] a) Auxiliary Memory b) Secondary Storage c) Soft Copy d) Main memory 3. The terminal (start/stop) in the flow chart is indicated by [ ] a) Parallelogram b) Oval c) Rectangle d) Diamond 4. A well-defined, finite set of steps to solve a definite nature of the problem is called [ ] a) Algorithm b) Pseudo code c) Flowchart d) None of the above 5. Input/output in the flow chart is indicated by [ ] a) Parallelogram b) Oval c) Rectangle d) Diamond 6. Central Processing Unit of the computer system consists of [ ] a) Control Unit b) Arithmetic Logic Unit c) both a & b d) None of the above 7. Pseudo Code is [ ] a)English like statements b)Problem Solving tool c)Follow a loosely defined syntax d)All of the above 8. The process in the flow chart is [ ] a) Parallelogram b) Oval c) Rectangle d) Diamond 9. A pictorial representation of an algorithm is called [ ] a) Pseudo Code b) Program c) Operating System d) Flow ChartMatch the following: 10. RAM a Input Device [ ] 11. Plotter b) volatile [ ] 12. ROM c) Output Device [ ] 13. Key Board d) non-volatile [ ] ASSIGNMENT IB.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 26
  • 27. 1. Draw the architecture of a computer? Explain.2. What are the different program development steps? Explain each step in detail.3. What is an algorithm? What are the different properties and categories of an algorithm? Explain with an example.4. What is flowchart? What are the different symbols used to draw the flowchart. Explain with an example.5. Write an algorithm to find the nature of the roots of a quadratic equation.6. given the 3 sides of triangle a, b and c as input, Draw a flowchart to test whether it is isosceles, equilateral or not. It should also validate whether the input forms a triangle or not. (Ex. 10, 3, 3 is not a triangle)B.V.RAJESH, ASSISTANT PROFESSOR, DEPARTMENT OF IT, SNIST PAGE NO: 27

×