SlideShare uma empresa Scribd logo
1 de 18
DIFFERENT TYPES OF ERRORS
Compilation errors
• Error occurs when the compiler finds something in the source
code that it can’t compile.
• A misspelling, typographical error, or any of a dozen other
things can cause the compiler to choke.
• Hello.c:Error:’;’ expected
Linker error messages
• Relatively rare and usually result from misspelling the name of
a C library function.
• Error: undefined symbols: error message, followed by the
misspelled name (preceded by an underscore).
• Once you correct the spelling, the problem should go away.
Execution error
 Errors occur during the program execution, after a successful
compilation.
 Common execution errors are a numerical overflow or
underflow (exceeding the largest or smallest permissible
number that can be stored in the computer), division by zero,
attempting to compute the logarithm or the square root of a
negative number, etc.
 These diagnostics are sometimes called execution messages
or run-time messages.
 Logical Error
• Error done by programmer by giving different logical mistakes.
Logical error is not detected by the compiler.
• Syntax will be correct but the output of the program will be
different than that of expected output.
ASSEMBLERS, COMPILERS AND INTERPRETERS
 The assemblers, compilers, or interpreters are the software
that converts HLL to LLL.
 ASSEMBLER
 Language which substitutes letters and symbols for the
numbers in the machine language program is called an
assembly language or symbolic language.
 Program written in symbolic language that uses symbols
instead of numbers is called an assembly code or a symbolic
program.
 Translator program that translates an assembly code into the
computer’s machine code is called an assembler.
 ASSEMBLER
 Assembler is a system program which is supplied by the
computer manufacturer.
 Because in addition to translating the assembly code to
machine code, it also assembles the machine code in the
main memory of the computer and makes it ready for
execution.
 Symbolic program written by program in assembly language is
called a source program.
 After the source program has been converted into machine
language by an assembler, it is referred to as an object
program.
 Assembler translates each assembly language instructions into an
equivalent machine language instruction, there is a one-to-one
correspondence between the assembly instructions of the source
program and the machine instructions of object program.
 COMPILER
 Translating program that translates the instruction of a high level
language into machine language.
 Compiler translated the whole program at once and this process is
called compilation.
 Compiler can translate only those source programs which have
been written in the language for which the computer is meant.
 Compilers are large programs which reside permanently on
secondary storage.
 When the translation of a program is to be done, they are
copied into the main memory of the computer.
 Compiler analyses each statement in the source program and
generates a sequence of machine instructions, when
executed, will precisely carry out the computation specified in
the statement.
 As the compiler analyses each statement, it may detects
certain types of errors, which are called compile time errors.
 A source program containing an error diagnosed by the
compiler will not be compiled into an object program.
 Compiler will print out a suitable message along with a list of
coded error messages which indicate the type of errors.
 Compiler, however, can not diagnose logical errors. It can only
diagnose syntax errors in a program.
INTERPRETER
 An interpreter is another type of translator used for
translating high level languages into machine code.
 Takes the statement of a high level language and translates it
into a machine instruction which is immediately executed.
 During programming, programmer can not proceed to next
line till the current line is error free.
 Advantage of an interpreter over a compiler is fast response
to changes in the source program.
 It is a time consuming translation method because each
statement must be translated every time it is executed from
the source program.
 Compiled machine language program runs much faster than
an interpreted program.
ALGORITHMS
 Algorithm is a verbal or says written form of the program. It can
also be defined as ordered description of instructions to be carried
out in order to solve the given task.
 For example:
• Program: preparing tea
• Start
• Fetch water and tea leaves along with sugar and milk
• Boil the water
• Put tea leaves and sugar in boiled water
• Mix with milk
• Server the tea
• Stop
Basic guidelines for writing Algorithms
 Use plain language.
 Do not use any language specific syntax. Same algorithm
should hold true for any programming language.
 Do not make any assumptions. Describe everything clearly
and explicitly.
 Ensure that the algorithm has single entry and exit point.
Important features of Algorithm
 1. Finiteness: Every algorithm should lead to a session of
