1. What type of copy is performed when using the assignment operator with two objects if the assignment operator has not been overloaded? a. Carbon copy b. Shallow copy c. Deep copy d. Serious copy e. Xerox copy I'm thinking it's b.. Can anyone confirm and explain? Thank you |
And another one, I think this one is A? 2. When executing the constructor of a derived class, when is the constructor of the base class invoked? a. At the beginning of the constructor function b. At the end of the constructor function c. At the end of the constructor’s prototype d. When it is explicitly called in the function e. When to object goes out of scope |
3. Why is the second parameter of the following function passed as a constant reference rather than passed by value? ostream& operator<<(ostream& out, const addressType &address) a. Because the function will change its value b. Because operator overload functions cannot take a by-value argument c. So that the entire class will not be passed on the stack, thus saving memory space and execution time, but at the same time disallowing the function to change the value of address d. Because objects cannot be passed by-value e. Because all operands to a binary function must be constant references. This one I think is A? But it's << so it wouldn't be changing? |