Errors
Amit Singh
Class :11-A
Types Of
Errors
Syntax Error
Run Time Error
Logical Error
Common
Syntax Error
Leaving out a keywords
Putting a keyword in the wrong place
Leaving out a symbol, such as a
Coln ,Comma or Brackets
Misspelling a keywords
Incorrect indentation
Example
WRONG CORRECT
Run Time
Errors
A program does not mean that
you will get the desired results.
Error may be detected at Run-
Time . So it called as Run-Time
Error. It is caused by wrong
operation take place.
Common Run
Time Errors
Divide by zero
Using an identifier which has not
been defined
Accessing a List element,
Dictionary value or object which
does not exist
Example
Logical Error
The program does not give any error
but still gives an incorrect output it is
due to logical error. These errors
occur due to mistakes of the
programmer
The Logical Error is
the difficult to find
Common
Logical Error
Using the wrong variable
name
Making a mistake in a
Boolean expression
Getting wrong operator
Example
WRONG Correct
Some Common
Errors
Index Error :- Raised when index of a sequence
is out of range.
Key Error :- Raised when the specified key is
not found in the dictionary.
Value Error :- Raised when a function get
argument of correct type but improper value.
ZeroDivision Error :- Raised when division by
zero takes place for all numeric value.
Type Error :- Raised when a function or
operation is applied to an object of incorrect
type.
Practice Of
Questions
Q1:- Errors are called as ?
(a) Bugs
(b) Defects
(c) Both (a) and (b)
(d) None of these
Correct Answer
(c) Both(a) and (b)
Q2
Q2 :- Which of the following is/are syntax error ?
(a) Leaving out a keyword
(b) Misspelling a keyword
(c) Incorrect Indentation
(d) All of the above
Correct Answer
(d) All of the above
Q3 :- What type of errors can be
detected by a compiler ?
Answer :- Syntax Error.
Q4 :- What is Run Time Errors ?
Answer :- Error which occur during
the execution of the program is
known as run–time error.