B01A – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-CBSE12A-2018-B01A #PYTHON#6088    siteicon   siteicon  

Problem Statement - B01A

Differentiate between Syntax Error and Run-Time Error? Also, write a suitable example in Python to illustrate both.

Solution

TC++ #6088

Syntax error : An error of language resulting from code that does not conform to
the syntax of the programming language.
Example

a = 0
while a < 10 # : is missing as per syntax
    a = a + 1
    print a

Runtime error : A runtime error is an error that causes abnormal termination of
program during running time..
Example

A=10
B= int(raw_input("Value:"))
print A/B
# If B entered by user is 0, it will be run-time error


Share

CSKC| Created: 9-Jan-2019 | Updated: 9-Jan-2019|CBSE12A-2018









Back