A program is a set of instruction return in a computer language, to perform a specific task, In an attempt to solve problems on a computer, one has to write a step by step solution using simple instruction for operation and thus, obtain the result. These Step are as follows :
Input -> Store -> Processing -> Output
a. Formulating the problem and deciding the data types to be inputted.
b. Identifying the step of computation that are necessary for getting the solution.
c. Identifying decision points. under what operation is to be performed and when not to be performed.
d. Knowing the expected result and verifying with the actual values
Problem solving is the process involving basic sequential steps necessary to arrive the solution of the given problem.
The six basic steps , insolving a problem are as follows.
1. Understanding the problem
Read each statement given in the problem carefully so that you can answer the first question- what is expected by solving the problem.
Example : Accept a value M and find out the sum of the first M even integers.
2. Construction of the list of variables
In this step you thinking advance the number of variables required in the name of the variable before drawing the flow chart.
M - To be inputted by the keyboard.
I - To generate even integers. ( 2, 4, 6 )
COUNT - To count the number of even integers generates (1, 2, 3)
SUM - To obtain the sum of even integers (2 + 4 + 6).
3. Output Design
Obtain the output format is specify the problem itself. output format should have Attractive, Easy to read, Self explanatory (simplicity).
4. Program development
You should now draw a flow chart for the procedure that you have just made in steps 1, 2 and 3.
5. Testing the Program
You should dry run the program develop in step 4. A dry run is the process of a programmer manually working through their code to trace the value of variables.
6. Validating the Data
It is quite likely that the user of your program may enter values that are not expected by the program. Such values should be rejected by the procedure created by you.
A set of instructions which describe the steps to be followed to carry out an activity is called an algorithm or procedure for solving a problem.
Algorithm is a step wise presentation of program in simple English.
Characteristics of algorithm
a. Language independent .
b. Simple , complete , step by step program flow.
c. No standard format or syntax required.
d. Helpful to understand problem and plan out solution.
Example: Find the greatest number among two number ?
1 : Accept M value 5
2 : Accept N value 8
3 : Compare m and n
4 : M > N
5 : M is greatest number.
A flowchart is a graphical or symbolic representation of a process.
Each step in the process is represented by different symbol and contains a short description of the process step.
The flow chart symbol is link together with arrows showing the flow of the process.
How do you draw a flowchart to sum of two numbers?
1: There should be only one entry (starting point) and one exit point of the flowchart.
2: Use the correct symbol at each stage in the flowchart.
3: The logical flow should be clear shown using arrows.
4: Lines should be ideally being vertical or horizontal.
Convey better meaning
Since a flow chart is a pictorial representation of the solution of a problem
Effective joining of parts of a system
Flowchart can be used as working models in the design of new programs and software systems.
Efficient coding
Once a flow chart is correctly drawn, programmers find it very easy write the concerned program because the flowchart acts as a roadmap for them.
Systematic Debugging
Even after taking full care in a program design, some errors may remain in the program because the designer might never have thought about a particular case. These errors are detected only when you start executing the program on a computer.
Systematic Testing
Testing is the process of confirming if a program with successfully do all the jobs for which it has been designed under the specified constraints.
Paragraph
Take more time to draw.
Difficult to make changes.
Non - Standardization
Pseudocode is a set of statements written in a human readable language, expressing the processing logic of a program.
General rules used for writing pseudocodes are as follows.
Imperative sentence
The Imperative sentences are used to show actions. Add x to sum, Display result, Sort List, Calculate, etc.
Operators
Mostly arithmetic operators: +,-,*, /,% and Relational operators: =,>, <,>=,>=,!= used.
Decision
IF , THEN , ELSE , CASE , ENDCASE are used for decision making .
Looping
The looping or repetition of statements is shown by FOR , WHILE .
Example: Print can candidate vote are not
IF age >= 18
THEN Display Result (“You can vote”)
ELSE
Display Result (“ You cannot vote”)
Example: Display selected for national scholarship examination.
FOR roll1 to roll100
Display Roll ,Name ,Address
ENDFOR
Language is a medium to communicate others and express your thought.
A Computer can only do what a program can make it do.
To perform a particular task, the programmer writes a sequence of instructions called program.
A set of programs written to perform a specific task in a computer is called software.
The set of instructions code in binary or in decimal notation, which can be directly understood by the computer without the help of a translator, is called a machine/low-level language program.
Machine code is a fundamental language of a computer and is normally written in 0 and 1.
An instructions prepared any machine language has a two part format that called Instruction format
OPE CODE ( Operation Code )
The first part is the command or operation, and it tells the computer what function to perform.
OPERAND ( Address or location )
The second part of the instructions is the OPERAND and it tells the computer where to find and store the data and other instructions that are to be manipulated.
a. Machine dependent
b. Difficult to program
c. Errorprone
d. Difficult to modify
e. Very fast
Programs can easily be written in alphanumeric symbols instead of 0's and 1's. Meaningful and easily rememberable symbols are selected for this purpose.
ADD for Addition, SUB for Substraction, MUL for Multification, DIV for Devision and CMP for compression etc.
Such symbols are known as mnemonics.
Advantage of assembly Language
Low-Level Control: Direct manipulation of hardware for precise control.
Efficiency: Optimized for speed and memory usage.
Direct Access to Hardware: Enables interfacing with system components.
Optimization: Fine-tuning for specific hardware architectures.
Disadvantage of assembly Language
Programming is difficult and time consuming.
Assembly language is machine dependent.
The program written in assembly language for one computer can not we using any other computer.
High-level languages are programming languages that are designed to be more user-friendly and abstracted from the hardware, making it easier for programmers to write code. The instruction written in a high level language is called statement. The statement more closely resembles English and mathematics. Example C , C++ , JAVA ,C# , JavaScript , Python , Visual Basic , Delphi , Perl , Ruby , PHP etc.
Advantage of high Level Language
a. Machine independent
b. Easy to learn use
c. Few errors
d. Lower program preparation cost
e. Better documentation
f. Easier to maintain
Disadvantage of high level language
a. Lower efficiency
b. Lack of flexibility
Source code
The language in which programmer writes programs is called source language and code is called source code.
Object code
The language in which the computer work is called object language or machine language. Machine codes are also known as object code.
A compiler is a software program that translates source code written in a high-level programming language into machine code or bytecode that can be executed by a computer. It checks all kind of limits, range, and error in compile time. The compilation process consist of two step
1. Analysis phase
The analysis phase consist of the following task 1. Lexical analysis 2. Syntax analysis, 3. Semantic analysis.
2. Synthesis phase
The synthesis phase refers to the synthesis of the object program. It generates code and does optimization. It generates object code.
Basic flow of Compilation
Program (source code) => Binary => Execution
Source code is converted in to binary from using some special software known as translator and computer execute the code.
An interpreter is a program that translates statements of a high-level language program into machine code line by line. Interpreter unlike compiler does not generate any intermediate code. It directly execute program statement line by line. The Python supports interpreter so programme are executed directly.
Assembler is a translator that uses to translate assembly language program in to machine language.
Interpreter
High level to low level. interpreter show error line by line . Small program ,slow less memory . Interpreter is not created and intermediate code.
Compiler
High level to low level. Compiler show list of error along with align number at the end of program execution. Compiler is big program, faster, compiler needs more memory, and compiler creates object code.
Usually a longer program in to a number of smaller sub program called module. A linker is a program that links smaller program to form a single program.
The loader is a program that loads machine codes of a program into a system memory. A locater is a program that assign specific memory address to each machine code if a program which is to be loaded in to system program.
Even after taking full care in program design some errors may remain in the program as the program designer might never have thought about a particular case. These errors are detected only when you start executing the program on a computer. Such type program error are called bugs, and the process of removing these errors is known as debugging.
There are three type of error that in a computer program.
1. Syntax Errors
Syntax errors occur in the programs when the rules or syntax of the programming language is not followed.
2. Run-time Errors
Run-time error occurs when a program is executed on the computer, but the desired results are not achieved due to some misinterpretation (mistake) of a particular instruction. Runtime error is an error that causes abnormal termination of program during execution of a code.
3. Logical Errors
Logical errors are the error that occur in a planning the program logic. A logical error is a mistake in a program source code that results an incorrect or unexpected behaviour.
Testing
a. Testing is the process in which a program is validated.
b. Testing is complete when all desired verification in terms of specifications has been performed.
c. Testing can and should be planed.
d. Testing can begin in the early stage of the development effort.
Debugging
a. Debugging is the process in which program error are remove.
b. Debugging is a process that ends only temporarily as subsequent execution of a program may uncover other errors, thereby restarting the debugging process.
c. Debugging is a reactive procedure which steam form testing.
d. Debugging cannot begin until the end of the development cycle.
Documentation of a software system involves collecting, organizing, storing and maintaining a complete historical record of programs and other documents use of prepared during different phases of the system development.
User Documentation
It provides the information that one needs in order to use a program. This information includes a number of different items. These items are as follows:
1. A description of application area of the program will do.
2. Description of the input data that the program required.
3. A description of the output processed by the program.
4. A description of the command needed to start the program.
5. A description of the kind of instruction that is possible with the program.
Technical Documentation
This kind of documentation is address to programs to might get the task of modifying program at some times.
Program maintenance covers a wide range of activities, including correcting coding and design errors, updating documentation and test data, and upgrading user's support.