task that terminates after a finite number of steps.
 2. Definiteness: Each step must be precisely defined. Actions
should be unambiguously specified for each case.
 3. Inputs: Any algorithm can have zero or more inputs. Inputs
may be given initially or as the algorithm runs.
 4. Outputs: Any algorithm may result in one or more outputs.
Quantities that have specified relation to inputs.
 5. Effectiveness: All operations must be sufficiently basic so
as to be implemented with even paper and pencil.
For example: A procedure to pick the largest tender from a set of tenders
Step 1: Read the first tender and note down its value as the maximum
tender value so far encountered. Note down the tender
identification number.
Step 2: As long as tenders are not exhausted do steps 3 and 4. go to
step 5 when tenders are exhausted.
Step 3: Read the next tender and compare the tender with the current
maximum tender value.
Step 4: If this tender value is greater than that previously noted down
as maximum tender then erase the previous maximum value noted
and replace it by this new value. Replace the previously noted
tender identification number of this identification number. Else do
not do anything.
Step 5: Print the final value of maximum tender and its identification
noted down in step 4.
FLOWCHART
 Diagrammatic representation of algorithm.
 Flowchart represents the actual flow of program during
program execution.
 It is very helpful for debugging or tracing the flow of the
program.
 Flowchart is drawn using basic blocks, each having special
meaning.
 Basic blocks used for drawing flowcharts.
Structure / Purpose
Start/ Stop Processing
Decision
making
Input/ output
Conne
ctor

Mais conteúdo relacionado

Mais procurados

Converter - Computer Science & Engg. By Prof.(Dr.) Anand K. Tripathi
Converter - Computer Science & Engg. By Prof.(Dr.) Anand K. Tripathi  Converter - Computer Science & Engg. By Prof.(Dr.) Anand K. Tripathi
Converter - Computer Science & Engg. By Prof.(Dr.) Anand K. Tripathi
Prof. (Dr.) Anand K. Tripathi
 
SDD Translation
SDD  TranslationSDD  Translation
SDD Translation
gavhays
 

Mais procurados (20)

Language translator
Language translatorLanguage translator
Language translator
 
Using Pseudocode Statements and Flowchart Symbols
Using Pseudocode Statements and Flowchart SymbolsUsing Pseudocode Statements and Flowchart Symbols
Using Pseudocode Statements and Flowchart Symbols
 
Understanding Computer Systems
Understanding Computer SystemsUnderstanding Computer Systems
Understanding Computer Systems
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
 
Understanding Simple Program Logic
Understanding Simple Program LogicUnderstanding Simple Program Logic
Understanding Simple Program Logic
 
Language Translator ( Compiler)
Language Translator ( Compiler)Language Translator ( Compiler)
Language Translator ( Compiler)
 
Converter - Computer Science & Engg. By Prof.(Dr.) Anand K. Tripathi
Converter - Computer Science & Engg. By Prof.(Dr.) Anand K. Tripathi  Converter - Computer Science & Engg. By Prof.(Dr.) Anand K. Tripathi
Converter - Computer Science & Engg. By Prof.(Dr.) Anand K. Tripathi
 
notes on Programming fundamentals
notes on Programming fundamentals notes on Programming fundamentals
notes on Programming fundamentals
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONS
 
Introduction to programming by MUFIX Commnity
Introduction to programming by MUFIX CommnityIntroduction to programming by MUFIX Commnity
Introduction to programming by MUFIX Commnity
 
Introduction to compiler interpreter
Introduction to compiler interpreterIntroduction to compiler interpreter
Introduction to compiler interpreter
 
CPP03 - Repetition
CPP03 - RepetitionCPP03 - Repetition
CPP03 - Repetition
 
Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.
 
compiler and their types
compiler and their typescompiler and their types
compiler and their types
 
Compiler design tutorial
Compiler design tutorialCompiler design tutorial
Compiler design tutorial
 
SDD Translation
SDD  TranslationSDD  Translation
SDD Translation
 
