Filters
Question type

Study Flashcards

Which of the following blocks is designed to catch any type of exception?


A) catch() { }
B) catch(...) { }
C) catch(*) { }
D) catch(exception) { }

E) B) and D)
F) A) and D)

Correct Answer

verifed

verified

The general syntax to rethrow an exception caught by a catch block is: ____ (in this case, the same exception is rethrown) .


A) rethrow;
B) throw;
C) rethrow exception;
D) throw exception;

E) B) and C)
F) A) and B)

Correct Answer

verifed

verified

A(n) ____________________ block specifies the type of exception it can catch and contains an exception handler.

Correct Answer

verifed

verified

The logic_error and runtime_error classes are defined in the header file ____.


A) stdex
B) stdlib
C) stdexcept
D) exception

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

All derived classes of the class exception override the function ____________________ to issue their own error messages.

Correct Answer

verifed

verified

A catch block can have, at most, ____ catch block parameter(s) .


A) zero
B) one
C) two
D) three

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

If the operator new cannot allocate memory space, this operator throws a(n) ____________________ exception.

Correct Answer

verifed

verified

The order of the catch blocks does not affect the program.

A) True
B) False

Correct Answer

verifed

verified

If the catch block with an ellipses (in the heading) is needed, then it should be the first catch block in a sequence of try/catch blocks.

A) True
B) False

Correct Answer

verifed

verified

Which of the following is a valid C++ statement?


A) assert(0 = divisor) ;
B) assert(divisor != 0) ;
C) assert(divisor 0) ;
D) assert(divisor is 0) ;

E) All of the above
F) C) and D)

Correct Answer

verifed

verified

When an exception is thrown, if the program does not handle the exception, then the function ____ is called to terminate the program.


A) log
B) what
C) terminate
D) close

E) B) and C)
F) All of the above

Correct Answer

verifed

verified

If you want to include members in your exception class, you typically include the function ____.


A) that
B) this
C) log
D) what

E) B) and D)
F) B) and C)

Correct Answer

verifed

verified

In C++, any class can be considered an exception class.

A) True
B) False

Correct Answer

verifed

verified

The function ____ can check whether an expression meets the required conditions; if the conditions are not met, it terminates the program.


A) check
B) look
C) assert
D) what

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

C++ provides all the exception classes you will ever need.

A) True
B) False

Correct Answer

verifed

verified

The heading of a try block can contain ellipses in place of a parameter.

A) True
B) False

Correct Answer

verifed

verified

Which of the following options should you choose when an exception occurs in the program that analyzes an airline's ticketing transactions?


A) Terminate the program.
B) Include code in the program to recover from the exception.
C) Log the error and continue.
D) Include code in the header file.

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

Which of the following statements throws a valid exception in C++?


A) throw.function() ;
B) throw 2;
C) throws str;
D) 4 throw;

E) A) and D)
F) None of the above

Correct Answer

verifed

verified

When an exception is thrown in a function, the function-call stack is ____ so that the exception can be caught in the next try/catch block.


A) destroyed
B) allocated
C) unbound
D) unwound

E) A) and B)
F) All of the above

Correct Answer

verifed

verified

Which of the following statements creates a new exception class?


A) class myClass {};
B) class myClass {} implements exception;
C) class myExceptionClass {} extends exception;
D) class myExceptionClass {} throws exception;

E) None of the above
F) A) and B)

Correct Answer

verifed

verified

Showing 21 - 40 of 42

Related Exams

Show Answer