Chapter 7


1.

What is the syntax in C++ to trap all errors?

 try{}catch( ) {}

2.

What are the three general types of errors?

 syntax , logic , runtime

3.

What are the four most common mistakes in C++?

missing semicolon, missing brackets, misspelled words, case sensitivity

4.

List three of the basic exception classes in C++.

 runtime_error , exception, invalid_argument , out_of_range. overflow

5.

What does it mean to throw an exception?

the exception is passed to the calling function to handle.

6.

What happens if you forget to terminate a statement with a semi- colon?

the compiler attempts to execute the next line of code as if it where part of the first statement.

7.

What is the purpose of the catch block?

to catch or trap exceptions

8.

What is an exception?

an interruption to the normal execution of your program

9.

What happens if an exception occurs that is NOT handled by a try- catch block?

the program halts it crashes.

10.

What type of code can you place between the end of the try and the beginning of the catch?

none

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




C++ Programming Fundamentals
C++ Programming Fundamentals (Cyberrookies)
ISBN: 1584502371
EAN: 2147483647
Year: 2005
Pages: 197
Authors: Chuck Easttom

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net