Computer Applications
It is possible that the user may not be able to write an error-free program at one go. Due to this reason, debugging is significant. Debugging is used to eliminate errors from a program. Some of the examples describing the errors are given below:
(a) A number divided by zero.
(b) The user has applied multiplication sign, instead of division sign.
(c) Sum of p and q is to be divided by their difference using the statement p+q/p-q.
(d) While writing a Java statement, the user forgot to terminate the statement using semicolon.
Based on the above case, answer the following questions:
What is the type of error in (a)?
- Syntax Error
- Logical error
- Runtime error
- Execution error
What is the type of error in (b)?
- Logical error
- Syntax error
- Compiler error
- Execution error
What is the type of error in (c)?
- Logical error
- Syntax error
- Runtime error
- Execution error
What is the type of error in (d)?
- Syntax error
- Logical error
- Runtime error
- Compilation error
Input in Java
12 Likes
Answer
- Runtime error
- Logical error
- Logical error
- Syntax error
Answered By
8 Likes
Related Questions
Correct the errors of the given program:
class public { public static void main(String args{}) { int a=45,b=70,c=65.45; sum=a+b; diff=c-b; System.out.println(sum,diff); } }
class Simplify { public static void main(String args[]) { int a,b,c,d; a=10,b=5,c=1; c=2a+2b; d=(a+b)2; p=c/d; System.out.println(c , d , p); } }
Write the syntax of 'if' statement.
What is a compound statement? Give an example.