Filters
Question type

Study Flashcards

The function ____ returns a string containing an appropriate message.


A) where
B) what
C) when
D) log

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

Correct Answer

verifed

verified

Which of the following options should you choose when an exception occurs in a 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) None of the above
F) A) and C)

Correct Answer

verifed

verified

In a sequence of try/catch blocks, the last catch block of that sequence should be ____.


A) catch(...) { }
B) catch(int x) { }
C) catch(str) { }
D) catch(exception) {}

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

Correct Answer

verifed

verified

To use the assert function in your program, you should include the statement ____.


A) #include <assert>
B) #include <cassert>
C) #include <iostream>
D) #include <exception>

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

Correct Answer

verifed

verified

To deal with logical errors in a program, such as a string subscript out of range or an invalid argument to a function call, several classes are derived from the class ____.


A) logic_error
B) logic_exception
C) runtime_error
D) exception

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

Correct Answer

verifed

verified

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

A) True
B) False

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 D)
F) A) and B)

Correct Answer

verifed

verified

Throwing an exception is typically done using the ____________________ statement.

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) All of the above
F) A) and D)

Correct Answer

verifed

verified

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

A) True
B) False

Correct Answer

verifed

verified

Which of the following classes is derived from the class runtime_error?


A) bad_alloc
B) out_of_range
C) overflow_error
D) length_error

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

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) B) and C)
F) A) and B)

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) None of the above
F) A) and B)

Correct Answer

verifed

verified

The statements that may generate an exception are placed in a ____ block.


A) throw
B) finally
C) try
D) catch

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

Correct Answer

verifed

verified

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) B) and C)

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) B) and D)
F) B) 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 class ____ is the base of the classes designed to handle exceptions.


A) class
B) exception
C) logic_error
D) runtime_error

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

Correct Answer

verifed

verified

The class ____________________ deals with the string subscript out of range error.

Correct Answer

verifed

verified

If no exception is thrown in a try block, all catch blocks associated with that try block are ignored.

A) True
B) False

Correct Answer

verifed

verified

Showing 21 - 40 of 43

Related Exams

Show Answer