Full Transcript

CAP 172 PROGRAMMING METHODOLOGIES UNIT- I LECTURE - 2 We will discuss:  What is Program?  What is Computer Programming?  Generations of Computer Programming.  Algorithm Program A program is a set of instructions following the ru...

CAP 172 PROGRAMMING METHODOLOGIES UNIT- I LECTURE - 2 We will discuss:  What is Program?  What is Computer Programming?  Generations of Computer Programming.  Algorithm Program A program is a set of instructions following the rules of the chosen language. Without programs, computers are useless. A program is like a recipe. It contains a list of ingredients (called variables) and a list of directions (called statements) that tell the computer what to do with the variables. Contd.. Program is in human readable form need to convert into machine language so computer can understand the instruction. The conversion can be done using two ways: – Compile the program (Compiler) – Interpret the program(Interpreter) POLL Q. How many units we will cover/study before Mid Term Examinations? a)4 b)3 c)2 d)1 Computer Programming Computer programming is the process of writing, testing, debugging/troubleshooting, and maintaining the source code of computer programs. This source code is written in any programming language like C, C++, JAVA, Perl etc. Generations of Programming Language Contd.. First Generation Languages : These are low-level languages like machine language. Second Generation Languages : These are low-level assembly languages used in kernels and hardware drives. Third Generation Languages : These are high-level languages like C, C++, Java, Visual Basic and JavaScript. Contd.. Fourth Generation Languages : These are languages that consist of statements, similar to statements in the human language. These are used mainly in database programming and scripting. Example of these languages include – Perl – Python – Ruby – SQL – MATLAB (Matrix Laboratory) Contd.. Fifth Generation These are the Languages : programming languages that have visual tools to develop a program. Examples of fifth generation language include Mercury, and Prolog. NOTE: - The first two generations are called low level languages. The next three generations are called high level languages. POLL Q. How many computer programming generations we studied? a)1 b)2 c)3 d)4 e)5 Algorithm Programming is the process of taking an algorithm. Now question is what is an algorithm? Algorithm is defined as “ the finite set of steps, which provide a chain of action for solving a problem” It is step by step solution to given problem. Steps to create an Algorithm 1. Identify the Inputs What data do I need? How will I get the data? In what format will the data be? 2. Identify the Outputs What outputs do I need to return to the user? What format should the outputs take? Contd.. 3. Identify the Processes How can I manipulate data to produce meaningful results? Data vs. Information 4. Break the Solution to steps By breaking the solution to the steps we can easily understand the logic of program POLL Q. C programming language comes under which generation? a)5 b)4 c)3 d)2 e)1 Simple Example of an Algorithm To establish a telephone communication Step 1: Dial a phone number Step 2: Phone rings at the called party Step 3: Caller waits for the response Step 4: Called party picks up the phone Step 5: Conversation begins between them Step 6: After the conversation, both disconnect the call Algorithm: Example Problem: To add two numbers. Step1: Start. Step2: Take the two numbers. Step3: Add the two numbers. Step4: Print the result. Step5: Stop. POLL Q. Algorithm is defined as “ the ________set of steps, which provide a chain of action for solving a _______”. a)temporary, instruction b)actual, issue c)instruction, problem d)finite, problem

Use Quizgecko on...
Browser
Browser