Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

Students also viewed these Databases questions

Question

Assess three steps in the selection process.

Answered: 1 week ago

Question

Identify the steps in job analysis.

Answered: 1 week ago