Exam 16: Exceptions and Templates

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

How much memory is reserved for a function template?

Free
(Multiple Choice)
4.9/5
(36)
Correct Answer:
Verified

D

Given the following code, what will happen if the value of denom is 0? double divide(int numer, int denom) { if (denom == 0) \quad throw "ERROR: Cannot divide by zero.\n"; else \quad Return static_cast<double>(numer)/denom; }

Free
(Multiple Choice)
4.8/5
(28)
Correct Answer:
Verified

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:
Verified

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)

When an error occurs, an exception is

(Multiple Choice)
4.9/5
(41)

If an exception is not caught, it is stored for later use.

(True/False)
4.8/5
(38)

A generic function that can work with any data type is a

(Multiple Choice)
4.8/5
(38)

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)

Catch blocks serve as

(Multiple Choice)
4.8/5
(36)

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
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)