Docsity

CSE687 Object Oriented Design MidTerm Exam A2 - Spring 2001 - Prof. James Fawcett, Study notes of Engineering

Toggle sidebar
bg1
CSE687 Object Oriented Design MidTerm Exam A2 Spring 2001
Midterm A2
Name:__________________________________________________ SSN:________________________
This is a closed book examination. Please place all your books on the floor beside you. You may keep one
page of notes on your desktop in addition to this exam package. All examinations will be collected
promptly at the end of the class period. Please be prepared to quickly hand in your examination at that
time.
If you have any questions, please do not leave your seat. Raise your hand and I will come to your desk to
discuss your question. I will answer all questions about the meaning of the wording of any question. I may
choose not to answer other questions.
You will find it helpful to review all questions before beginning. All questions are given equal weight for
grading, but not all questions have the same difficulty. Therefore, it is very much to your advantage to
answer first those questions you believe to be easiest.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download CSE687 Object Oriented Design MidTerm Exam A2 - Spring 2001 - Prof. James Fawcett and more Study notes Engineering in PDF only on Docsity!

Midterm A Name:__________________________________________________ SSN:________________________ This is a closed book examination. Please place all your books on the floor beside you. You may keep one page of notes on your desktop in addition to this exam package. All examinations will be collected promptly at the end of the class period. Please be prepared to quickly hand in your examination at that time. If you have any questions, please do not leave your seat. Raise your hand and I will come to your desk to discuss your question. I will answer all questions about the meaning of the wording of any question. I may choose not to answer other questions. You will find it helpful to review all questions before beginning. All questions are given equal weight for grading, but not all questions have the same difficulty. Therefore, it is very much to your advantage to answer first those questions you believe to be easiest.

  1. Given the class declaration: class A { … }; class B { … }; class C : public A, public B { … }; Implement a two functions in C, one that returns a pointer to C’s base A, and one that returns a pointer to C’s base B. How would you demonstrate that the operation of these functions is correct. Assume that you can modify the base classes in some small way if you need to. Do you need to?
  1. Write a function that accepts an STL vector of strings and returns a vector of doubles. It is required to do that by converting any string in the incoming vector to a double if its characters can be interpreted as the representation of an double. What happens if there are no such strings in the input vector?
  1. Write a template-based function that accepts two pointers to objects of some arbitrary type and returns with the pointers swapped. That is, if the first pointer points to object A and the second points to object B when the function is called, then when the function returns, the first pointer must point to B and the second to A. Please do this as efficiently as possible.
  1. Students are supported by many different financial sources: loans, relatives, their government, corporate scholarships, and by the university, based on both academic merit, and need. The rules by which the university and these sources of financial aid interact vary, depending on the source. Use OMT or UML diagrams to represent the financial relationships between the university, its students, and the various specialized sources of financial aid. You should assume that all nouns and the word specialized in this paragraph are significant.
  1. Suppose that X is a class that is declared as follows: class X { public: explicit X(const char *) ; void aFunction(const X &x) const; … }; Can we directly pass a literal string to aFunction? If not, how can you pass a literal string to the function? What contract does this function make with its clients?
  1. What issues affect the performance of objects of a C++ class? By performance, we mean the speed with which it carries out its assigned operations and the memory required for the operations. Please be a specific as possible and describe why the issues you cite affect performance.
  1. What is the difference between function overloading and redefinition?