Computer Science 61B - Summer 1995 - Midterm 2

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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS 61B MIDTERM#2 SUMMER, 1995 Fill in the answer below. Answer:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This test prep was uploaded on 04/20/2008 for the course CS 61B taught by Professor Canny during the Spring '01 term at University of California, Berkeley.

Page1 / 5

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

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online