Translators(compiler assembler interpretor).
Translators(compiler assembler interpretor).Translators(compiler assembler interpretor).
Translators(compiler assembler interpretor).
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Chapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfChapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdf
 
Presentation
PresentationPresentation
Presentation
 

Semelhante a Unit 3.1 Algorithm and Flowchart

Computer assignment for grade 9
Computer assignment for grade  9Computer assignment for grade  9
Computer assignment for grade 9
nahomyitbarek
 
Language processing system.pdf
Language processing system.pdfLanguage processing system.pdf
Language processing system.pdf
RakibRahman19
 
L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
MMRF2
 

Semelhante a Unit 3.1 Algorithm and Flowchart (20)

C programming
C programmingC programming
C programming
 
Introduction to programming language (basic)
Introduction to programming language (basic)Introduction to programming language (basic)
Introduction to programming language (basic)
 
Compiler an overview
Compiler  an overviewCompiler  an overview
Compiler an overview
 
Compiler vs interpreter
Compiler vs interpreter Compiler vs interpreter
Compiler vs interpreter
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptx
 
Computer assignment for grade 9
Computer assignment for grade  9Computer assignment for grade  9
Computer assignment for grade 9
 
PCSG_Computer_Science_Unit_1_Lecture_2.pptx
PCSG_Computer_Science_Unit_1_Lecture_2.pptxPCSG_Computer_Science_Unit_1_Lecture_2.pptx
PCSG_Computer_Science_Unit_1_Lecture_2.pptx
 
compilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdfcompilervsinterpreter-161008074915.pdf
compilervsinterpreter-161008074915.pdf
 
unit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfunit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdf
 
Pros and cons of c as a compiler language
  Pros and cons of c as a compiler language  Pros and cons of c as a compiler language
Pros and cons of c as a compiler language
 
Introduction to Computers Lecture # 12
Introduction to Computers Lecture # 12Introduction to Computers Lecture # 12
Introduction to Computers Lecture # 12
 
Language processing system.pdf
Language processing system.pdfLanguage processing system.pdf
Language processing system.pdf
 
Compiler Design Introduction
Compiler Design Introduction Compiler Design Introduction
Compiler Design Introduction
 
L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
 
Programming Languages / Translators
Programming Languages / TranslatorsProgramming Languages / Translators
Programming Languages / Translators
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
 
Basic syntax : Algorithm,Flow chart
Basic syntax : Algorithm,Flow chartBasic syntax : Algorithm,Flow chart
Basic syntax : Algorithm,Flow chart
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Programming in C
Programming in CProgramming in C
Programming in C
 
Ppt 1
Ppt 1Ppt 1
Ppt 1
 

Último

