Exam 18: Exception Handling

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

When an exception is thrown,the function finishes its execution,its value is returned,then control is transferred to the catch block.

Free
(True/False)
4.7/5
(34)
Correct Answer:
Verified

False

A circumstance in C++ where an exception is thrown must be an error.

Free
(True/False)
4.8/5
(35)
Correct Answer:
Verified

False

In C++ an exception object must be derived from the exception class defined in the standard library.

Free
(True/False)
4.8/5
(39)
Correct Answer:
Verified

False

Write a definition for an exception class,E,that contains an error number and a string type error name.Include a constructor that creates an E object and initializes both members.Provide accessors for both the message and error number.

(Essay)
4.9/5
(35)

The exception specification for a function has no effect on an exception that is caught within the function.

(True/False)
4.8/5
(40)

When an event occurs that cannot be managed locally,an exception may be thrown.Throwing the exception object transfers control and information gleaned locally to some calling program unit that manages the event,or the program terminates.

(True/False)
4.8/5
(42)

Explain how the mechanism for deciding which catch block catches an exception is like the mechanism for deciding which function definition is used when an overloaded function is called.

(Essay)
4.9/5
(46)

If an exception is thrown in a function,say,f(),but not handled there,the exception is propagated to the function that called f().

(True/False)
4.7/5
(39)

Mentioning a base class B in an exception specification includes a class D objects,where D is derived from B,in the exception specification.

(True/False)
4.8/5
(42)

A function does not have an exception specification at all,so exceptions are prohibited.

(True/False)
4.9/5
(36)

Suppose an exception of type E is thrown in a function but not listed in the exception specification,and is not caught in the function.The exception will be caught in a calling function that has a catch block that declares an exception of that type.

(True/False)
4.8/5
(33)

A program can continue to run after an exception has been thrown and caught.

(True/False)
4.9/5
(29)

The context in which an exception is handled (or managed)is the throw block.

(True/False)
4.9/5
(36)

An exception is signaled or raised with the keyword catch followed by an exception object that may be of any C++ type.

(True/False)
4.8/5
(45)

Describe the circumstances that the unexpected()function will be called.

(Essay)
4.8/5
(40)

In C++,an exception object can be a user-defined type or any type that is built-into C++ language.

(True/False)
4.9/5
(28)

What is the purpose of exception handling?

(Essay)
4.9/5
(35)

Compilers will check code in functions against exception specifications.

(True/False)
4.7/5
(33)

The default action of unexpected()can be changed.

(True/False)
4.9/5
(34)

How can you write a catch block that will catch all exceptions that have been thrown but not yet caught?

(Essay)
4.8/5
(40)
Showing 1 - 20 of 29
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)