Question: 1)Suppose you declared an array as double x[] = new double[30]; to destroy it, use ________. A )delete [] x; B )v.insert(5); C) delete x;

1)"Suppose you declared an array as double x[] = new double[30]; to destroy it, use ________.

A )delete [] x;

B

)v.insert(5);

C)

delete x;

D)

delete *x;

F)

delete x[];

2)Which of the following function header declaration is correct?

A)"int* reverse(int* const list[], const int size)"

B)"int* reverse(int* const list, const int size)"

C)

"int int[] reverse(int* const list, const int size)"

D)"int* reverse(int const list[], const int size)"

3)Suppose a template function is defined as follows:

template

T maxValue(const T& value1, const T& value2)

{

if (value1 > value2)

return value1;

else

return value2;

}

Which of the following statements are correct?

A)

"cout << maxValue(1, 2)"

B)

"cout << maxValue('A', 'B')"

C)

"cout << maxValue(1.5, 2)"

D)

"cout << maxValue(""AB"", ""AB"")"

F)

"cout << maxValue(1.5, 2.5)"

4)If you define the swap function as follows:

template

void swap(T& var1, T& var2)

{

T temp = var1;

var1 = var2;

var2 = temp;

}

You can invoke swap using ______.

"int v1 = 1; double v2 = 2; swap(v1, v2);"

"int v1 = 1; int v2 = 2; swap(v1, v2);"

"int v1 = 1; int v2 = 2; swap(&v1, &v2);"

"swap(1, 2)"

5)Which of the following statements is correct?

A)

Templates improves performance.

B)

"With templates, you can define one function or one class with a generic type that can be substituted for a concrete type by the compiler."

C)Templates provide the capability to parameterize types in functions and classes.

D)Templates facilitates developing reusable software.

6)The function what() is defined in ______________.

a)

runtime_error

B)

exception

C)

overflow_error

D)

underflow_error

F)

bad_exception

7)Which of the following classes are in the header file ?

a)

bad_cast

b)

invalid_argument

C)length_error

D)

out_of_range

C)

logic_error

7)Which of the following statements are true?

a)A custom exception class is just like a regular class.

b)A custom exception class must always be derived from class exception.

C)A custom exception class must always be derived from a derived class of class exception.

D)A custom exception class must always be derived from class runtime_error.

9)Which of the following statements are true?

A)Simple errors that may occur in individual functions are best handled locally without throwing exceptions.

B)"Exception handling is for dealing with unexpected error conditions. Do not use a try-catch block to deal with simple, expected situations."

C)"In general, common exceptions that may occur in multiple classes in a project are candidates for exception classes."

D)

C++ allows you to throw a primitive type value or any object-type value.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!