Make a brief list of the programming errors you have encount
Solution
Programming errors that are encountered are as below:
1. Syntax errors:
Let us take an example
-Java program has below line
System.out.println(\"Hello World);
error: unclosed string literal
This error can be detected at the time of compilation and it is called syntax error. The other common syntax errors encountered are as below.
; expected
extra parenthesis
Duplicate local variable
Missing return statement
2. Runtime errors:
Let us take an example of runtime error encountered
Let us say a program is written to check whether given numbers are even or odd. The user provides inputs and instead of number text is entered as below:
Enter all the numbers:
1
re
Exception in thread \"main\" java.util.InputMismatchException
This happens at the run-time.
If the program looks ok by syntax however when it is executed there are problems as above these are run-time errors. Other examples are
ArithmeticExceptionL e.g. Divide by Zero
StackOverflowException: e.g. in recursion, program has entered infinite loop
IndexOutOfBoundsException: e.g. Index accessing beyond the defined array
3. Logic Errors
If the program is to detect grades for students based on marks, and the if then else condition is not written correctly
e.g. whether 85 and above are grade A or 85 is to be excluded and only above 85 is A grade.
This can not be found in compilation or runtime and only when the program is executed, only if the input data is 85 the error will be found.
Test datasets are important to identify the logic errors.
Or another example is a supermarket is running a promotion for customer who purchased above certain amount in a week get a free movie passes for that week. If the program does not check the date of purchase correctly, people who purchased earlier might also get the free movie passes.
Running the promotion on the test server first will be useful.
These syntax, run-time and logical errors are encountered in programming.

