Question

In: Computer Science

How many types of errors can occur during the execution of a program? Discuss the circumstance...

How many types of errors can occur during the execution of a program? Discuss the circumstance when these types of errors can occur. Support your argument with examples.

Solutions

Expert Solution

Types of Errors

Errors are a type of mistake in a program that is, errors are found by the compiler when there is something went wrong or the program shows something unexpectedly. Errors(bugs) are of mainly 3 types.

They are,

1. Syntax error

2. Logical error

3. Runtime error

​​​​​1)Syntax error

Based on C programming, the compiler will found this type of errors only when the compiler try to compile the program. Mainly this is occur due to the violation of spelling or grammer followed by the language. That is the statement,

printf("Welcome to programming")

Actually the above statement must end with a semicolon. That is one of the rule followed by C language.

But here, the semicolon is missed, so there will occur an error while compiling the program.

As the same, when some times we forget to declare a variable that is used in in the program, and also missing some punctuations followed by the language there should have occur syntax error.

Example

2)Logical error

The main problem of this error is that, sometimes we cannot find this types of Errors easily. Because this is occurs due to the logical mistake applied by the programmer. To fix this error we should have to cross check our program. It doesn't shows any error messages like syntax error. If occuring something like that, we have to find the mistake and correct it quickly. But in this case it is not possible to find the error in this way. As a result of this error, we will get incorrect output. For an example, we are declaring three varibles a,b and c in our program, and calculating b=a+b; instead of c= a+b;

If we try to print the result in c variable, we will never get the correct answer. So logical error is occurs due to the carelessness logic applied by the programmer.

3) Runtime Error

If the program is free from syntax error, then it will compiled successfully by the compiler. After that it will end and exit from the output solution unexpectedly. So we have to check or think about the chance of Errors that will occur at runtime. Such type of error leads the process termination.

For example, if we are performing a division operation, and it compiled successfully, then enter the first number as 10 and sencond or the divisor is 0, then it should perform a division by zero operation, so it will leads to an unexpected termination of the program.

Like that, if an array size is declared as 5, and we are try to insert 6 elements into it , there will also a quick termination. It is also says that crashing of a program.

This is a clear explanation of errors in a programming language. If you can't understand or still have any doubt don't feel bad to comment it. Otherwise don't forget to upvote.


Related Solutions

Describe types of rater errors that can occur during performance review conversations?
Describe types of rater errors that can occur during performance review conversations?
About errors that can occur in the process of meiosis, and several types of errors are...
About errors that can occur in the process of meiosis, and several types of errors are mentioned. Select of these types of errors (e.g. chromosome number, non-disjunctions, etc.) and provide a brief description of the error. Then do a little bit of online research related to the type of error and identify and describe one disease or condition that can result from this type of error (example – Trisomy 21 is where there is an extra chromosome in the 21st...
Describe two types of computational errors that can occur in financial calculations and discuss (150 to...
Describe two types of computational errors that can occur in financial calculations and discuss (150 to 180 words) strategies to avoid and detect errors.
Errors in the program evaluation process can occur at any stage and can potentially have disastrous...
Errors in the program evaluation process can occur at any stage and can potentially have disastrous effects on the acceptance or proper interpretation of the results. These errors encompass many areas including, but not limited to relationships, logic, scapegoating, and population masking. For this discussion, respond to the following: Analyze which errors have the most damaging impact on an evaluation. Provide clear examples to support your perspective from your experiences, course materials, or your own research. Use APA formatting to...
List other types of errors that occur during replication of DNA.7. Explain why the formation of...
List other types of errors that occur during replication of DNA.7. Explain why the formation of mismatched base pairs during replication can cause a mutation.
Detect the errors in the following program? How many errors do you observe in the following...
Detect the errors in the following program? How many errors do you observe in the following line of code? Clearly explain what these errors are and how they can be fixed? (Note that this program has only three lines of code). Please type your program in the following textbox. for i in Range(1,20.0): if i%2=0: print(i) This is a python program
True or False: Three types of errors can occur in significance testing. A type I error...
True or False: Three types of errors can occur in significance testing. A type I error results from rejecting Ho when it is true. A type II error results from failing to reject Ho. A type III error results from a statistic student not reading the textbook, reviewing their notes and summary questions, correcting old quiz and exam questions for the Final Comprehensive Exam
Name three types of errors that are likely to occur inprograms:Which one of these...
Name three types of errors that are likely to occur in programs:Which one of these would apply to the following:A semicolon left off the end of a statementUsing the following statement in a program:Average = 10 + 20 + 30/3;Trying to take the square root of a negative numberForgetting to include thelibrary and then using the thee following statement:cout<<”Please enter a number “<<endl;
What is a payroll master file? Describe the types of errors that may occur in the...
What is a payroll master file? Describe the types of errors that may occur in the master file and how they get there. How would you design payroll procedures to help prevent them?
- In general, the occurrence of errors (errors) in a program can be classified in four...
- In general, the occurrence of errors (errors) in a program can be classified in four categories. List and explain, then give an example, of each mistake (error)! and also - It is known that: S -> aB | bA A -> a | aS | bAA B -> b | bS | aBB Derivation for the string aaabbabbba Provide a solution for its derivation and syntax analysis. Please explain it with easy understandable method, because im still in learning...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT