5. Name the type of error (syntax, runtime or logical error) in each case as given below:
a. Division by a variable that contains a value of zero.
b. Multiplication operator used when the operation should be division
c. Missing semicolon (;)
Answers
Answered by
15
Answer:
a- runtime error
b- logical error
c- syntax error
Answered by
2
a. A run time error occurs in dividing a variable by zero.
b. Using the multiplication operator to get division will produce a logical error.
c. If a semicolon is missed, it means the syntax is not proper. So there will be a syntax error.
Explanation:
- A syntax error occurs if the structure of the language is not followed in which you are writing the program.
- A logical error occurs if the wrong logic is implemented.
- And the error that occurs at run-time is called an exception. For example, when a value is divided by zero, it will raise an exception. Exception handling is used to handle run-time errors using try, catch, finally blocks.
Similar questions