0% found this document useful (0 votes)
36 views12 pages

Random Types of Errors

The document discusses three types of errors in programming: compile time errors, run time errors, and logical errors. Compile time errors occur during compilation and include syntax and semantics errors. Run time errors occur during program execution and may cause the program to crash. Logical errors cause programs to produce incorrect results even though they compile and run.

Uploaded by

svajra2060
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views12 pages

Random Types of Errors

The document discusses three types of errors in programming: compile time errors, run time errors, and logical errors. Compile time errors occur during compilation and include syntax and semantics errors. Run time errors occur during program execution and may cause the program to crash. Logical errors cause programs to produce incorrect results even though they compile and run.

Uploaded by

svajra2060
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

TYPES OF ERRORS

ERRORS
• An error ,sometimes called ‘a bug’ is anything
in the code that prevents a program from
compiling and running correctly.
There are 3 types of errors
• Compile time errors
• Run time errors
• Logical errors
COMPILE TIME ERRORS:
• Errors that occur during compile-time are compile-time
errors.
• When a program compiles , its source code is checked for
whether it follows the programming language’s rules or
not.
i)Syntax errors: Syntax errors occur when rules of a
programming language are misused.
Example:
for i in range(6)
print(“hi’)
ii)Semantics Errors: Semantics Errors occur when
statements are not meaningful.
Semantics refers to the rules which give the
meaning of a statement.
Example:x+y=r
RUN TIME ERRORS
• Errors that occur during the execution of a program are run
time errors.
• These are harder to detect errors.
• Some run-time errors stop the execution of the program
which is then called program ”crashed” or “abnormally
terminated”.
• Most run-time errors are easy to identify because program
halts when it encounters them.
Example:
 infinite loop
 abnormally terminated
LOGICAL ERRORS
Sometimes ,even if you dont encounter any
error during compile-time and run-time ,
program does not provide the correct result.
(i) 10#40#70#
(ii) 30#40#50#
(iii) 50#60#70#
(iv) 40#50#70#
import random
text="CBSEONLINE"
count=random.randint(0,3)
c=9
while text[c]!='L':
print(text[c]+text[count]+"*",end="")
count=count+1
c=c-1
i)EC*NB*IS*
ii)NS*IE*LO*
iii)ES*NE*IO*
iv)EE*NO*IN
import random
high=4
guess=random.randint(0,high)+50
for c in range(guess,56):
print(c,end=“#”)
i)50#51#52#53#54#55#
ii)52#53#54#55
iii)53#54#
iv)49#50#51#52#53#54#55#
import random
AR=[20,30,40,50,60,70]
Lower =random.randint(1,3)
Upper =random.randint(2,4)
for K in range(Lower, Upper +1):
print (AR[K],end=”#“)

You might also like