Último (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Unit 3.1 Algorithm and Flowchart

  • 2. Compilation errors • Error occurs when the compiler finds something in the source code that it can’t compile. • A misspelling, typographical error, or any of a dozen other things can cause the compiler to choke. • Hello.c:Error:’;’ expected
  • 3. Linker error messages • Relatively rare and usually result from misspelling the name of a C library function. • Error: undefined symbols: error message, followed by the misspelled name (preceded by an underscore). • Once you correct the spelling, the problem should go away.
  • 4. Execution error  Errors occur during the program execution, after a successful compilation.  Common execution errors are a numerical overflow or underflow (exceeding the largest or smallest permissible number that can be stored in the computer), division by zero, attempting to compute the logarithm or the square root of a negative number, etc.  These diagnostics are sometimes called execution messages or run-time messages.
  • 5.  Logical Error • Error done by programmer by giving different logical mistakes. Logical error is not detected by the compiler. • Syntax will be correct but the output of the program will be different than that of expected output.
  • 6. ASSEMBLERS, COMPILERS AND INTERPRETERS  The assemblers, compilers, or interpreters are the software that converts HLL to LLL.  ASSEMBLER  Language which substitutes letters and symbols for the numbers in the machine language program is called an assembly language or symbolic language.  Program written in symbolic language that uses symbols instead of numbers is called an assembly code or a symbolic program.  Translator program that translates an assembly code into the computer’s machine code is called an assembler.
  • 7.  ASSEMBLER  Assembler is a system program which is supplied by the computer manufacturer.  Because in addition to translating the assembly code to machine code, it also assembles the machine code in the main memory of the computer and makes it ready for execution.  Symbolic program written by program in assembly language is called a source program.  After the source program has been converted into machine language by an assembler, it is referred to as an object program.
  • 8.  Assembler translates each assembly language instructions into an equivalent machine language instruction, there is a one-to-one correspondence between the assembly instructions of the source program and the machine instructions of object program.  COMPILER  Translating program that translates the instruction of a high level language into machine language.  Compiler translated the whole program at once and this process is called compilation.  Compiler can translate only those source programs which have been written in the language for which the computer is meant.
  • 9.  Compilers are large programs which reside permanently on secondary storage.  When the translation of a program is to be done, they are copied into the main memory of the computer.  Compiler analyses each statement in the source program and generates a sequence of machine instructions, when executed, will precisely carry out the computation specified in the statement.  As the compiler analyses each statement, it may detects certain types of errors, which are called compile time errors.
  • 10.  A source program containing an error diagnosed by the compiler will not be compiled into an object program.  Compiler will print out a suitable message along with a list of coded error messages which indicate the type of errors.  Compiler, however, can not diagnose logical errors. It can only diagnose syntax errors in a program.
  • 11. INTERPRETER  An interpreter is another type of translator used for translating high level languages into machine code.  Takes the statement of a high level language and translates it into a machine instruction which is immediately executed.  During programming, programmer can not proceed to next line till the current line is error free.  Advantage of an interpreter over a compiler is fast response to changes in the source program.  It is a time consuming translation method because each statement must be translated every time it is executed from the source program.
  • 12.  Compiled machine language program runs much faster than an interpreted program.
  • 13. ALGORITHMS  Algorithm is a verbal or says written form of the program. It can also be defined as ordered description of instructions to be carried out in order to solve the given task.  For example: • Program: preparing tea • Start • Fetch water and tea leaves along with sugar and milk • Boil the water • Put tea leaves and sugar in boiled water • Mix with milk • Server the tea • Stop
  • 14. Basic guidelines for writing Algorithms  Use plain language.  Do not use any language specific syntax. Same algorithm should hold true for any programming language.  Do not make any assumptions. Describe everything clearly and explicitly.  Ensure that the algorithm has single entry and exit point.
  • 15. Important features of Algorithm  1. Finiteness: Every algorithm should lead to a session of task that terminates after a finite number of steps.  2. Definiteness: Each step must be precisely defined. Actions should be unambiguously specified for each case.  3. Inputs: Any algorithm can have zero or more inputs. Inputs may be given initially or as the algorithm runs.  4. Outputs: Any algorithm may result in one or more outputs. Quantities that have specified relation to inputs.  5. Effectiveness: All operations must be sufficiently basic so as to be implemented with even paper and pencil.
  • 16. For example: A procedure to pick the largest tender from a set of tenders Step 1: Read the first tender and note down its value as the maximum tender value so far encountered. Note down the tender identification number. Step 2: As long as tenders are not exhausted do steps 3 and 4. go to step 5 when tenders are exhausted. Step 3: Read the next tender and compare the tender with the current maximum tender value. Step 4: If this tender value is greater than that previously noted down as maximum tender then erase the previous maximum value noted and replace it by this new value. Replace the previously noted tender identification number of this identification number. Else do not do anything. Step 5: Print the final value of maximum tender and its identification noted down in step 4.
  • 17. FLOWCHART  Diagrammatic representation of algorithm.  Flowchart represents the actual flow of program during program execution.  It is very helpful for debugging or tracing the flow of the program.  Flowchart is drawn using basic blocks, each having special meaning.  Basic blocks used for drawing flowcharts.
  • 18. Structure / Purpose Start/ Stop Processing Decision making Input/ output Conne ctor