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 ______________.
7)Which of the following classes are in the header file ?
7)Which of the following statements are true?
|
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started