eecs280f13_FinalExam

eecs280f13_FinalExam - uniqname EECS280FinalExam Fall2013...

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

View Full Document Right Arrow Icon
uniqname: _________________________ EECS 280 Final Exam Fall 2013 This is a closed­book exam. There are 5 problems on 25 pages. Do not open this exam until instructed to do so. You should have one empty chair between you and the next person. Write your uniqname on the line provided at the top of each page. Write your answers in the space provided. Should you need extra space, write on the back of the sheet containing the question. Be neat and write legibly. You will be graded not only on the correctness of your answer, but also on the clarity with which you express it. Protip: Read the entire exam through before you begin working. Work on those problems you find easiest first. Read each question carefully, and note all that is required of you. Keep your answers clear and concise, and state all of your assumptions carefully. You are to abide by the University of Michigan/Engineering honor code. Please sign below to signify that you have kept the honor code pledge: I have neither given nor received aid on this exam, nor have I concealed any violations of the Honor Code. Signature: _________________________________________ Name: _________________________________________ Uniqname: _________________________________________ Room you are in: _________________________________________ First and last name of person sitting to your right (write the symbol if at the end of a row): _________________________________________ First and last name of person sitting to your left (write the symbol if at the end of a row): _________________________________________ Correctly completing this cover page is worth 1 point. University of Michigan Professors Andrew DeOrio and Kevin Fu EECS 280 Fall 2013 1/25
Background image of page 1

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

View Full Document Right Arrow Icon
uniqname: _________________________ Do not write here. Cover page _________ out of 1 Staff Initials Problem 1 _________ out of 19 Problem 2 _________ out of 20 Problem 3 _________ out of 20 Problem 4 _________ out of 20 Problem 5 _________ out of 20 Total: _________ out of 100 EECS 280 Fall 2013 2/25
Background image of page 2
uniqname: _________________________ Problem 1: Short Answer (19 points) PART A: Big Three (10 points) The code below will generate 10 lines of output. These 10 lines have been given to you out of order. Arrange them in the order they would be generated in. (NOTE: it’s OK to tear out this page) class BigThree { private: int i; public: BigThree(int i_in) : i(i_in) { cout << "Constructor: " << i << endl; } BigThree(const BigThree &o) : i(o.i) { cout << "Copy constructor: " << i << endl; } BigThree& operator=(const BigThree &o) { cout << "Assignment operator: " <<o.i<< "­>" << i << endl; i = o.i; return *this; } ~BigThree() { cout << "Destructor: " << i << endl; } void test(BigThree a, BigThree &b) { cout<<"I got my 10 points!"<<endl; } int main() { BigThree var1(1); BigThree var2(2); BigThree other = var2; other = var1; test(var1, var2); } EECS 280 Fall 2013 3/25
Background image of page 3

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

View Full Document Right Arrow Icon
uniqname: _________________________ Incorrect order of output: Write the correct order of output: Copy constructor: 2 Constructor: 2 Copy constructor: 1 Destructor: 1 Destructor: 2 Assignment operator: 1­>2 Constructor: 1 I got my 10 points! EECS 280 Fall 2013 4/25
Background image of page 4
uniqname: _________________________ Part B: Subclasses and Subtypes, and Virtual Functions (5 points) (NOTE: it’s OK to tear out this page) class Ball { public: virtual int toss(int target_distance, int target_height); // REQUIRES: target_height is greater 0 // EFFECTS: returns the actual distance traveled, // which is <= target_distance virtual bool bounces(); // EFFECTS: return true if ball is inflated, false if not } class Football : public Ball { int toss(int target_distance, int target_height);
Background image of page 5

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

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 25

eecs280f13_FinalExam - uniqname EECS280FinalExam Fall2013...

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

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