final-draft - EECS 280: Final Fall 2005 This is a...

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

View Full Document Right Arrow Icon
EECS 280 Fall 2005 1 EECS 280: Final Fall 2005 This is a closed-book exam; no notes are allowed. There are five problems on 18 pages. 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 an- swers clear and concise, and state all of your assumptions carefully. Each question has a box for your answer; please put your answers in the boxes provided. 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. Honor code pledge: I have neither given nor received aid on this exam. Signature: _________________________________________ Name: _________________________________________ Uniqname: _________________________________________
Background image of page 1

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

View Full DocumentRight Arrow Icon
Uniqname:________________________________________________________________________________ EECS 280 Fall 2005 2
Background image of page 2
Uniqname:________________________________________________________________________________ EECS 280 Fall 2005 3 Problem 1 _________ out of 16 Problem 2 _________ out of 16 Problem 2 _________ out of 20 Problem 3 _________ out of 24 Problem 4 _________ out of 24 Total: ________ out of 100
Background image of page 3

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

View Full DocumentRight Arrow Icon
Uniqname:________________________________________________________________________________ EECS 280 Fall 2005 4 1 Class Mechanics In this question, you will be asked to state properties about the following classes: class Foo { int foo; public: virtual int lcm(int x, int y) = 0; }; class Bar : public Foo { protected: int bar; public: int lcm(int x, int y); // REQUIRES: x and y are positive integers. // EFFECTS: returns the least common multiple of x and y. virtual int do_stuff(Foo& f); // EFFECTS: does "stuff" }; class NonPositiveNumber {}; class Baz : public Bar { int baz; public: int lcm(int x, int y); // EFFECTS: throws NonPositiveNumber if x or y is <= 0 // returns the least-common multiple of x // and y otherwise. int greater(int x, int y); // EFFECTS: Returns the larger of x, y. }; class Bat: public Bar { private: int bat; public: int do_stuff(Foo& f) { return Bar::do_stuff(f); } };
Background image of page 4
Uniqname:________________________________________________________________________________ EECS 280 Fall 2005 5 1.a Visibility Assume that the following four statements are added to the method Bat::do_stuff above: (a) foo = 3; (b) bar = 3; (c) bat = 3; (d) baz = 3; For each statement, state whether the statement will produce a compiler error when the program is compiled by a standards-compliant compiler 1.b Subtypes Is Baz a subtype of Bar? Why or why not?
Background image of page 5

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

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

This note was uploaded on 01/28/2010 for the course EECS 203 taught by Professor Yaoyunshi during the Spring '07 term at University of Michigan.

Page1 / 18

final-draft - EECS 280: Final Fall 2005 This is a...

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