978-1337102087 Chapter 14

subject Type Homework Help
subject Pages 9
subject Words 1798
subject Authors D. S. Malik

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 1
1. An exception is an occurrence of an undesirable situation that can be detected during program compilation.
a.
True
b.
False
ANSWER:
False
POINTS:
1
REFERENCES:
992
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
2. One of the typical ways of dealing with exceptions is to use an if statement.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
992
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
3. The heading of a try block can contain ellipses in place of a parameter.
a.
True
b.
False
ANSWER:
False
POINTS:
1
REFERENCES:
997
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
4. A catch block specifies the type of exception it can catch and immediately terminates the program.
a.
True
b.
False
ANSWER:
False
POINTS:
1
REFERENCES:
996
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
page-pf2
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 2
5. If no exception is thrown in a try block, all catch blocks associated with that try block are ignored.
a.
True
b.
False
ANSWER:
True
POINTS:
1
REFERENCES:
997
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
6. An object that is being thrown cannot be an anonymous object.
a.
True
b.
False
ANSWER:
False
POINTS:
1
REFERENCES:
998
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
7. The order of the catch blocks does not affect the program.
a.
True
b.
False
ANSWER:
False
POINTS:
1
REFERENCES:
998-999
QUESTION TYPE:
True / False
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
8. 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
ANSWER:
False
POINTS:
1
REFERENCES:
999
QUESTION TYPE:
True / False
HAS VARIABLES:
False
page-pf3
Name:
Class:
Date:
page-pf4
Name:
Class:
Date:
page-pf5
Name:
Class:
Date:
page-pf6
Name:
Class:
Date:
page-pf7
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 7
a.
logic_error
b.
logic_exception
c.
runtime_error
d.
exception
ANSWER:
a
POINTS:
1
REFERENCES:
1004
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
25. The class ____ is designed to deal with illegal arguments used in a function call.
a.
illegal_argument
b.
bad_argument
c.
invalid_call
d.
invalid_argument
ANSWER:
d
POINTS:
1
REFERENCES:
1004
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
26. 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
ANSWER:
c
POINTS:
1
REFERENCES:
1004
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
27. The class ____ is designed to deal with errors that can be detected only during program execution.
a.
error
b.
exception
c.
runtime_error
d.
logic_error
ANSWER:
c
POINTS:
1
REFERENCES:
1004
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
page-pf8
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 8
28. The logic_error and runtime_error classes are defined in the header file ____.
a.
stdex
b.
stdlib
c.
stdexcept
d.
exception
ANSWER:
c
POINTS:
1
REFERENCES:
1004
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
29. 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;
ANSWER:
a
POINTS:
1
REFERENCES:
1007
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
30. If you want to include members in your exception class, you typically include the function ____.
a.
that
b.
this
c.
log
d.
what
ANSWER:
d
POINTS:
1
REFERENCES:
1009
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
31. 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;
ANSWER:
b
POINTS:
1
REFERENCES:
1016
QUESTION TYPE:
Multiple Choice
page-pf9
Name:
Class:
Date:
page-pfa
Name:
Class:
Date:
Copyright Cengage Learning. Powered by Cognero.
Page 10
35. 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
ANSWER:
c
POINTS:
1
REFERENCES:
1022
QUESTION TYPE:
Multiple Choice
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
36. A(n) ____________________ block specifies the type of exception it can catch and contains an exception handler.
ANSWER:
catch
POINTS:
1
REFERENCES:
996
QUESTION TYPE:
Completion
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
37. The ____________________ of the catch block parameter specifies the type of exception that the catch block can
catch.
ANSWER:
data type
POINTS:
1
REFERENCES:
997
QUESTION TYPE:
Completion
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
38. Throwing an exception is typically done using the ____________________ statement.
ANSWER:
throw
POINTS:
1
REFERENCES:
997
QUESTION TYPE:
Completion
HAS VARIABLES:
False
DATE CREATED:
10/5/2016 1:42 PM
DATE MODIFIED:
10/5/2016 1:42 PM
39. In C++, throw is a(n) ____________________ word.
ANSWER:
reserved
POINTS:
1
page-pfb
Name:
Class:
Date:

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.