| 1. | What is the syntax in C++ to trap all errors? | |
| 2. | What are the three general types of errors? | |
| 3. | What are the four most common mistakes in C++? | |
| 4. | List three of the basic exception classes in C++. | |
| 5. | What does it mean to throw an exception? | |
| 6. | What happens if you forget to terminate a statement with a semi- colon? | |
| 7. | What is the purpose of the catch block? | |
| 8. | What is an exception? | |
| 9. | What happens if an exception occurs that is NOT handled by a try- catch block? | |
| 10. | What type of code can you place between the end of the try and the beginning of the catch? | |
Answers
| 1. | try{} catch(…) {} |
| 2. | Syntax, logic, runtime |
| 3. | Missing semicolon, missing brackets, misspelled words, case sensitivity |
| 4. | Runtime_error, exception, invalid_argument, out_of_range. overflow |
| 5. | The exception is passed to the calling function to handle. |
| 6. | The compiler attempts to execute the next line of code as if it where part of the first statement. |
| 7. | To catch or trap exceptions |
| 8. | An interruption to the normal execution of your program |
| 9. | The program halts…it crashes. |
| 10. | none |