1B. The following function does not throw any unhandled exceptions. void f1( ) t
ID: 3693767 • Letter: 1
Question
1B.
The following function does not throw any unhandled exceptions.
void f1( ) throw ( );
Select one:
True
False
2B.
Which of the following code fragments are illegal?
Select one:
c. All of these
d. None of these
3B.
A catch block that expects an integer argument will catch
Select one:
a. all exceptions.
b. all integer exceptions.
c. any exception value that can be coerced into an integer.
d. None of these.
4B.
A catch block that expects an integer argument will catch
Select one:
a. all exceptions.
b. all integer exceptions.
c. any exception value that can be coerced into an integer.
d. None of these.
5B.
Which of the following is NOT a valid reason for using exception handling?
Select one:
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 these
6B.
A throw statement can throw
Select one:
a. an integer exception.
b. a float exception.
c. a bool exception.
d. an exception of any data type.
e. All of these.
f. None of these.
7B.
Which type of exception is thrown if a call to the new operator fails?
Select one:
a. ArithmeticError
b. DivideByZero
c. bad_alloc
d. MemoryError
8B.
Which of the following function declaration correctly specifies that two types of exceptions are thrown?
Select one:
a. void f1(exception a, exception b);
b. void f1( ) exception (a;b);
c. void f1( ) throw a, throw b;
d. void f1( ) thaw (a,b);
9B.
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
Select one:
a. not catch the exception in the function.
b. throw an integer exception.
c. never throw an exception in this function.
d. None of these.
10B.
If a function will possibly throw an unhandled exception, the try block should
Select one:
a. be in the function definition.
b. encompass the function call.
c. be in the catch block.
d. not be used.
Explanation / Answer
2B. option (d)
3B. option (b)
4B. option (b)
5B. option (a)
6B. option (e)
7B. option (c)
8B. option (d)
9B. option (a)
10B. option (b)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.