Filters
Question type

If a function throws an exception, it must be caught inside that function.

A) True
B) False

Correct Answer

verifed

verified

False

C++ signals an error or unusual situation by __________.

Correct Answer

verifed

verified

throwing a...

View Answer

Functions that might throw an exception must have a throw list.

A) True
B) False

Correct Answer

verifed

verified

Which of the following function declaration correctly specifies that two types of exceptions are thrown?


A) void f1exception a, exception b) ;
B) void f1 ) exception a;b) ;
C) void f1 ) throw a, throw b;
D) void f1 ) thaw a,b) ;

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

Correct Answer

verifed

verified

The following function does not throw any unhandled exceptions void f1 ) throw );

A) True
B) False

Correct Answer

verifed

verified

If some part of your program or any library functions that are called) throw an exception, then if this exception is not handled in your code, your program will _____.

Correct Answer

verifed

verified

exit

Which of the following is not a valid reason for using exception handling?


A) throw and catch can be used like gotos
B) the procedure for handling an error depends on the situation
C) need to handle built in exceptions
D) none of the above

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

Correct Answer

verifed

verified

Which type of exception is thrown if a call to the new operator fails?


A) ArithmeticError
B) DivideByZero
C) bad_alloc
D) MemoryError

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

Correct Answer

verifed

verified

The catch block is also known as the ___________.

Correct Answer

verifed

verified

If class A is derived from class B, and a virtual function in class B throws an exception, then the overridden version of that function in class A must


A) not throw any exceptions
B) have an exception specification that is a subset of the exception specification of the base class B
C) not throw any exceptions that the function in class B might throw
D) all of the above

E) None of the above
F) All of the above

Correct Answer

verifed

verified

When a throw statement is executed,


A) execution of the try block stops
B) execution of the throw block stops
C) the program always exits
D) execution of the catch block stops

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

Correct Answer

verifed

verified

A throw statement passes which type of value to the catch block?

Correct Answer

verifed

verified

any valid ...

View Answer

If you have a function that might throw an exception and some programs that use that function might want to handle that exception differently, you should


A) not catch the exception in the function
B) throw an integer exception
C) never throw an exception in this function
D) none of the above

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

Correct Answer

verifed

verified

The catch block catch ...) is known as the ______________.

Correct Answer

verifed

verified

When an unusual situation or error occurs, then the ________ statement is executed.


A) try
B) throw
C) error
D) exiting

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

Correct Answer

verifed

verified

If the following function will throw a string exception, then Void myFunction ) ;


A) the function definition and declaration should have a throw list
B) the function definition, but not the declaration should have a throw list
C) the function should have an empty throw list.
D) all of the above

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

Correct Answer

verifed

verified

A class that is used for exceptions is declared


A) differently from other classes
B) specialized only for exceptions
C) may not have objects declared of that class
D) all of the above
E) none of the above

F) A) and B)
G) A) and D)

Correct Answer

verifed

verified

It is legal to have a catch block with no parameter.

A) True
B) False

Correct Answer

verifed

verified

True

The following catch block catches all __________ exceptions. catch string e) { }

Correct Answer

verifed

verified

If the following function throws an unhandled exception, what happens? void f1);

Correct Answer

verifed

verified

the exception will p...

View Answer

Showing 1 - 20 of 47

Related Exams

Show Answer