Errors in programming.

Slides:



Advertisements
Similar presentations
Topics Introduction Types of Errors Exceptions Exception Handling
Advertisements

Programming Types of Testing.
Programming recap. Do you know these? LOW LEVEL 1 st generation: machine language (110011) 2 nd generation: assembly language (ADD, SUB) HIGH LEVEL 3.
Declaring and Using Variables Visual Basic Data Types.
Section 2.4: Errors. Common errors ● Mismatched parentheses ● Omitting space after operator or between numbers ● Putting operator between operands.
Introduction to a Programming Environment
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
C++ Crash Course Class 1 What is programming?. What’s this course about? Goal: Be able to design, write and run simple programs in C++ on a UNIX machine.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
UNIT 3 TEMPLATE AND EXCEPTION HANDLING. Introduction  Program errors are also referred to as program bugs.  A C program may have one or more of four.
Slides Credit Umair Javed LUMS Web Application Development.
Chapter 1.4 Programming languages Homework Due: Monday, August 11, 2014.
Programming Intro Problem Solving: 1)Understand the problem This often involves breaking the problem into manageable pieces 2) Develop a plan May develop.
COMPSCI 101 Principles of Programming Lecture 28 – Docstrings & Doctests.
FIRST JAVA PROGRAM. JAVA PROGRAMS Every program may consist of 1 or more classes. Syntax of a class: Each class can contain 1 or more methods. public.
Errors “Computer says no..”. Types of Errors Many different types of errors new ones are being invented every day by industrious programming students..
1 Original Source : and Problem and Problem Solving.ppt.
AP Computer Science edition Review 1 ArrayListsWhile loopsString MethodsMethodsErrors
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Introduction to Testing CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Debugging, Escape Command, More Math. It’s your birthday!  Write a program that asks the user for their name and their age.  Figure out what their birth.
School of Computer Science & Information Technology G6DICP - Lecture 6 Errors, bugs and debugging.
ERRORS. Types of errors: Syntax errors Logical errors.
Programming Errors. Errors of different types Syntax errors – easiest to fix, found by compiler or interpreter Semantic errors – logic errors, found by.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 6: Debugging in MATLAB Monday 15 Sept 2014 EGR 115 Introduction to Computing for Engineers.
PROGRAM ESSENTIALS. TOKENS  SMALLEST UNITS OF A PROGRAM LANGUAGE  Special Symbols  Mathematical Operators  Punctuation  Word Symbols  Key Words.
Java FilesOops - Mistake Java lingoSyntax
REVIEW No curveballs this time …. PROBLEM TYPE #1: EVALUATIONS.
5.01 Understand Different Types of Programming Errors
1 Exceptions. 2 Syntax Errors, Runtime Errors, and Logic Errors syntax errors, runtime errors, and logic errors You learned that there are three categories.
Lecture10 Exception Handling Jaeki Song. Introduction Categories of errors –Compilation error The rules of language have not been followed –Runtime error.
Principles of Programming CSEB134 : BS/ CHAPTER Fundamentals of the C Programming Language.
AP Computer Science A – Healdsburg High School 1 Unit 2 - Structure of a Java Program - Documentation - Types of Errors - Example.
 During the life of any system, there may be times when certain maintenance needs to take place.  There are different forms of maintenance and each.
COMPUTER PROGRAMMING I SUMMER Understand Different Types of Programming Errors.
JavaScript Variables Like other programming languages, JavaScript variables are a container that contains a value - a value that can be changed/fixed.
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
Harvard Mark I Howard Aiken was a pioneer in computing and a creator of conceptual design for IBM in the 1940s. He envisioned an electro-mechanical computing.
Debugger By: Engr. Faisal ur Rehman CE-105 Spring 2007.
Few More Math Operators
Fundamentals of Programming I Overview of Programming
5.01 Understand Different Types of Programming Errors
Topics Designing a Program Input, Processing, and Output
Jie(Jay) Wang Week1 Sept. 30
CS170 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
Testing and Debugging.
Java programming lecture one
Cracking the Coding Interview
5.01 Understand Different Types of Programming Errors
Building Java Programs Chapter 2
Review # 2 Math 8.
Numbers.
Detecting and Resolving Model Errors
Web Design & Development Lecture 7
Spot the bug!.
Programming Errors Key Revision Points.
Reading Input from the Keyboard
Error Analysis Runtime Errors.
Core Objects, Variables, Input, and Output
Introduction to Programming with Python
Variables In today’s lesson we will look at: what a variable is
Topics Designing a Program Input, Processing, and Output
An Introduction to Debugging
Topics Designing a Program Input, Processing, and Output
User Input Keyboard input.
Learning Intention I will learn about the different types of programming errors.
Lecture 14: Testing Testing used to verify object behavior through designed test suites Can test Classes – “unit” testing Object interactions – “integration”
WJEC GCSE Computer Science
CHAPTER 6 Testing and Debugging.
Presentation transcript:

Errors in programming

Types of Errors Compiler Errors: a.k.a. Syntax Errors Errors that prevent your program from running, occur as a result of bad syntax Most compiler errors are caused by mistakes that you make when typing code. E.g. Forgetting your colon when assigning a value (:=) For example, you might misspell a keyword, leave out some necessary punctuation, or try to use an if statement without the then keyword. E.g. var testVariable : bolean

Compiler Errors ERRORS var phoneNumber : real var age : int phneNumber = 4165551234 if (age GreaterThan 18) puts phoneNumber

Types of Errors Runtime Errors occur while your program runs, usually when your program attempts an operation that is impossible to carry out. E.g. Division by zero E.g. Trying to convert “bob” to an int

Runtime Errors ERRORS var speed : real var km : int var hours : int km := 68 hours := 0 speed := km / hours put “Your speed is “ , speed , “kph”

Types of Errors Logic Errors Errors that prevent your program from doing what you intend it to do, producing an unexpected result. E.g. adding when you meant to subtract These errors are the hardest to find and fix because you do not necessarily know what is the cause of the problem

Logic Errors var firstName : string var lastName : string var fullName : string lastName := “Simpson” fullName := firstName + “ “ + lastName put “Your full name is “ + fullName firstName has no value yet...

Practice: On the moodle is a zip file named broken.t Download (to USB), fix this code Use 93, 74, 84 as test numbers Your output should look like this EXACTLY