-
Classes
How many parameters are there in a binary operator implemented as a friend?Choose one answer. a. 2 b. 0 c. 1 d. as many as you need
-
Classes
The copy constructor of class Money is called in which of the following cases?Choose one answer. a. Money amount1;Money amount2(amount 1); b. void func(Money amount);[...]Money amount1;[...]func(amount1); c. Money func();[...]Money amount1 = func(); d. all of the above
-
Classes
Given the following class, what is syntactically wrong with the implementation of the display function?class Rational{public: Rational( ); Rational(int numer, int denom); Rational(int whole); int getNumerator( ); int getDenominator( ); friend void display(ostream& out, const Rational& value);private: int numerator; int denominator;};void display(ostream& out, const Rational& value){ out
-
Classes
Who can access private data in a class?Choose one answer. a. members of the class b. friends of the class c. everyone d. A and B
-
Classes
What error is caused by the following code ?class TemperatureList { public: TemperatureList( ); private: double * list; int size;};void func(Money amount);[...]int main{ TemperatureList list1; func(list1); return 0;}Choose one answer. a. double free b. divide by zero c. illegal argument d. no error
-
Operators
In the following code fragment, which is the calling object for the less-than operator?string s1, s2;if( s1 < s2 )Choose one answer. a. s1 b. < c. s2 d. none
-
Operators
Which of the following operators cannot be overloaded?Choose one answer. a. [ ] b. == c. . d. =
-
Classes
Why should you generally pass an object of the class to a friend function as a reference parameter?Choose one answer. a. if the friend function changes the values of the data member(s) b. if the friend function will not change the values of the data member(s) c. It is more efficient to pass the object by reference. d. A and B e. A and C
-
Multi-Dimension Array Size
If you need a function that will handle multi-dimensional arrays, you must specify the following sizes inside the square brackets.Choose one answer. a. All sizes except the first dimension b. None of the sizes c. All sizes except the last dimension d. All the sizes
-
Two Dimension Array
A two dimension array can also be thought of asChoose one answer. a. Table. b. Array of arrays.c. A file.d. None of the above e. A and B