Answer:
bool operator == (const employee& lhs, const employee& rhs) // prototype
Give all output to the program below as indicated by the cout statements.
#include <iostream.h>
class foo
{
public:
float x;
double y;
};
void main()
{
int i = 75;
int * ip1, * ip2;
ip1 = &i;
ip2 = ip1;
cout << i << " " << *ip1 << " " << *ip2 << endl;
*ip2 = 85;
cout << i << " " << *ip1 << " " << *ip2 << endl;
foo f;
foo * fp = &f;
f.x = 6.8; f.y = 9.9;
cout << f.x << " " << (fp -> x) << endl;
(fp -> x) = (fp -> x) + 2.0;
cout << f.x << " " << (fp -> x) << endl;
cout << sizeof(f) << " " << sizeof(fp) << endl;
}
Answer:
75 75 75
85 85 85
6.8 6.8
8.8 8.8
12 4
Indicate whether each of the following statements is true or false. For false
statements, indicate why they are false.
a) Insertion Sort and Selection Sort in the worst case both require ~n2
comparisons.
Answer: True
c) When character arrays are used as primitive strings in C++, a location must
be reserved for the '\0' character to mark the "end" of the string.
Answer: True
d) Objects of a base class can access member functions and data defined in a
derived class.
Answer: False -- it is the other way around (as long as the members are public
or protected)