Exam 16: Exceptions and Templates
Exam 1: Introduction to Computers and Programming47 Questions
Exam 2: Introduction to C62 Questions
Exam 3: Expressions and Interactivity45 Questions
Exam 4: Making Decisions51 Questions
Exam 5: Loops and Files60 Questions
Exam 6: Functions49 Questions
Exam 7: Arrays and Vectors56 Questions
Exam 8: Searching and Sorting Arrays30 Questions
Exam 9: Pointers47 Questions
Exam 10: Characters, C-Strings, and More About the String Class47 Questions
Exam 11: Structured Data46 Questions
Exam 12: Advanced File Operations38 Questions
Exam 13: Introduction to Classes54 Questions
Exam 14: More About Classes46 Questions
Exam 15: Inheritance, Polymorphism, and Virtual Functions43 Questions
Exam 16: Exceptions and Templates36 Questions
Exam 17: The Standard Template Library38 Questions
Exam 18: Linked Lists41 Questions
Exam 19: Stacks and Queues47 Questions
Exam 20: Recursion27 Questions
Exam 21: Binary Trees39 Questions
Select questions type
How much memory is reserved for a function template?
Free
(Multiple Choice)
4.9/5
(36)
Correct Answer:
D
Given the following code, what will happen if the value of denom is 0?
double divide(int numer, int denom)
{
if (denom == 0)
throw "ERROR: Cannot divide by zero.\n";
else
Return static_cast<double>(numer)/denom;
}
Free
(Multiple Choice)
4.8/5
(28)
Correct Answer:
C
A generic function that can work with any data type is called an exception template.
Free
(True/False)
4.8/5
(32)
Correct Answer:
False
A function template's prefix contains __________ enclosed in angle brackets.
(Multiple Choice)
4.9/5
(30)
The line containing a throw statement is known as the throw point.
(True/False)
4.9/5
(36)
All type parameters defined in a function template must appear at least once in the
(Multiple Choice)
4.8/5
(32)
When the __________ operator fails to allocate memory, C++ throws a bad_alloc exception.
(Multiple Choice)
4.8/5
(35)
The __________ starts with the key word try and is followed by a block of code that executes any statement that might cause an exception to be thrown..
(Multiple Choice)
4.8/5
(36)
Exceptions are used to signal errors or unexpected results that occur when a program is running.
(True/False)
4.8/5
(29)
What does the word class indicate in the following statement?
Template < class T >
(Multiple Choice)
4.8/5
(41)
The try block of a try/catch construct is used to display the definition of an exception parameter.
(True/False)
5.0/5
(31)
If an exception is not caught, the program will abort execution.
(True/False)
4.9/5
(36)
An actual instance of the function is created in memory when the compiler encounters
(Multiple Choice)
4.9/5
(45)
Which of the following is used to signal errors or unexpected results that happen as a program runs?
(Multiple Choice)
4.7/5
(36)
Function templates allow you to write a single function definition that works with many data types.
(True/False)
4.8/5
(28)
There is no difference between declaring an object of an ordinary class and an object of a template class.
(True/False)
4.8/5
(33)
Showing 1 - 20 of 36
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)