{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Computer Science 61B - Summer 1995 - Midterm 2

# Computer Science 61B - Summer 1995 - Midterm 2 - CS 61B...

This preview shows pages 1–3. Sign up to view the full content.

CS 61B MIDTERM#2 SUMMER, 1995 CS 61B SUMMER 1995 Midterm#2 Instructor: Unknown Problem #1 Your goal is to determine what the following program prints. You may wish to fill in the comments in order to aid in partial credit, but you will get full credit if the answer is correct. #include < iostream.h > int c1=0, c2=0, c3=0, c4=0, c5=0; class David { public: David() {c1++;} David(David &dave) {c2++;} David(int mary) {c3++;} ~David() {c4++;} David &operator=(const David & dave) {c5++;} }; void f(David a){} main() { //scratch work for partical credit David a, b; //c1: c2: c3: c4: c5: { David c(a); //c1: c2: c3: c4: c5: David d(3); //c1: c2: c3: c4: c5: David *e = new David; //c1: c2: c3: c4: c5: f(d); //c1: c2: c3: c4: c5: g(d); //c1: c2: c3: c4: c5: } //c1: c2: c3: c4: c5: Count << "Answer: " << c1 << c2 << c3 << c4 << c5 << endl; } file:///C|/Documents%20and%20Settings/Jason%20Raf. ..e%2061B%20-%20Summer%201995%20-%20Midterm%202.htm (1 of 5)1/27/2007 6:33:02 PM

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document